fractalkitty looking for math? fractalkitty.com

all

the spectators of chromatic mitosis

#trig#3d#animation

let t=0
function setup(){
  c=0.9*min(windowWidth,windowHeight);
  createCanvas(c,c,WEBGL);
  smooth();
  noStroke()
}
function draw(){
  background(0)
  t+=0.02;
  r=c/20;
  b=105;
  d=c/8+5*sin(t/3);
  specularMaterial(255);
  pointLight(b,0,0,r*sin(t/2),-r*sin(t)*cos(t),d)
  pointLight(0,b,0,-r*sin(t/2),r*sin(t/2),d)
  pointLight(0,0,b,-r*2*sin(t)*cos(t/2)-r*2*sin(t/5),r*sin(t/4)*cos(t),d);
  pointLight(b*sin(t/4),b*sin(t/4),b*cos(t/4),r*2*sin(t/2)*sin(t),r*2*sin(t/4)-r*cos(t/2)*sin(t),d)
  pointLight(b/2,b/2,b/2,r*3*sin(t)*cos(t)*cos(t/4),-r*2*sin(t/4),d);
  box(c*2,c*2,5);
  n=19;
  for(let i=0;i<n;i++){
    push()
  translate(c/4*sin(t/10+TWO_PI/n*i),c/4*cos(t/10+TWO_PI/n*i),c/3)
  sphere(10*sin(t/50),24,24);
  pop()
  }
  
  push()
  translate(0,0,-c/1.9)
  sphere(c/1.6,100,100);
  pop()
}