Watch
1
0
Fork
You've already forked three.js
0
mirror of https://github.com/matrix-org/three.js.git synced 2026-11-17 04:21:04 +00:00
JavaScript 3D Library.
  • JavaScript 47.3%
  • HTML 35.7%
  • AGS Script 13.7%
  • Roff 3%
  • CSS 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Robert Long 86c1b8293f v0.148.3
2023-03-13 18:32:15 -07:00
.github Update bug_report.yml (#25250) 2023-01-07 13:40:31 +09:00
build v0.148.3 2023-03-13 18:32:15 -07:00
docs Docs/Examples/Manual: Keep focus when clear search input. (#25194) 2023-01-05 16:40:10 +09:00
editor Specify value range for aoMap intensity (#25244) 2023-01-05 23:39:53 +01:00
examples v0.148.3 2023-03-13 18:32:15 -07:00
files Docs/Examples/Manual: Keep focus when clear search input. (#25194) 2023-01-05 16:40:10 +09:00
manual Docs/Examples/Manual: Keep focus when clear search input. (#25194) 2023-01-05 16:40:10 +09:00
src Reduce memory allocations 2023-03-13 18:29:53 -07:00
test WebGPU: IES SpotLight Node-Based (#25238) 2023-01-06 11:28:27 -03:00
utils Update Copyright (#25224) 2023-01-03 10:17:11 +01:00
.editorconfig Remove indent size from .editorconfig 2019-06-03 21:29:01 -07:00
.gitattributes git should handle the line endings 2018-01-11 10:43:26 +01:00
.gitignore test-treeshake: Add rollup-plugin-visualizer (#21657) 2021-04-15 13:02:11 +01:00
icon.png Optimize icon image (#23238) 2022-01-14 20:17:26 +00:00
LICENSE Update LICENSE (#25212) 2023-01-01 18:06:46 +09:00
package-lock.json v0.148.3 2023-03-13 18:32:15 -07:00
package.json v0.148.3 2023-03-13 18:32:15 -07:00
README.md "Officialize" renaming of examples classes to addons (#24579) 2022-11-01 10:25:43 +01:00

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';

// init

const camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 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( window.innerWidth, window.innerHeight );
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 went 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