Created
June 2, 2013 16:10
-
-
Save Akiyah/5693968 to your computer and use it in GitHub Desktop.
2013-06-02 1st
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
margin: 0; | |
padding: 0; | |
border: 0; | |
} | |
body { | |
background: #dff; | |
font: 30px sans-serif; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://raw.github.com/schteppe/cannon.js/master/build/cannon.min.js"></script> | |
<p id='helloWorld'></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var camera, controls, scene, renderer; | |
function init() { | |
var container = document.getElementById( 'container' ); | |
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 ); | |
camera.position.z = 500; | |
console.log(THREE.Scene); | |
console.log(THREE.TrackballControls); | |
controls = new THREE.TrackballControls( camera ); | |
controls.addEventListener( 'change', render ); | |
scene = new THREE.Scene(); | |
var geometry = new THREE.SphereGeometry( 100 ); | |
var material = new THREE.MeshNormalMaterial() | |
var mesh = new THREE.Mesh( geometry, material ); | |
scene.add( mesh ); | |
renderer = new THREE.CanvasRenderer(); | |
renderer.setSize( window.innerWidth, window.innerHeight ); | |
container.appendChild( renderer.domElement ); | |
} | |
function animate() { | |
requestAnimationFrame( animate ); | |
controls.update(); | |
} | |
function render() { | |
renderer.render( scene, camera ); | |
} | |
init(); | |
animate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment