text: function map(o,t,e,n,i){return n+(o-t)*(i-n)/(e-t)}const _v3=new VALO.Vector3;function toBall(o){o.position.add(_v3.copy(o.position).multiply(.01)),o.position.mag()>20&&o.position.normalize().multiply(20)}function toInit(o){o.position.add(_v3.copy(o.initialPosition).subtract(o.position).multiply(.02))}function createScene(){const o=new VALO.WebGLRenderer({clearBeforeRender:!0,antialiazing:!0,inspector:!1,pixelRatio:2});o.attachTo("scene-div");const t=new VALO.Scene,e=new VALO.TargetCamera(t);e.target=new VALO.Vector3(0,0,0),e.translateZ(-50),e.rotateY(Math.PI),e.setActive();const n=2.5,i=new VALO.Vector3(0,0,0),a=new VALO.BoxGeometry({width:n,height:n,depth:n}),p=new VALO.Color(.5,.5,.2),r=new VALO.Mesh(a,p),c=[];for(let o=0;o<8;o++)for(let e=0;e<8;e++)for(let a=0;a<8;a++)if(0==o||0==e||0==a||7==o||7==e||7==a){const p=map(e,0,7,0,1),s=map(o,0,7,0,1),l=map(a,0,7,0,1),V=new VALO.Color(p,s,l),d=r.clone();d.position.x=e*n+1.25-10,d.position.y=o*n+1.25-10,d.position.z=a*n+1.25-10,d.position.add(i);const A=i.clone().add(d.position).mag();d.applyScale(map(A,10,15,.4,1)),d.material=V,d.initialPosition=(new VALO.Vector3).copy(d.position),t.add(d),c.push(d)}const s=new VALO.Vector3(0,1,0),l=new VALO.Vector3(0,1,0);let V=0;return o.runRenderLoop((()=>{o.render(t),V++,e.position.applyAxisAngle(s,.01),e.position.applyAxisAngle(l,.01),e.update(),Math.sin(V/30)>0?c.forEach(toBall):c.forEach(toInit)})),o}