let n, s, f1, f2, f3; function setup() { createCanvas(windowWidth, windowHeight); background(20); smooth(); noStroke(); fill(255); n = 600; //number of ellipse per circle m = 10; //magnitude of waves f1 = 2000; //f general f2 = 2; //f of rotation f3 = 5; //f of waves } function draw() { background(242); let t = millis()/f1; fill(255,0,88, 150) paintCircle(t, 0); fill(127, 0, 88, 150) paintCircle(t, PI); } paintCircle = ( t, o) => { for(let i = 0; i < n; i++) { let p = (i/n)*TWO_PI; let x = (width/2) + sin(p+t) * (160+sin((t*f2+p)*f3+o)*m*(1-sin(p))); let y = (height/2) + cos(p+t) * (160+sin((t*f2+p)*f3+o)*m*(1-sin(p))); ellipse(x, y, 5, 5); } }