xxxxxxxxxx
var n,s0,s,s_coef,a, twists;
function setup() {
createCanvas(600, 600);
a = 255;
s0 = width*.50 ;
s = s0;
n = 250;
s_coef = 1.0;
twists = 3.65;
var mainColor = color(233,86,35);
background(mainColor);
smooth(8);
}
function draw() {
if (frameCount >= n) {
noLoop();
//save("vertigoII.png");
}
translate(width/2, height / 2);
noFill();
strokeWeight(2);
stroke(255, 255, 255, a);
ellipse(0, 0, s, s );
s+=s_coef;
a-=.8;
//draw
if(frameCount==1) {
//inner circle
noStroke();
fill(33, 52, 52, 255);
ellipse(0, 0, s0*.63, s0*.63);
}
//the spiral
fill(77, 166, 158);
stroke(77, 166, 158);
strokeWeight(.5);
beginShape(TRIANGLE_STRIP);
for (var i=frameCount; i<=frameCount+1 && i < n; i++) {
let angle = HALF_PI + i/n * twists * TWO_PI;
let r1 = 10 + angle*2.5 ;
let r2 = 15 + angle*2.55;
r1 *= 1.02 + 0.03 * (1. - 2 * noise(angle*10));
r2 *= 1.03 + 0.03 * (1. - 2 * noise(angle*5 + 34389));
vertex(r1 * cos(angle), r1 * sin(angle));
vertex(r2 * cos(angle), r2 * sin(angle));
}
endShape();
//small circle
fill(255,pow(a,2));noStroke();
ellipse(height/9, -height/9, (s0-s)*.2 , (s0-s)*.2);
}