xxxxxxxxxx
var amountt = 50;
var BOX = [];
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
randomizee();
}
function draw() {
background(100);
fill(255, 255, 255, 50);
for(let i=0; i<BOX.length; i++)
{
push();
translate(BOX[i].x, BOX[i].y, BOX[i].z);
rotateX(BOX[i].rx);
rotateY(BOX[i].ry);
rotateZ(BOX[i].rz);
box(50);
BOX[i].rx+=0.01;
BOX[i].ry+=0.01;
BOX[i].rz+=0.01;
pop();
}
}
function keyPressed()
{
randomizee();
}
function randomizee() {
BOX = [];
for(let i=0; i<amountt; i++)
{
let b = {};
b.x = random(-width/2, width/2);
b.y = random(-height/2, height/2);
b.z = random(-height/2, height/2);
b.rx = random(100);
b.ry = random(100);
b.rz = random(100);
BOX.push(b);
}
}