• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H24-Dec-2021-354256

build/H03-May-2022-

docs/H03-May-2022-1,4071,203

editor/H03-May-2022-2,4322,122

examples/H03-May-2022-1,517,1551,501,804

files/H03-May-2022-620533

manual/H03-May-2022-217,503217,261

src/H03-May-2022-

test/H03-May-2022-1,9191,788

utils/H03-May-2022-2725

.editorconfigH A D24-Dec-2021187 1510

.gitattributesH A D24-Dec-202186 42

.gitignoreH A D24-Dec-2021727 2724

LICENSEH A D24-Dec-20211.1 KiB2217

README.mdH A D24-Dec-20212.9 KiB8758

package-lock.jsonH A D24-Dec-2021417.1 KiB11,13011,129

package.jsonH A D24-Dec-20213.8 KiB143140

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