source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/README.md@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 1.9 KB
Line 
1three.js
2========
3
4#### JavaScript 3D library ####
5
6The aim of the project is to create a lightweight 3D library with a very low level of complexity — in other words, for dummies. The library provides <canvas>, <svg>, CSS3D and WebGL renderers.
7
8[Examples](http://threejs.org/) — [Documentation](http://threejs.org/docs/) — [Migrating](https://github.com/mrdoob/three.js/wiki/Migration) — [Help](http://stackoverflow.com/questions/tagged/three.js)
9
10
11### Usage ###
12
13Download the [minified library](http://threejs.org/build/three.min.js) and include it in your html.
14Alternatively see [how to build the library yourself](https://github.com/mrdoob/three.js/wiki/build.py,-or-how-to-generate-a-compressed-Three.js-file).
15
16```html
17<script src="js/three.min.js"></script>
18```
19
20This code creates a scene, then creates a camera, adds the camera and cube to the scene, creates a &lt;canvas&gt; renderer and adds its viewport in the document.body element.
21
22```html
23<script>
24
25 var camera, scene, renderer;
26 var geometry, material, mesh;
27
28 init();
29 animate();
30
31 function init() {
32
33 camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
34 camera.position.z = 1000;
35
36 scene = new THREE.Scene();
37
38 geometry = new THREE.CubeGeometry( 200, 200, 200 );
39 material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
40
41 mesh = new THREE.Mesh( geometry, material );
42 scene.add( mesh );
43
44 renderer = new THREE.CanvasRenderer();
45 renderer.setSize( window.innerWidth, window.innerHeight );
46
47 document.body.appendChild( renderer.domElement );
48
49 }
50
51 function animate() {
52
53 // note: three.js includes requestAnimationFrame shim
54 requestAnimationFrame( animate );
55
56 mesh.rotation.x += 0.01;
57 mesh.rotation.y += 0.02;
58
59 renderer.render( scene, camera );
60
61 }
62
63</script>
64```
65If everything went well you should see [this](http://jsfiddle.net/ksRyQ/).
66
67### Change log ###
68
69[releases](https://github.com/mrdoob/three.js/releases)
Note: See TracBrowser for help on using the repository browser.