UNPKG

threex

Version:

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

37 lines (31 loc) 861 B
<!DOCTYPE html> <html lang="en"> <head> <title>three.js webgl - geometry - cube</title> <meta charset="utf-8"> <style> body { margin: 0px; background-color: #000000; overflow: hidden; } </style> </head> <body> <script src="../vendor/three.js/build/three.min.js"></script> <!-- get threex.context and its dependancies --> <script src="../src/THREEx.Context.js"></script> <script src="../src/THREEx.Loop.js"></script> <script> var ctx = new THREEx.Context().start() var geometry = new THREE.CubeGeometry( 1, 1, 1); var material = new THREE.MeshNormalMaterial(); var mesh = new THREE.Mesh( geometry, material ); ctx.scene.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> </body> </html>