float W2, H2, W3, H3, SPEED = 0.04; float PA = 2, PB = 2, PC = 10, PD = 10, PS = PI / 1000; void setup() { size(500, 500); frameRate(30); stroke(255, 192); noFill(); smooth(); W2 = width / 2; H2 = height / 2; W3 = width / 3; H3 = height / 3; } void mouseReleased() { PA = random(2, 5); PB = random(2, 5); PC = random(2, 15); PD = random(2, 15); PS = random(1, 200) * (PI / 10000); } void draw() { float fr = radians(frameCount); background(0, 0, 31); beginShape(); for (float i = 0.0; i < 2 * PI; i += PS) { float u = i + radians(frameCount * SPEED); float x = W3 * (sin(u) + sin(100 * u) / (PA + sin(fr / PC)) * sin(i + fr)); float y = H3 * (cos(u) + cos(100 * u) / (PB + cos(fr / PD)) * cos(i - fr)); curveVertex(W2 + x, H2 + y); }; endShape(); }