//This script makes a bunch of square size pixles
// in a gird that size is determined by the user
//
//fernando orellana

#include "Canvas.as"
 
// sets the background color and pen wieght

Canvas.setBackgroundColor(0.0, 0.0, 0.0);
Canvas.setPenWeight(.05);

// variables that set the width, height and spacing
// of the sqaures 
var space = .07;
var width = .1;
var height = .13;

//variables determined for the points of the square
var ptAx1 = width;
var ptAy1 = width;
var ptAx2 = height;
var ptAy2 = width

var ptBx1 = width;
var ptBy1 = width;
var ptBx2 = width;
var ptBy2 = height;

var ptCx1 = width;
var ptCy1 = height;
var ptCx2 = height;
var ptCy2 = height;

var ptDx1 = height;
var ptDy1 = width;
var ptDx2 = height;
var ptDy2 = height;

// sets the andom color fr each pixel.
var R = Math.random();
var G = Math.random();
var B = Math.random();
			

// outer most loop. Determines the ysize of the gird
for(var y = 0; y <10; y++){ 
	
		// outer most loop. Determines the xsize of the gird
		for(var x = 0; x < 12; x++){ 
			
			R = Math.random() / .4;
			G = Math.random() / .2;
			B = Math.random() / .09;
			
			Canvas.setPenColor(R, G, B);
			Canvas.drawLine(ptAx1, ptAy1, ptAx2, ptAy2);
			Canvas.drawLine(ptBx1, ptBy1, ptBx2, ptBy2);
			Canvas.drawLine(ptCx1, ptCy1, ptCx2, ptCy2);
			Canvas.drawLine(ptDx1, ptDy1, ptDx2, ptDy2);
		
			
			ptAx1 += space
			ptAx2 += space
			ptBx1 += space
			ptBx2 += space
			ptCx1 += space
			ptCx2 += space
			ptDx1 += space
			ptDx2 += space
		
		}
	
		ptAx1 -= (space * x);
		ptAx2 -= (space * x);
		ptBx1 -= (space * x);
		ptBx2 -= (space * x);
		ptCx1 -= (space * x);
		ptCx2 -= (space * x);
		ptDx1 -= (space * x);
		ptDx2 -= (space * x);
	
		ptAy1 += space
		ptAy2 += space
		ptBy1 += space
		ptBy2 += space
		ptCy1 += space
		ptCy2 += space
		ptDy1 += space
		ptDy2 += space
		
}