let c;
let sp = [];
let sp2 = [];
let n;
let cnt;
let nf,nf2;
let a=9,b=0.1;
let dv = 20;
function setup(){
nf=random(0.000005,0.05)
nf2=random(0.5,6);
c=1000
cnv=createCanvas(c,c);
stroke(255);
noFill();
spiralP(0,50,a,b);
r1=random(0,20);
g1=random(0,90);
b1=random(0,90);
background(255-b1/1.5,255-g1/2,255-r1/2);
dv=random(100,width/3)
}
function draw(){
translate(c/2,c/2);
rotate(r1)
ra=width/3*abs(cos(frameCount/1000))+50
strokeWeight(0.5)
for(let p=0;p<sp.length;p++){
let n=noise(sp[p].x*nf,sp.[p].y*nf)*TWO_PI
sp[p].add(cos(n*nf2),sin(n*nf2))
px=constrain(sp[p].x,dv*sin(p-TWO_PI) ,dv*sin(p) );
py=constrain(sp[p].y,dv*cos(p-PI) ,dv*cos(p) );
stroke(r1,g1,b1);
strokeWeight(dist(px,py,0,0)/500+0.01)
point(px,py)
strokeWeight(dist(sp[p].x,sp[p].y,0,0)/500+0.01)
point(sp[p].x,sp[p].y)
}
if (frameCount===150){
noLoop()
}
}
function spiralP(startT,stopT,a,b){
beginShape()
cnt = 0;
for(let i=stopT;i>startT;i-=0.003){
r=a*exp(b*i);
x = r*cos(i)
y = r*sin(i);
sp[cnt]=createVector(x,y);
sp2[cnt]=createVector(x,y);
cnt++;
}
for(let i=startT;i<stopT;i+=0.005){
r=a*exp(b*i);
x = r*cos(i-PI)
y = r*sin(i-PI);
sp[cnt]=createVector(x,y);
sp2[cnt]=createVector(x,y);
cnt++;
}
endShape()
}
function mousePressed(){
sp = [];
sp2 = [];
setup();
draw();
cnt=0;
frameCount=0
loop();
}