let a =4.2,
b = 1.96,
c = 1.6,
k = 64,
m = 6,
counter = 20;//constants
function setup() {
createCanvas(600, 600);
}
function draw() {
translate(width/2,width/2);//orgin in center
t = frameCount/1000
fill(100*sin(frameCount),200*sin(frameCount),180*sin(frameCount))
background(100,140,180,5);
theta = (t);
for (let i=0;i<counter;i++){
r = a + b*cos(k*(theta+i))+ c*cos(m*(theta +i));
x = 20*r*cos(theta+i)
y = 20*r*sin(theta+i)
if(i>0){
stroke(0.1)
line(x,y,x1,y1);
}
x1=x;
y1=y;
}
}
function mousePressed(){
background(random(120,140),random(120,240),random(120,240),150)
a =random(2,10);
b = random(0.1,3);
c = random(0.1,5);
k = random(5,80);
m = int(random(1,20))
}