topical media & game development
mobile-query-three-plugins-requirejs-examples-index-manual.htm / htm
<!doctype html>
<script src="../../../build/tquery-bundle.js"></script>
<script src="../vendor/require.js"></script>
<script src="../head.confrequire.js"></script>
<script src="../confrequire/keyboard.confrequire.js"></script>
<script src="../confrequire/planets.confrequire.js"></script>
<script src="../confrequire/lavamaterial.confrequire.js"></script>
<script src="../confrequire/materials.confrequire.js"></script>
<script src="../confrequire/physics.confrequire.js"></script>
<script src="../confrequire/pproc.confrequire.js"></script>
<script src="../confrequire/shape.confrequire.js"></script>
<body><script>
require([
'tquery.createplanet','tquery.keyboard',
'tquery.lavamaterial', 'tquery.materials',
'tquery.physics', 'tquery.pproc',
'tquery.shape'
], function(){
var world = tQuery.createWorld().boilerplate().start();
var planet = tQuery.createPlanet().addTo(world);
//var planet = tQuery.createSphere().addTo(world);
var smiley = tQuery.createSmiley().addTo(world).translateX(1)
//smiley.useLavaMaterial();
//world.addEffectComposer().sepia().film(0.25, 0.25, 648, false).vignette().finish();
// setup light
tQuery.createDirectionalLight().addTo(world).position(1,1,1);
tQuery.createDirectionalLight().addTo(world).position(-1,1,1);
tQuery.createAmbientLight().addTo(world).color(0xFFFFFF);
// make the object rotate
world.loop().hook(function(delta, now){
var angle = 0.05 * now * Math.PI * 2;
planet.get(0).rotation.y = angle;
var curScale = planet.get(0).scale.x;
var dstScale = tQuery.keyboard().pressed('a') ? 2 : 1;
smiley.scale( curScale + (dstScale-curScale)*0.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.