Three.js Quick Start - Run Spinning-Cube Example

In this post, I am going to run the spinning-cube example for three.js. https://threejs.org/docs/#manual/en/introduction/Creating-a-scene What is three.js? three.js is a JavaScript library to render 3D graphics on a browser. Example % mkdir threejs && cd threejs % mkdir js % curl -o ./js/three.js https://threejs.org/build/three.js % tree . ├── index.html └── js └── three.js % vim index.html % open index.html index.html (the code is from example ) <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My first three.js app</title> <style> body { margin: 0; } </style> </head> <body> <script src="js/three.js"></script> <script> const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); const renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, windo...