topical media & game development

talk show tell print

mobile-query-three-plugins-objectcoord-examples-index.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle.js"></script>
  <script src="../tquery.object3d.coordinate.js"></script>
  <body><script>
          var world        = tQuery.createWorld().boilerplate().start();
          
          // create the object to which we will attach the dom element
          var object	= tQuery.createTorusKnot().addTo(world)
                  .positionX(1)
                  .positionY(0.5)
                  
          // Create dom element
          var element        = document.createElement('div')
          document.body.appendChild(element)
          element.innerHTML        = 'John';        
          element.style.position        = 'absolute'
          // move it at the object position
          world.loop().hook(function(){
                  var position        = object.cssPosition();
                  element.style.left        = (position.x-element.offsetWidth /2)+'px';
                  element.style.top        = (position.y-element.offsetHeight/2)+'px';
          })
  </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.