let a =0.1,b=0.2,k=1;
function setup() {
createCanvas(600, 600);
angleMode(DEGREES)
fill(0,50,70,10);
strokeWeight(1)
stroke(255)
background(0)
}
function draw() {
translate(width/2,width/2);
background(0,0,0,10);
ts = frameCount/4
n=int(12*sin(frameCount/10)*sin(frameCount/10))+1
pCurve(0,0,10,n);
pCurve(width/4,width/4,5,n);
pCurve(-width/4,-width/4,5,n);
pCurve(-width/4-width/8,-width/4-width/8,2.5,n);
pCurve(width/4+width/8,+width/4+width/8,2.5,n);
}
function dEll(a,b,k,r){
beginShape();
for(let t=0;t<360;t++){
x=(a+b*k/(sqrt(a*a*sin(t)*sin(t)+b*b*cos(t)*cos(t))))*cos(t);
y=(b+a*k/(sqrt(a*a*sin(t)*sin(t)+b*b*cos(t)*cos(t))))*sin(t);
vertex(r*x,r*y);
}
endShape(CLOSE);
}
function pCurve(x,y,r,n){
push()
translate(x,y)
rotate(ts/2+ts/30)
for(let i=0;i<n;i++){
dEll(a+2*i*cos(ts),b+2*i*sin(ts),k,r)
}
pop()
}