xxxxxxxxxx
let f = 0;
const W = 400;
function setup() {
createCanvas(W, W, WEBGL);
noStroke();
}
function draw() {
pointLight([W], 0, W * 9, 0);
pointLight([W], 0, W * -2, 0);
rotateX(1);
for (x = -W; x < W; x += 99) {
for (y = -W; y < W; y += 99) {
push();
let Y = y + f % 99;
translate(x, Y, 0);
fill(W + Y);
torus(50, 35, 4, 42);
translate(0, 0, 99);
torus(50, 2, 4, 16);
translate(0, 0, 44);
torus(sin(f / 9), 9, 16);
pop();
}
}
box(1000);
f++;
}
// ----------------------------------------
// Version before compression
// ----------------------------------------
// f=0
// draw=_=>{
// f++||createCanvas(W=400,W,WEBGL,R=torus)
// L(9)
// L(-2)
// noStroke(); // Remove before compression
// rotateX(1)
// for(x=-W;x<W;x+=99){
// for(y=-W;y<W;y+=99){
// push(T=translate)
// T(x,Y=y+f%99)
// fill(W+Y)
// R(50,35,4,W)
// T(0,0,99)
// R(50,2,4,W)
// T(0,0,44)
// pop(R(sin(f/9),9,W))
// }
// }
// box(1000)
// }
// L=i=>pointLight([W],0,W*i,0)
// ----------------------------------------
// Minimized 282
// ----------------------------------------
// f=0,draw=t=>{for(f++||createCanvas(W=400,W,WEBGL,R=torus),L(9),L(-2),rotateX(1),x=-W;x<W;x+=99)for(y=-W;y<W;y+=99)push(T=translate),T(x,Y=y+f%99),fill(W+Y),R(50,35,4,W),T(0,0,99),R(50,2,4,W),T(0,0,44),pop(R(sin(f/9),9,W));box(1e3)},L=t=>pointLight([W],0,W*t,0);//#つぶやきProcessing