let L=[]
let s=2;
let d=0.05
function setup(){
createCanvas(windowWidth,windowHeight);
for(let i=0;i<20;i++){
L[i]=0;
}
noStroke()
fill(0)
}
function draw(){
L[0]=L[0]+d
translate(width/2,height/2+10);
scale(1,0.9)
fountain()
push()
scale(1,-1)
fountain()
pop()
if(-height/2+L[0]*L[0]+10>height*5){
background(255,255,255,50);
fill(0,-2+s*5,-2+s*10)
for(let i=0;i<20;i++){
L[i]=0;
}
if(s<20){
s++
}else{s=2}
}
}
function fountain(){
h=-height/2+L[0]*L[0]+10
circle(L[0]*s,h,1);
circle(-L[0]*s,h,1);
for(let i=0;i<20;i++)
if(h>-height/2+height/20*i){
L[i]=L[i]+d
push()
translate(sqrt(height/2*i),0)
circle(L[i]*s,-height/2+height/20*i+L[i]*L[i],1);
circle(-L[i]*s,-height/2+height/20*i+L[i]*L[i],1);
pop()
push()
translate(-sqrt(height/2*i),0)
circle(L[i]*s,-height/2+height/20*i+L[i]*L[i],1);
circle(-L[i]*s,-height/2+height/20*i+L[i]*L[i],1);
pop()
}
}