xxxxxxxxxx
46
let outerY;
let angleZ = 0;
let angleY = 0;
let boxes = [];
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
angleMode(DEGREES);
background(50);
outerY = width * 0.5;
frameRate(3);
}
function draw() {
// background(0,200)
fill(255, 0);
push();
translate(random(-20, 20), random(-20, 20));
rotateZ(angleZ);
rotateY(angleY);
if (random() > 0.99) {
fill(255, 0, 0, 50);
strokeWeight(0.5);
stroke(255, 255, 255, 100);
box(10, outerY, 20);
} else {
fill(255, 255, 255, random(2, 10));
strokeWeight(1);
stroke(255, 255, 255, 50);
box(random(10, 50), outerY, random(5, 30));
}
angleZ += random(20, 80);
angleY += 100;
outerY += random(-50, 50);
pop();
noStroke();
fill(0, 0, 0, 3);
rect(0 - width / 2, 0 - height / 2, width, height);
}