Two.js
Renderer-agnostic JavaScript drawing API for two-dimensional scenes that render to WebGL, canvas or SVG.
Two.js is a drawing API for two-dimensional scenes on the web. The same scene can be drawn by its WebGL, canvas or SVG renderer, because the API sits above the renderer. Shapes and groups are kept in a scenegraph, so an object can be rotated, moved or scaled after it is created, and the library has a built-in animation loop that updates the scene.
Two.js also reads SVG elements from design tools into a scene and loads bitmap images, sprite sheets and image sequences. A headless mode renders a scene on a server with the Node Canvas library and writes the frames to files. The documentation describes the API.
Worth knowing
The README says the main import includes every module, so tree shaking is not yet implemented, although the project lists it on its roadmap. A custom build can exclude renderers the project does not need by editing its build script, which reduces the file size.
Identity
- Status
- Active
- Maintainer
- jonobr15
- Maintained by
- Individual
- First release
- 20134
Rendering and deploy
- Install with
- npm, download, source build3
Releases
Adoption
Sources
- 2026-11-16: links, Categories
two.js.org/ - 2026-11-16: links, Written in, GitHub stars
api.github.com/repos/jonobr1/two.js - 2026-11-16: links, Categories, Runtime, Install with
raw.githubusercontent.com/jonobr1/two.js/dev/README.md - 2026-11-16: First release
api.github.com/repos/jonobr1/two.js/tags - 2026-11-16: Maintainer, License, License model
raw.githubusercontent.com/jonobr1/two.js/dev/LICENSE - 2026-11-16: Current major version, Last release
api.github.com/repos/jonobr1/two.js/releases - 2026-11-16: Contributors
api.github.com/repos/jonobr1/two.js/contributors - 2026-11-16: npm downloads a week
api.npmjs.org/downloads/range/2026-11-01:2026-11-07/two.js - 2026-11-16: Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/two.js