Skip to content

Commit 84e6749

Browse files
committed
Simplified README
1 parent 44844c7 commit 84e6749

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

README.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,45 @@ Alternatively see [how to build the library yourself](https://github.com/mrdoob/
1919

2020
This code creates a scene, a camera, and a geometric cube, and it adds the cube to the scene. It then creates a `WebGL` renderer for the scene and camera, and it adds that viewport to the document.body element. Finally it animates the cube within the scene for the camera.
2121

22-
```html
23-
<script>
24-
25-
var scene, camera, renderer;
26-
var geometry, material, mesh;
22+
```javascript
23+
var scene, camera, renderer;
24+
var geometry, material, mesh;
2725

28-
init();
29-
animate();
26+
init();
27+
animate();
3028

31-
function init() {
29+
function init() {
3230

33-
scene = new THREE.Scene();
34-
35-
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
36-
camera.position.z = 1000;
31+
scene = new THREE.Scene();
3732

38-
geometry = new THREE.BoxGeometry( 200, 200, 200 );
39-
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
33+
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
34+
camera.position.z = 1000;
4035

41-
mesh = new THREE.Mesh( geometry, material );
42-
scene.add( mesh );
36+
geometry = new THREE.BoxGeometry( 200, 200, 200 );
37+
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
4338

44-
renderer = new THREE.WebGLRenderer();
45-
renderer.setSize( window.innerWidth, window.innerHeight );
39+
mesh = new THREE.Mesh( geometry, material );
40+
scene.add( mesh );
4641

47-
document.body.appendChild( renderer.domElement );
42+
renderer = new THREE.WebGLRenderer();
43+
renderer.setSize( window.innerWidth, window.innerHeight );
4844

49-
}
45+
document.body.appendChild( renderer.domElement );
5046

51-
function animate() {
47+
}
5248

53-
requestAnimationFrame( animate );
49+
function animate() {
5450

55-
mesh.rotation.x += 0.01;
56-
mesh.rotation.y += 0.02;
51+
requestAnimationFrame( animate );
5752

58-
renderer.render( scene, camera );
53+
mesh.rotation.x += 0.01;
54+
mesh.rotation.y += 0.02;
5955

60-
}
56+
renderer.render( scene, camera );
6157

62-
</script>
58+
}
6359
```
60+
6461
If everything went well you should see [this](http://jsfiddle.net/hfj7gm6t/).
6562

6663
### Change log ###

0 commit comments

Comments
 (0)