xxxxxxxxxx
39
let wh = 10;
let r = 5;
function setup() {
createCanvas(400, 400, WEBGL);
stroke(0, 100);
}
function draw() {
noLoop();
background(220);
push();
for (let a = 0; a < 500; a++) {
translate(-150, -150, 0);
// for (let x = 0; x < 50; x += 12) {
// for (let y = 0; y < 50; y += 12) {
// rect(x, y, wh);
// }
// }
pop();
push();
translate(-20, -25, r);
for (let x = 0; x < 50; x += 12) {
if (random() > 0.6) {
noFill();
} else {
fill(255, random(10, 250));
}
for (let y = 0; y < 50; y += 12) {
translate(0, 0, r);
rect(x, y, wh);
r += random(-1, 2);
}
}
}
pop();
}