(function(){ var Data = require("./setup"); var camera = Data.Camera; var renderer = Data.Renderer; var scene = Data.Scene; var mouse = Data.Mouse; var onRender = Data.onRender; var ambientLight= new THREE.AmbientLight( 0x020202 ) scene.add( ambientLight) var frontLight = new THREE.DirectionalLight('white', 1) frontLight.position.set(0.5, 0.5, 2) scene.add( frontLight ) var backLight = new THREE.DirectionalLight('white', 0.75) backLight.position.set(-0.5, -0.5, -2) scene.add( backLight ) onRender.push(function(delta, now){ camera.position.x += (mouse.x*5 - camera.position.x) * (delta*3) camera.position.y += (mouse.y*5 - camera.position.y) * (delta*3) camera.lookAt( scene.position ) }) var geometry = new THREE.CubeGeometry( 1, 1, 1); var material = new THREE.MeshPhongMaterial(); var mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); onRender.push(function(delta, now){ mesh.rotateX(0.5 * delta); mesh.rotateY(2.0 * delta); }) onRender.push(function(){ renderer.render( scene, camera ); }) })();