PixAnvil/Three.js demo
JavaScript doesn't seem to be running, so nothing below is going to work.
Setup
Animate
Save
// Make a bunch of spheres var g=new THREE.SphereGeometry(1, 8, 6); var m=new THREE.MeshLambertMaterial( {color: 0xffffff}) sim.nspheres=5; sim.spheres=[]; for (var i=0;i
camera.position.set(0,-10,1.7); // default: assume no "clang!". for (var i=0;i
5.0) { // right wall s.P.x=5; if (s.V.x>2.0) camera.position.set(0.2,-10,1.7); s.V.x=-Math.abs(s.V.x); s.V.multiplyScalar(0.6); // friction! } if (s.P.x<-4.0) { // left wall s.P.x=-4; if (s.V.x<-2.0) camera.position.set(-0.2,-10,1.7); s.V.x=Math.abs(s.V.x); s.V.multiplyScalar(0.6); // friction! } s.position=s.P; // copy to 3D display }
To save, copy into a
plain text
editor like Notepad.
/* Content here coming soon! */ For now, just copy out your Setup and Animate code.