xxxxxxxxxx
var boolDoRefresh;
function setup() {
createCanvas(400, 400);
boolDoRefresh = true;
}
function draw() {
if (boolDoRefresh) {
let gridSize = 35;
for (let x = gridSize; x <= width - gridSize; x += gridSize) {
for (let y = gridSize; y <= height - gridSize; y += gridSize) {
noStroke();
let randomint = random(40);
if(randomint <= 1) {
fill('red');
circle(x + 4, y + 4, 10);
}
else {
fill(0);
square(x - 1, y - 1, 10);
}
stroke(255, 50);
}
}
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
clear();
}