xxxxxxxxxx
48
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
baseRadius = 600;
iniRadius = baseRadius;
factor = 1;
}
function draw() {
background(220);
translate(width/2, height/2);
noFill();
radius = iniRadius;
while(radius > 2500)
radius = sqrt(2*pow(radius/1.64, 2));
i=0;
while(radius>1) {
i++
//push();
rotate(30*i+frameCount/10);
polygon(0, 0, radius, 6);
radius = sqrt(2*pow(radius/1.64, 2));
//pop();
}
iniRadius *= 1.01;
factor /= 2;
}
function polygon(x, y, radius, npoints) {
angleMode(RADIANS);
let angle = TWO_PI / npoints;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius;
let sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
angleMode(DEGREES);
}