const palette = ["#E23544", "#A92084", "#EFA732", "#69963E", "#17A2B2"];
createCanvas(windowWidth, windowHeight, WEBGL);
sizeMax = max(width, height) * 0.5;
for (let i = 0; i < shapesNum; i++) {
shapes.push(new Shape());
for (let i = 0; i < shapes.length; i++) {
this.rMax = random(sizeMax * 0.1,sizeMax);
this.rStep = random(0.5, 3);
this.tStep = random(0.5, 1.0);
this.tSign = random(1) >= 0.5 ? 1 : -1;
this.wMax = random(10, 150);
this.rot = createVector(random(-360, 360), random(-360, 360), random(-360, 360));
this.rotRange = this.r * 0.01 + 0.01;
this.rotStep = createVector(random(-this.rotRange, this.rotRange), random(-this.rotRange, this.rotRange), random(-this.rotRange, this.rotRange));
this.wStep = random(1, 3);
this.cStep = random(0.5, 5.5);
this.c = color(palette[0]);
this.cA = color(random(palette));
this.cB = color("#141414");
this.rotY = random(-360, 360);
this.rotYStep = random(0.5, 1.5);
this.rotYSign = random(1) >= 0.5 ? -1 : 1;
this.r = this.rMax * sin(this.rt);
this.x = this.r * cos(this.t);
this.y = this.r * sin(this.t);
this.w = this.wMax * sin(this.wt);
this.c = lerpColor(this.cA, this.cB, sin(this.ct));
this.t += this.tSign * this.tStep;
this.rot.add(this.rotStep);
this.rotY += this.rotYSign * this.rotYStep;
translate(this.x, this.y, this.z);