let a = 200;
let n = 1;
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
angleMode(DEGREES);
background(0);
colorMode(HSB);
noStroke();
}
function draw() {
translate(width / 2, height / 2);
t = width * 8 * sin(frameCount / 7) * sin(frameCount / 10);
for (let i = 0; i < n; i++) {
push();
rotate(frameCount);
stroke(255 * sin(t));
astroid();
pop();
}
}
function astroid() {
g = 1;
beginShape();
for (let i = 0; i <= 360; i = i + 0.2) {
a = t / 10 - 20;
x = a * pow(cos(i), 3);
y = a * pow(sin(i), 3);
z = 0;
noFill();
vertex(x, y);
}
endShape();
}