xxxxxxxxxx
27
function setup() {
createCanvas(400, 400);
background(255,255,100);
}
function draw() {
stroke(0);
DrawGrid(200, 20); // using a function that I wrote myself!
// DrawGrid(100, 10);
}
function DrawGrid(MAX,SPACING) {
// parameters MAX and SPACING allow us to pass values into the function
for (var g = 0; g < MAX; g = g + SPACING) {
strokeWeight(1);
line(g, 0, g, MAX);
line(0, g, MAX, g);
}
// setting up the mid-point lines
strokeWeight(3);
line(0, MAX/2, MAX, MAX/2);
line(MAX/2, 0, MAX/2, MAX);
}