|
@@ -35,7 +35,7 @@ The library needs to be included first thing.
|
|
|
|
|
|
<script type="text/javascript" src="js/three.js"></script>
|
|
<script type="text/javascript" src="js/three.js"></script>
|
|
|
|
|
|
-This code creates a camera, then creates a scene object, adds a bunch of random particles to the scene, creates a <canvas> renderer and adds its viewport in the document.body element.
|
|
|
|
|
|
+This code creates a camera, then creates a scene object, adds a bunch of random particles in it, creates a <canvas> renderer and adds its viewport in the document.body element.
|
|
|
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
|
|
|
|
@@ -46,14 +46,11 @@ This code creates a camera, then creates a scene object, adds a bunch of random
|
|
|
|
|
|
function init() {
|
|
function init() {
|
|
|
|
|
|
- camera = new THREE.Camera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 0.0001, 10000 );
|
|
|
|
|
|
+ camera = new THREE.Camera( 75, window.innerWidth / window.innerHeight, 0.0001, 10000 );
|
|
camera.position.z = 1000;
|
|
camera.position.z = 1000;
|
|
|
|
|
|
scene = new THREE.Scene();
|
|
scene = new THREE.Scene();
|
|
|
|
|
|
- renderer = new THREE.CanvasRenderer();
|
|
|
|
- renderer.setSize( window.innerWidth, window.innerHeight );
|
|
|
|
-
|
|
|
|
for (var i = 0; i < 1000; i++) {
|
|
for (var i = 0; i < 1000; i++) {
|
|
|
|
|
|
var particle = new THREE.Particle( new THREE.ColorFillMaterial( Math.random() * 0x808008 + 0x808080, 1 ) );
|
|
var particle = new THREE.Particle( new THREE.ColorFillMaterial( Math.random() * 0x808008 + 0x808080, 1 ) );
|
|
@@ -65,6 +62,9 @@ This code creates a camera, then creates a scene object, adds a bunch of random
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ renderer = new THREE.CanvasRenderer();
|
|
|
|
+ renderer.setSize( window.innerWidth, window.innerHeight );
|
|
|
|
+
|
|
document.body.appendChild( renderer.domElement );
|
|
document.body.appendChild( renderer.domElement );
|
|
|
|
|
|
}
|
|
}
|