akluk-Project4-Section-A-StringArt

sketch
It was fun and exciting to create curves with straight lines and was challenging to figure out the correct values

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

function draw() {
	background(0)

	//establishing initial points and step sizes as variables
	var x1 = 0;
	var y1 = height;
	var x2 = 0;
	var x3 = 0;
	var y3 = 0;
	var x_step1 = width/20;
	var y_step1 = height/40;
	var x_step2 = width/15;
	var x_step3 = width/60;
	var y_step3 = height/60;


	//creates creates the blue - white curves in the center of the canvas
	for (var j = 0; j < 30; j++){
		stroke(color(240-8*j,240-8*j,255));
		line(x2,height/2,width,height/2 - j*y_step3);
		line(0,height/2 + j*y_step3,width-x2,height/2 );
		x2 += x_step2;
	}

	
	//creates green yellow gradient curve on the lower right corner
	for (var i = 0; i < 20; i++){
		stroke(color(50+10*i,150,14))
		line(x1,height,width,y1);
		x1 += x_step1;
		y1 -= y_step1;

	}

	//creates red "line" generated ellipse
	for (var k = 0; k < 30; k++){
		stroke(color(240-8*k,0,0));
		line(0,y3,x3,height/2);
		line(0,height/2-y3,x3,0);
		line(width/2,y3,width/2-x3,height/2);
		line(width/2,height/2-y3,width/2-x3,0);
		x3 += x_step3;
		y3 += y_step3;
	}
}

Leave a Reply