Project 4-Lydia Jin

sketch

//Lydia Jin
//Section B
//jialuj@andrew.cmu.edu
//Project-04
//first quadrant intial values
var x1 = 0;
var y1 = 0;
var x2 = 0;
var y2 = 600;

//third quadrant intial values
var x11 = 0;
var y11 = 640;
var x22 = 0;
var y22 = 0;

//second quadrant intial values
var x111 = 0;
var y111 = 0;
var x222 = 480;
var y222 = 0;

//fourth quadrant intial values
var x1111 = 0;
var y1111 = 640;
var x2222 = 480;
var y2222 = 640;

//step sizes
var deltaX = 24;
var deltaY = 30;

//set initial value for i for if statement
i=0;

function setup() {
    createCanvas(480, 640);
    background('pink');

}

function draw() {
	//20 steps
	if (i < 20){
		//first quadrant
		x1 += deltaX;
		y2 -= deltaY;
		stroke(0);
   		line(x1,y1,x2,y2);
   		//third quadrant
		x11 += deltaX;
		y22 += deltaY;   		
   		line(x11,y11,x22,y22);
   		//second quadrant
		x111 += deltaX;
		y222 += deltaY;   		
   		line(x111,y111,x222,y222);
   		//fourth quadrant
		x1111 += deltaX;
		y2222 -= deltaY;   		
   		line(x1111,y1111,x2222,y2222);   
   		//repeat until i reaches 19
   		i++;

	}
	
}


	

1938792002

Leave a Reply