July 2018
Beginner to intermediate
374 pages
8h 54m
English
This is the final version of the moon-phases code from Chapter 13, Project: Phases of the Moon:
| | <body></body> |
| | <script src="/three.js"></script> |
| | <script src="/controls/FlyControls.js"></script> |
| | <script> |
| | // The "scene" is where stuff in our game will happen: |
| | var scene = new THREE.Scene(); |
| | var flat = {flatShading: true}; |
| | var light = new THREE.AmbientLight('white', 0.1); |
| | scene.add(light); |
| | |
| | // The "camera" is what sees the stuff: |
| | var aspectRatio = window.innerWidth / window.innerHeight; |
| | var w = window.innerWidth / 2; |
| | var h = window.innerHeight / 2; |
| | var camera = new THREE.OrthographicCamera(-w, w, h, -h, 1, 10000); |
| | camera.position.y = 500; |
| | camera.rotation.x = -Math.PI/2; ... |
Read now
Unlock full access