xxxxxxxxxx
29
let x = 0;
let y = 0;
let spacing = 15;
function setup() {
createCanvas(600, 400);
background(0);
}
function draw() {
stroke(255);
if (random(1) < 0.6) {
rect(x, y, spacing, spacing);
// line(x, y, x + spacing, y + spacing);
} else {
// line(x + spacing, y, x, y + spacing);
}
x += spacing;
if (x >= width) {
x = 0;
y += spacing;
}
if (y >= height) {
noLoop();
}
}