Created
June 4, 2015 10:47
-
-
Save OmarShehata/d47a92ba5cd2bb0e58ca to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r71/three.min.js"></script> | |
<style> | |
/* We want our scene to span the entire window */ | |
body { margin: 0; } | |
</style> | |
</heda> | |
<body> | |
<script> | |
//@author Omar Shehata. 2015. | |
//We are loading the Three.js library from the cdn here: http://cdnjs.com/libraries/three.js/ | |
var scene; | |
var camera; | |
var renderer; | |
function scene_setup(){ | |
//This is all code needed to set up a basic ThreeJS scene | |
//First we initialize the scene and our camera | |
scene = new THREE.Scene(); | |
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); | |
//We create the WebGL renderer and add it to the document | |
renderer = new THREE.WebGLRenderer(); | |
renderer.setSize( window.innerWidth, window.innerHeight ); | |
document.body.appendChild( renderer.domElement ); | |
} | |
scene_setup(); | |
//Add your code here! | |
//Render everything! | |
function render() { | |
requestAnimationFrame( render ); | |
renderer.render( scene, camera ); | |
} | |
render(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment