three
Three.js is the most popular JavaScript library for creating and displaying 3D graphics in web browsers using WebGL, WebGPU, and CSS3D renderers. The library pr…
Installation
npm install three
yarn add three
pnpm add three
Import
import * as THREE from 'three';
Quick Example
import * as THREE from 'three';
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight);
const renderer = new THREE.WebGLRenderer();
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({ color: 0x3b82f6 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
camera.position.z = 5;
renderer.render(scene, camera);About three
Three.js is the most popular JavaScript library for creating and displaying 3D graphics in web browsers using WebGL, WebGPU, and CSS3D renderers. The library provides a comprehensive abstraction over the WebGL API, making 3D programming accessible without deep graphics programming knowledge. Three.js includes geometries (box, sphere, plane, torus, custom), materials (basic, standard, physical, shader), lights (ambient, directional, point, spot, hemisphere), cameras (perspective, orthographic), and a scene graph for organizing 3D objects hierarchically. The library supports texture mapping, normal maps, environment maps, shadows, fog, post-processing effects (bloom, depth of field, SSAO), skeletal animation, morph targets, particle systems, and physics integration. Three.js can load 3D models in GLTF, OBJ, FBX, and other formats through its loader system. React Three Fiber (@react-three/fiber) provides a React renderer for Three.js, enabling declarative 3D scene construction with React components. Three.js powers interactive product configurators, data visualizations, architectural walkthroughs, games, art installations, and immersive web experiences. The library is the foundation of the WebGL ecosystem and is used on millions of websites.
Quick Facts
| Package | three |
| Category | UI Component |
| Weekly Downloads | 3M+ |
| License | MIT |
| Install | npm install three |
Related Packages
D3.js (Data-Driven Documents) is the most powerful and flexible JavaScript library for creating cust…
Lottie Web is a library for rendering Adobe After Effects animations exported as JSON files through …
Framer Motion is the most popular animation library for React, providing a simple declarative API fo…
React is the most popular JavaScript library for building user interfaces, developed and maintained …
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.