threex
Version:
Game Extensions for three.js http://www.threejsgames.com/extensions/
34 lines (30 loc) • 803 B
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>
<script src="../src/THREEx.Loop.js"></script>
<script src="../src/THREEx.Context.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>