topical media & game development

talk show tell print

mobile-query-three-plugins-requirejs-examples-manual-namealias.htm / htm



  <!doctype html>
  <script src="../vendor/require.js"></script>
  <script>
          requirejs.config({
                  paths        : {
                          "build"                : "../../../build",
                          "plugins"        : "../..",
                          'threex'        : '../../../vendor/threex'
                  },
                  map        : {
                          "*"        : {
                                  'tquery'                : 'build/tquery-bundle',
                                  'tquery.keyboard'        : 'plugins/keyboard/tquery.keyboard',
                          }
                  },
                  shim        : {
                          'plugins/keyboard/tquery.keyboard'        : [
                                  'tquery',
                                  'threex/THREEx.KeyboardState',
                          ]
                  }
          });
  
          require([
                  'tquery.keyboard',
          ], function(){
                  var world        = tQuery.createWorld().boilerplate().start();
                  var object3d        = tQuery.createTorus().addTo(world);
  
                  world.loop().hook(function(){
                          if( tQuery.keyboard().pressed('a') ){
                                  object3d.scale(2);
                          }else{
                                  object3d.scale(1);
                          }
                  })
          });
  </script>
  


(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.