xxxxxxxxxx
// ----------------------------------------
// Uncompressed code
// ----------------------------------------
let f = 0; // Frame counter
setup =_=> {
createCanvas(400, 400, WEBGL);
noStroke();
}
draw = _ => {
[120,-120,-120].map(i=>pointLight([255],0,i*9,0)); // Koma's 3 Point lights setup :-)
rotateX(12); // "Camera" angle
let n=0; // Rings counter
for(i=0;i<TAU;i+=PI/16){
// Ringz
push();
rotateY(i);
translate(120,0);
torus(cos(i*4+f)*20+20,2);
pop();
// Spherez
push();
rotateY(i-f/4);
translate(120,0);
if(n%8==0) sphere(25); // One sphere per eight rings (4 spheres)
pop();
n++;
}
sphere(400); // Backdrop
f+=0.05;
}
// ----------------------------------------
// Pre Compressed Code
// ----------------------------------------
// f = 0;
// draw = _ => {
// f || createCanvas(W = 400, W, WEBGL, S=sphere)
// ;[h=120,-h,-h].map(i=>pointLight([W],0,i*9,n=0))
// rotateX(12)
// for(i=0;i<TAU;i+=PI/16){
// Q(0)
// pop(torus(cos(i*4+f)*20+20,2,h))
// Q(f/4)
// pop(n++%8==0&&S(25,h))
// }
// S(W,h)
// f+=.05
// }
// Q=q=>{
// push()
// rotateY(i-q)
// translate(h,0)
// }
// ----------------------------------------
// Minimized 282
// ----------------------------------------
// f=0,draw=t=>{for(f||createCanvas(W=400,W,WEBGL,S=sphere),[h=120,-h,-h].map(h=>pointLight([W],0,9*h,n=0)),rotateX(12),i=0;i<TAU;i+=PI/16)Q(0),pop(torus(20*cos(4*i+f)+20,2,h)),Q(f/4),pop(n++%8==0&&S(25,h));S(W,h),f+=.05},Q=t=>{push(),rotateY(i-t),translate(h,0)};//#つぶやきProcessing