topical media & game development

talk show tell print

mobile-query-three-plugins-whammy-examples-manual.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle-require.js"></script>
  <script src="../tmp/whammy.js"></script>
  <body><div id="info">
          Example with whammy.js<br/>
          press d to download
          <a href="javascript:void(0)" class='download' style='display: none'>Download</a>
  </div><script>
  require([], function(){
          var world        = tQuery.createWorld().boilerplate().pageTitle('#info').start();
          var object	= tQuery.createTorus().addTo(world);        
          
          var encoder        = new Whammy.Video(15);
  
          world.loop().hook(function(){
                  var canvas        = world.tRenderer().domElement;
                  encoder.add(canvas);
          });
          
          document.body.addEventListener('keypress', function(event){
                  console.log('keypress', event)
                  console.dir(event)
                  if( event.keyCode === "q".charCodeAt(0) ){
                          var output        = encoder.compile();
                          var url                = (window.webkitURL || window.URL).createObjectURL(output);
                          var element        = document.querySelector('#info .download');
                          element.href        = url;
                          element.style.display        = 'inline'
                          console.log('element', element, url)
                          console.dir(element)
                  }
          })
  });
  </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.