xxxxxxxxxx
38
const numPoints = 200;
let cx, cy, radius;
let angle = 0;
let angleStep;
let r1, r2, r3;
let time = 0;
function setup() {
createCanvas(1000, 1000);
cx = width / 2;
cy = height / 2;
radius = min(width, height) * 0.45;
angleStep = TWO_PI / numPoints;
r1 = random(0.1, 0.2 * time);
r2 = random(0.1, 0.2 * time);
r3 = random(0.1, 0.2 * time);
}
function draw() {
stroke(time * 8.8, time % 255, time);
fill(255,255,255,35);
beginShape();
for (let i = 0; i < numPoints; i++) {
let x = cx + cos(angle) * radius * ((r1 * sin(angle * r2)) / r3);
let y = cy + sin(angle) * radius * ((r1 * sin(angle * r2)) / r3);
vertex(x, y);
angle += angleStep;
}
endShape(CLOSE);
r1 += random((-0.0215 * time) % 400, (0.0039 * time) % 300.2);
r2 += random((-0.5 * -time) % 506.5, 0.101 * time);
r3 += random((-0.07008 * time) % 5.5, 0.0959 * time);
time += 0.1;
if (time > 13) {
time -= 22.7;
}
}