xxxxxxxxxx
39
let tilesX = 20;
let tilesY = 20;
let tilesZ = 20;
let mag;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
}
function draw() {
let mag = mouseX;
background(185, 185, 185);
fill(255, 255, 0);
noStroke();
push();
rotateX(radians(frameCount));
rotateY(radians(frameCount));
rotateZ(radians(frameCount));
for (let x = 0; x < tilesX; x++) {
for (let y = 0; y < tilesY; y++) {
for (let z = 0; z < tilesZ; z++) {
let posX = map(x, 0, tilesX, -mag, mag);
let posY = map(y, 0, tilesY, -mag, mag);
let posZ = map(z, 0, tilesZ, -mag, mag);
push();
translate(posX, posY, posZ);
sphere(8);
pop();
}
}
}
pop();
}