xxxxxxxxxx
let cube = [];
let numberCubes = 737;
let i = 0;
let colBlack = 0;
let colWhite = 255;
let colCounter;
let alphaMax = 50;
function setup() {
createCanvas(800, 600);
background(0);
frameRate(10);
}
function draw() {
if (i < numberCubes) {
cube[i] = new Cubus();
cube[i].show();
i++;
} else {
i = 0;
background(0);
}
}
class Cubus {
constructor() {
translate(width / 2, height / 2);
this.x = random(-(width / 4), width - width / 4);
this.y = random(-(height / 4) - height / 4);
this.l = random(width / 40, width / 2);
this.b = random(height / 40, height / 2);
}
show() {
rectMode(CENTER);
let angle = frameCount * random(-0.5,0.5);
rotate(angle);
colCounter = floor(random(2));
if (colCounter == 0) {
stroke(colWhite, alphaMax);//, floor(random(alphaMax - alphaMax / 4, alphaMax)));
strokeWeight(random(3));
//noStroke();
//fill(colWhite, floor(random(alphaMax - alphaMax / 4, alphaMax)));
noFill();
rect(this.x, this.y, this.l, this.b);
} else {
stroke(colWhite,alphaMax); //,floor(random(alphaMax - alphaMax / 4, alphaMax)));
strokeWeight(random(3));
//noStroke();
//fill(colBlack, floor(random(alphaMax - alphaMax / 4, alphaMax)));
noFill();
rect(this.x, this.y, this.l, this.b);
}
}
}