UNPKG

threex

Version:

Game Extensions for three.js http://www.threejsgames.com/extensions/

20 lines (18 loc) 697 B
<!DOCTYPE html> <script src="../../../vendor/three.js/build/three.min.js"></script> <!-- include code of threex.boilerplate --> <script src="../../threex.context/threex.context.js"></script> <script src="../../threex.loop/threex.loop.js"></script> <script src="../../threex.resize/threex.resize.js"></script> <!-- main function --> <script> var ctx = new THREEx.Context().boilerplate().start() var geometry = new THREE.CubeGeometry( 1, 1, 1); var material = new THREE.MeshNormalMaterial(); var mesh = new THREE.Mesh( geometry, material ); ctx.add( mesh ); ctx.hook(function(delta, now){ mesh.rotation.x += 0.1 * delta*Math.PI*2; mesh.rotation.y += 0.2 * delta*Math.PI*2; }) </script>