function setup() {
createCanvas(600, 600);
background(255);
}
function draw() {
noStroke();
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(50,50,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(450,50,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(250,50,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(50,250,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(250,250,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(450,250,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(50,450,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(250,450,100,100);
fill(r = random(0,255), g = random (0,255), b = random (0,255));
rect(450,450,100,100);
noLoop();
}
function mousePressed() {
loop();
}
function mouseReleased() {
noLoop();
}
this is more abstract than I want it to be, but it took me like 5 hours to figure out how to do this. I was trying to use variables, but I couldn’t get them to work, so I made this instead.