|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .github/ | H | 24-Dec-2021 | - | 354 | 256 |
| build/ | H | 03-May-2022 | - | | |
| docs/ | H | 03-May-2022 | - | 1,407 | 1,203 |
| editor/ | H | 03-May-2022 | - | 2,432 | 2,122 |
| examples/ | H | 03-May-2022 | - | 1,517,155 | 1,501,804 |
| files/ | H | 03-May-2022 | - | 620 | 533 |
| manual/ | H | 03-May-2022 | - | 217,503 | 217,261 |
| src/ | H | 03-May-2022 | - | | |
| test/ | H | 03-May-2022 | - | 1,919 | 1,788 |
| utils/ | H | 03-May-2022 | - | 27 | 25 |
| .editorconfig | H A D | 24-Dec-2021 | 187 | 15 | 10 |
| .gitattributes | H A D | 24-Dec-2021 | 86 | 4 | 2 |
| .gitignore | H A D | 24-Dec-2021 | 727 | 27 | 24 |
| LICENSE | H A D | 24-Dec-2021 | 1.1 KiB | 22 | 17 |
| README.md | H A D | 24-Dec-2021 | 2.9 KiB | 87 | 58 |
| package-lock.json | H A D | 24-Dec-2021 | 417.1 KiB | 11,130 | 11,129 |
| package.json | H A D | 24-Dec-2021 | 3.8 KiB | 143 | 140 |
README.md
1three.js
2========
3
4[![NPM Package][npm]][npm-url]
5[![Build Size][build-size]][build-size-url]
6[![NPM Downloads][npm-downloads]][npmtrends-url]
7[![Language Grade][lgtm]][lgtm-url]
8
9#### JavaScript 3D library ####
10
11The aim of the project is to create an easy to use, lightweight, cross-browser, general purpose 3D library. The current builds only include a WebGL renderer but WebGPU (experimental), SVG and CSS3D renderers are also available in the examples.
12
13[Examples](https://threejs.org/examples/) —
14[Documentation](https://threejs.org/docs/) —
15[Wiki](https://github.com/mrdoob/three.js/wiki) —
16[Migrating](https://github.com/mrdoob/three.js/wiki/Migration-Guide) —
17[Questions](http://stackoverflow.com/questions/tagged/three.js) —
18[Forum](https://discourse.threejs.org/) —
19[Slack](https://join.slack.com/t/threejs/shared_invite/zt-rnuegz5e-FQpc6YboDVW~5idlp7GfDw) —
20[Discord](https://discordapp.com/invite/HF4UdyF)
21
22### Usage ###
23
24This 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.
25
26```javascript
27import * as THREE from './js/three.module.js';
28
29let camera, scene, renderer;
30let geometry, material, mesh;
31
32init();
33
34function init() {
35
36 camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
37 camera.position.z = 1;
38
39 scene = new THREE.Scene();
40
41 geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
42 material = new THREE.MeshNormalMaterial();
43
44 mesh = new THREE.Mesh( geometry, material );
45 scene.add( mesh );
46
47 renderer = new THREE.WebGLRenderer( { antialias: true } );
48 renderer.setSize( window.innerWidth, window.innerHeight );
49 renderer.setAnimationLoop( animation );
50 document.body.appendChild( renderer.domElement );
51
52}
53
54function animation( time ) {
55
56 mesh.rotation.x = time / 2000;
57 mesh.rotation.y = time / 1000;
58
59 renderer.render( scene, camera );
60
61}
62```
63
64If everything went well, you should see [this](https://jsfiddle.net/vy29n6aj/).
65
66### Cloning this repository ###
67
68Cloning the repo with all its history results in a ~2 GB download. If you don't need the whole history you can use the `depth` parameter to significantly reduce download size.
69
70```sh
71git clone --depth=1 https://github.com/mrdoob/three.js.git
72```
73
74### Change log ###
75
76[Releases](https://github.com/mrdoob/three.js/releases)
77
78
79[npm]: https://img.shields.io/npm/v/three
80[npm-url]: https://www.npmjs.com/package/three
81[build-size]: https://badgen.net/bundlephobia/minzip/three
82[build-size-url]: https://bundlephobia.com/result?p=three
83[npm-downloads]: https://img.shields.io/npm/dw/three
84[npmtrends-url]: https://www.npmtrends.com/three
85[lgtm]: https://img.shields.io/lgtm/alerts/github/mrdoob/three.js
86[lgtm-url]: https://lgtm.com/projects/g/mrdoob/three.js/
87