xxxxxxxxxx
let gridZ =10;
function setup() {
//Creates the application window params: width=600, height=600
createCanvas(600, 600);
noLoop();
}
function draw() {
//Background color
background(225);
// Grid
for (let b = 0; b < 100; b++) {
for (let c = 0; c < 100; c++) {
let x = b * gridZ;
let y = c * gridZ;
//Changing the color of the squares
fill(random(225), random(225), random(225));
square(x, y, gridZ);
stroke(0)
strokeWeight(2);
}
}
}
//When the mouse is pressed the squares change colors
function mousePressed() {
redraw()
}