dnam-project-04

sketch

//Doo Won Nam
//Section B
//dnam@andrew.cmu.edu
//Project-04

function setup() {
    createCanvas(400, 400);
}

function draw() {
    var unoY = 200; //y for triangle
    var unoX = 20; // x for triangle
    var yin = 37; //y increase
    var xin = 30; //x increase
//setting variables and x and y to change throughout code
    var x1 = 10;
    var y1 = 400;
    var x2 = 400;
    var y2 = 10;
    background(300, 100, 100); //pink
//start loop
    for (var i=0; i <200; i++) {
    strokeWeight(1);
    stroke(191, 50, 80); //dark pink
    line(i, i*10, i*5, 2); //line that goes across canvas

    stroke(mouseX, mouseY, mouseX); //changes color along mouse movement
    line(x1, i * yin, i * mouseX - 50, y1); //mouseX - 50 for increase of size
  	line(x2, i * yin, i * xin, y2);
  	line(xin * i, y1, x2, height - (i * mouseX) - 50);//size increase,right top
  	line(x1, height - (i * yin), i * x1, y2);

    stroke(100, 100, 180);
    line(unoX + 350, unoY, i/2 + 200, 400); //triangle at bottom
    line(200, unoY, i - 200, 0); //triangle at left top
	}
}

I made some of the lines (including the triangle which is just made out of bunch of lines). I changed some of the y increase to mouse commands to add interactions to the project. With the project, I wanted to create something like a light show that would change colors as well.

Leave a Reply