xxxxxxxxxx
26
function setup() {
createCanvas(500, 500, WEBGL);
}
function draw() {
background(220);
for(let count = -5; count < 5; count = count + 1) {
makeBox(count*50, 0);
}
for(let count = -5; count < 5; count = count + 1) {
makeBox(count*50, 100);//(y is fixed)
}
}
function makeBox(x, y) {
push();
translate(x, y, 0);
// converting 2d coordinates to 3d
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
box(50);
pop();
}