let phi;
let angle;
let bigR;
let n;
function setup() {
phi = (1 + sqrt(5)) / 2;
angle = (phi * 360) / TWO_PI;
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
noStroke();
bigR = min(width, height);
background(20, 20, 20);
n = 3;
}
function draw() {
background(0, 10, 20, 2 + 3 * cos(frameCount / 10));
translate(width / 2, height / 2);
for (let i = 0; i < n; i++) {
push();
rotate((360 / n) * i + frameCount / 5);
translate((bigR / 4) * cos(frameCount / 3), 0);
drawPhi();
pop();
}
}
function drawPhi() {
for (let i = 0; i < 2000; i += 0.5) {
fill(255 - i / 10, 255 - i / 25, 255 - i / 30, 7);
let r = i / 10;
let theta = angle * i;
circle(r * cos(theta), r * sin(theta), 2);
}
}
function mousePressed() {
push();
translate(mouseX - width / 2, mouseY - height / 2);
drawPhi();
pop();
}