xxxxxxxxxx
1
a=0;s=[];keyPressed=_=>{n=[];for(g of s)for(x=-1;x<2;x++)for(y=-1;y<2;y++)for(z=-1;z<2;z++){m=g.p;u=g.r/3;if(d(x)+d(y)+d(z)>1)n.push(new B(m.x+x*u,m.y+y*u,m.z+z*u,u))}s=n};draw=_=>{createCanvas(w=361,w,WEBGL);a?d=abs:s[0]=new B(0,0,0,99);rotateY(a+=0.01);for(g of s){push();translate(g.p);pop(box(g.r))}};function B(x,y,z,r){this.p=createVector(x,y,z);this.r=r}