xxxxxxxxxx
22
function setup() {
createCanvas(200, 200);
// noLoop();
stroke(255, 0, 0);
}
function draw() {
background(255);
// let spacing = int(map(mouseX, 0, width, 1, 20));
let spacing = 1;
// let spacing = 5;
for (let x = 0; x < width; x+=spacing) {
for (let y = 0; y < height; y+=spacing) {
if ((x+y) % 2 === 0) {
stroke(255, 0, 0);
} else {
stroke(0, 0, 255);
}
point(x, y);
}
}
}