let n
let a = 200
let ty = 1
let k
function setup(){
cnv = createCanvas(500,500)
background(255)
angleMode(DEGREES)
n = int(random(20,50))*2+1
k = int(random(2,5))*2
noFill()
}
function draw(){
background(255,255,255,20)
translate(width/2,height/2);
if(k===1){
t = frameCount/5;
}else if(ty===1){
t = frameCount/40;
}
for(let i = 0;i<n;i++){
if(ty===0){
x = (a*cos(t+360/n*i))/(1+sin(t+360/n*i)*sin(t+360/n*i));
y = (a*sin(t+360/n*i)*cos(t+360/n*i))/(1+sin(t+360/n*i)*sin(t+360/n*i));
}
if(ty===1){
x = a*cos(k*(t+360/n*i))*cos(t+360/n*i)
y = a*cos(k*(t+360/n*i))*sin(t+360/n*i)
}
circle(x,y,4+10*abs(cos(360/n*i)))
if(t%20===int(random(0,5))){
push()
noStroke()
circle(x,y,random(100))
background(random(200))
frameCount = frameCount+ int(random(-50,50))
pop()
}
}
}
function mousePressed(){
setup()
draw()
}