Last active
March 20, 2018 03:30
-
-
Save RxET/428f941a759434cc5cdfda55485eee16 to your computer and use it in GitHub Desktop.
Three.js or There’s a hypercube in my timeline and I can’t get out
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
function makeScene() { | |
//get browser width and height | |
var WIDTH = window.innerWidth; | |
var HEIGHT = window.innerHeight; | |
// make a scene | |
scene = new THREE.Scene(); | |
// and a camera | |
var aspectRatio = WIDTH / HEIGHT; | |
var fieldOfView = 75; | |
var near = 0.5; | |
var far = 1000; | |
camera = new THREE.PerspectiveCamera( | |
fieldOfView, | |
aspectRatio, | |
near, | |
far | |
); | |
camera.position.z = 5; | |
// create the renderer | |
renderer = new THREE.WebGLRenderer(); | |
// and set its size to the dimensions of the window | |
renderer.setSize(WIDTH, HEIGHT); | |
// then attach the renderer to the div container in your HTML file | |
var threeContainer = document.getElementById('threeContainer'); | |
threeContainer.appendChild(renderer.domElement); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment