n = 50;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
specularMaterial(0, 200, 250);
angleMode(DEGREES);
camera(0, 0, -1500, 0, 0, 0);
noStroke();
}
function draw() {
background(0);
t = frameCount;
orbitControl();
pointLight(
100 * sin(t / 5) * sin(t / 5) + 10,
205 * sin(t / 5) * sin(t / 5) + 20,
225 * sin(t / 5) * sin(t / 5) + 30,
0,
0,
1000
);
for (let i = 0; i <= n; i++) {
for (let j = 0; j < n; j++) {
push();
if (i > 0) {
translate(j * 20 * sin(5 * i), j * 20 * cos(5 * j + t), j * 40);
}
torus(20, 5, 24, 16);
pop();
}
}
}
function mousePressed() {
if (n < 80) {
n++;
}
}