What is Three.js and How make a VR scene.

What is Three.js? 

Three.js is a JavaScript library that allows developers to create and display animated 3D computer graphics in the web browser.

How to use the three.js javascript library?

Include the three.js library in your HTML file:

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r76/three.min.js"></script>
Create a scene: var scene = new THREE.Scene(); Create a camera: var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );

Create a renderer: var renderer = new THREE.WebGLRenderer(); Set the size of the renderer: renderer.setSize( window.innerWidth, window.innerHeight );

Add the renderer to the HTML document: document.body.appendChild( renderer.domElement ); Render the scene: renderer.render( scene, camera );
Back to blog