topical media & game development

talk show tell print

mobile-query-three-plugins-poolball-examples-demo.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle-require.js"></script>
  <body><script>
  require(['tquery.poolball'], function(){
          var world        = tQuery.createWorld().boilerplate().start();
  
          // put some lights        
          tQuery.createAmbientLight().addTo(world)
                  .color(0x444444)
          tQuery.createDirectionalLight().addTo(world)
                  .position(1,1,1)
                  .color(0xff4444)
          
          world.removeCameraControls();
          
          var ballsDesc        = ['cue', 'black', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
          for(var i = 0; i < 10; i++){
                  (function(){
                          var object	= tQuery.createPoolBall({
                                  ballDesc        : ballsDesc[Math.floor(Math.random()*ballsDesc.length)],
                                  stripped        : Math.random() > 0.5 ? true : false
                          }).addTo(world).scaleBy(1/2);
                          object.positionX( 2 * (Math.random()-0.5) );
                          object.positionY( 1 * (Math.random()-0.5) );
                          object.positionZ( 1 * (Math.random()-0.5) );
                          object.rotationX( Math.random() * Math.PI*2 );
                          object.rotationY( Math.random() * Math.PI*2 );
                          object.rotationZ( Math.random() * Math.PI*2 );
  
                          world.loop().hook(function(delta, now){
                                  object.rotateY(1*0.02);
                                  object.rotateX(1*0.015);
                                  object.rotateZ(1*0.025);
                          });                
                  })();
          }        
  });
  </script></body> 


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.