Chelsea Fan-Project-04-String Art

StringArt

/* Chelsea Fan
Section 1B
chelseaf@andrew.cmu.edu
Project-04
*/
var spacing = 15; //spacing for each line
var y = 1; //green line variation
var w = 100; //pink line variation

function setup() {
    createCanvas(400, 300);
    background(0);
    strokeWeight(1.5); 
}

function draw() {
	//Green Lines
	stroke(150, 255, 150); //green color
    for (var x = 100; x<=300; x+=spacing) {
    	line(x, 0, x*y, 300);
    	y = y*0.7;
    }
    //Blue Lines
	stroke(150, 150, 255); //blue color
    for (var x = 0; x<=100; x+=spacing/2) {
    	line(x, 0, 400-x, 300);
    }

    //Pink Lines
    stroke(255, 0 ,250); //pink color
    for (var x = 0; x<=100; x+=spacing/2) {
    	line(x+300, 0, w-x, 350);
    	w = w*0.9;

    }
    //Yellow Lines
    stroke(230, 250, 0); //yellow color
    for (var x = 0; x<=100; x+=spacing) {
    	line(0, x+100, 400, 300-x);
    noLoop(); //don't keep drawing lines
    }
}

I wanted to have bright colored lines with a dark background to make the design POP. It took me a while to fine a design of lines that were simple but interesting to view.

Leave a Reply