xxxxxxxxxx
56
function setup() {
createCanvas(1080, 1080);
noFill();
angleMode(DEGREES);
radius = 400;
n=8
st = 13
frameCount = 2500
c = ['#ff2e63', '#08d9d6', '#eaeaea'];
frameRate(60);
}
function draw() {
background('#252a40');
translate(width/2, height/2);
noFill();
for(i=0; i<5; i++) {
strokeWeight(2);
stroke(150, 60);
polygon(0, 0, radius/pow(2, i), 7-i);
for(j=0; j<n ; j++) {
rotate(360/n+frameCount/n);
push();
translate(0, radius/pow(2, i));
rotate(frameCount);
stroke(c[i%3]);
strokeWeight(1);
polygon(0, 0, radius/pow(2, i+3), 7-i);
strokeWeight(st-3*i);
ellipse(0, 0, radius/pow(2, i+1));
pop();
}
}
resetMatrix();
fill(220);
textFont('Nunito', 30);
text('@URBANOXYGEN_', width-280, height-20);
}
function polygon(x, y, radius, npoints) {
rotate(-30);
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);
rotate(30);
}