xxxxxxxxxx
28
function setup() {
createCanvas(400, 400, WEBGL);
ortho();
}
function draw() {
background(220);
lights();
fill(255);
stroke(0);
let count = 1;
let h = 10 * 25;
for (let i = 0; i < 10; i++) {
for (let j = 0; j < count; j++) {
push();
let w = (count * 25) / 2;
let x = map(j, 0, count, -w, w) + 25/2;
translate(x, -h / 2 + i * 25);
rotateX(-PI / 4);
rotateY(-PI / 4);
box(15);
pop();
}
count++;
}
}