• Stars
    star
    98,690
  • Rank 48 (Top 0.01 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 14 years ago
  • Updated 10 days ago

Reviews 5.0 (1)

22 days ago by guillerf

Exceptional open-source JavaScript library for creating immersive 3D graphics experiences on the web. Easy to use and great documentation and examples. The community behind it is awesome, so you'll always find support and inspiration to push your projects to the next level.

Repository Details

JavaScript 3D Library.

three.js

NPM Package Build Size NPM Downloads DeepScan Discord

JavaScript 3D library

The 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 as addons.

Examples — Docs — Manual — Wiki — Migrating — Questions — Forum — Discord

Usage

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.

import * as THREE from 'three';

const width = window.innerWidth, height = window.innerHeight;

// init

const camera = new THREE.PerspectiveCamera( 70, width / height, 0.01, 10 );
camera.position.z = 1;

const scene = new THREE.Scene();

const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.MeshNormalMaterial();

const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );

const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( width, height );
renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );

// animation

function animation( time ) {

	mesh.rotation.x = time / 2000;
	mesh.rotation.y = time / 1000;

	renderer.render( scene, camera );

}

If everything goes well, you should see this.

Cloning this repository

Cloning 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.

git clone --depth=1 https://github.com/mrdoob/three.js.git

Change log

Releases

More Repositories

1

stats.js

JavaScript Performance Monitor
JavaScript
8,405
star
2

texgen.js

JavaScript Texture Generator
JavaScript
1,771
star
3

glsl-sandbox

Shader editor and gallery.
JavaScript
1,520
star
4

frame.js

JavaScript Sequence Editor
JavaScript
987
star
5

htmleditor

Simple editor for messing around.
JavaScript
571
star
6

Hi-ReS-Stats

Performance monitor for Actionscript3 and haXe
Haxe
323
star
7

eventdispatcher.js

JavaScript events for custom objects
JavaScript
306
star
8

system.js

JavaScript object with the user's system information.
JavaScript
204
star
9

harmony

Procedural Drawing Tool
JavaScript
167
star
10

daydream-controller.js

WebBluetooth Daydream Controller
HTML
152
star
11

model-tag

Custom Elements for easily displaying 3D models.
JavaScript
136
star
12

svg-editor

SVG Editor
HTML
117
star
13

3d-file-viewer

3D File Viewer
JavaScript
80
star
14

timer.js

JavaScript timer replacement for audio
JavaScript
60
star
15

sequencer.js

JavaScript Sequencer
JavaScript
58
star
16

clickbait-stopper

Chrome extension that adds line-through to clickbait headlines.
JavaScript
54
star
17

omggif-example

Animated GIF generator example.
JavaScript
53
star
18

ui.js

Javascript UI library
JavaScript
52
star
19

sporel

HTML
48
star
20

webgl-blendfunctions

WebGL Blending Tools
47
star
21

blinkftw

Keeping <blink> alive
JavaScript
43
star
22

mrdoob.github.com

HTML
37
star
23

xrcode

HTML
36
star
24

resonate-2016

JavaScript
32
star
25

webvr-replayer

Chrome Extension for recording and playback of vr sessions. Three.js only at this point.
JavaScript
32
star
26

webar-experiments

Experiments for WebARonARCore/WebARonARKit
JavaScript
31
star
27

13kb-404

JavaScript
28
star
28

webvr-sculpt

JavaScript
24
star
29

rome-gltf

JavaScript
20
star
30

brokenmantra

JavaScript
19
star
31

midemhackday

Music Machine hacked at Midem Hack Day.
JavaScript
19
star
32

mrdoob

13
star
33

code.google.com

ActionScript
12
star
34

webu2016

JavaScript
8
star