Source:


//
//Josh Schoenwald ** accad 756 ** Assignment 1 ** Due: 10/8/02
//
//
setBackgroundColor(0, 0, 0); //sets bg color to black

var i = 1;		//var for iterating loops
var chgcolor = 1; 	//var for changing pen color
var chgweight = .07; 	//var for increasing pen weight
var endpt = 0; 		//var for moving drawLine endpoints on the axes
var left = .4; 		//var for left of bounding box (x-axis)
var top = .3; 		//var for top of bounding box (y-axis)
var xwidth = left + .3; //width of box (x-axis)
var yheight = top + .4; //height of box (y-axis)

/* below loop draws a series of lines that all begin from the 
top left point and end on different points on the y-axis,
while doing so they fade from white to blue */

while (i < 15) {			//iterates 15 times
	setPenWeight(chgweight); 	//lines get thinner
	setPenColor(1/i, 1/i, chgcolor) //color white -> blue
	drawLine(left, top, 1, endpt) 	//lines top -> bottom
	i++; 				//iterate i value to continue loop
	chgcolor -= .05; 		//increases intensity of blue
	chgweight -= .01; 		//decreases pen weight
	endpt += .1; 			//moves endpoint down y axis
}
	
/* the next 4 statements reset variables so they
may be used in the next loop */	
i = 1; 	
chgcolor = 1;
chgweight = .07;
endpt = 0;

/* below loop draws a series of lines that all begin from the 
top right point and end on different points on the x-axis,
while doing so they fade from white to red */

while (i < 15) {				//iterates 15 times
	setPenWeight(chgweight); 		//lines get thinner
	setPenColor (chgcolor, 1/i, 1/i)	//color white -> red
	drawLine(xwidth, top, i-endpt, 1) 	//lines right -> left
	i++; 					//iterate i value to continue loop
	chgcolor -= .05; 			//increases intensity of red
	chgweight -= .01; 			//decreases pen weight
	endpt += 1.1;	 			//moves endpoint back across x axis
}

/* the next 4 statements reset variables so they
may be used in the next loop */	
i = 1; 	
chgcolor = 1;
chgweight = .07;
endpt = 0;

/* below loop draws a series of lines that all begin from the 
bottom right point and end on different points on the y-axis,
while doing so they fade from white to green */

while (i < 15) {				//iterates 15 times
	setPenWeight(chgweight); 		//lines get thinner
	setPenColor (1/i, chgcolor, 1/i) 	//color white -> green
	drawLine(xwidth, yheight, 0, i-endpt) 	//lines bottom -> top
	i++; 					//iterate i value to continue loop
	chgcolor -= .05; 			//increases intensity of green
	chgweight -= .01;			//decreases pen weight
	endpt += 1.1; 				//moves endpoint up along y axis
}

/* the next 4 statements reset variables so they
may be used in the next loop */	
i = 1; 	
chgcolor = 1;
chgweight = .07;
endpt = 0;

/* below loop draws a series of lines that all begin from the 
bottom left point and end on different points on the y-axis,
while doing so they fade from white to yellow */

while (i < 15) {				//iterates 15 times
	setPenWeight(chgweight); 		//lines get thinner
	setPenColor (chgcolor, chgcolor, 1/i) 	//color white -> yellow
	drawLine(left, yheight, endpt, 0) 	//lines left -> right
	i++; 					//iterate i value to continue loop
	chgcolor -= .05; 			//increases intensity of yellow
	chgweight -= .01; 			//decreases pen weight
	endpt += .1; 				//moves endpoint across x axis
}

/* next 4 drawLine calls create a box over the lines.  the colors of the sides
of the box alternate from yellow, to blue, to red, to green */

setPenWeight(.06); 			//sets pen weight to match thickest lines

setPenColor(1, 1, 0); 			//changes pen color to yellow
drawLine(left, top, xwidth, top); 	//draws top side of box

setPenColor(0, 0, 1) 			//changes pen color to blue
drawLine(xwidth, top, xwidth, yheight); //draws right side of box

setPenColor(1, 0, 0) 			//changes pen color to red
drawLine(xwidth, yheight, left, yheight); //draws bottom side of box

setPenColor(0, 1, 0)			//changes pen color to green
drawLine(left, yheight, left, top); 	//draws left side of box

stop(); 				//ends program execution
//
//end of file (Josh Schoenwald, accad 756)
//