xxxxxxxxxx
41
let h = 100;
function setup() {
createCanvas(400, 400, WEBGL);
describe('a white box rotating in 3D space');
angleMode(DEGREES);
}
function draw() {
background(200);
rotateX(-45);
rotateY(45);
let c = map(mouseX, 0, width, -100, 100);
let d = map(mouseY, 0, height, -100, 100);
let side = 10;
let num = 10;
for (let i=0; i<num; i++) {
for (let j=0; j<num; j++) {
push();
let t = i*side - (num*side)/2;
let f = j*side - (num*side)/2;
translate(t, 0, f);
box(side, 100, side);
pop();
}
}
// push();
// translate(-20, 50, -10);
// box(10);
// pop();
// push();
// translate(-10, 50, -10);
// box(10);
// pop();
}