Paper.js scripts vector graphics on HTML5 Canvas in the browser and via Node.js packages. It supports PaperScript or JavaScript workflows with npm installation.
Overview
Paper.js is a vector graphics scripting environment ported from Scriptographer to JavaScript and the browser canvas. It targets interactive drawing, animation, and structured scenes built from paths and shapes rather than manual canvas calls alone.
Install the main `paper` package through npm for use in browsers, Node.js, or Electron, optionally with bundlers such as webpack, Rollup, esbuild, or Vite. Distributions include a full build with PaperScript and Acorn, and a slimmer core build without PaperScript for direct JavaScript projects.
Separate npm variants add headless or server rendering: `paper-jsdom` for SVG import and export through jsdom, and `paper-jsdom-canvas` for raster output through Node-Canvas, which depends on system Cairo and Pango libraries on some platforms.
Developers can load prebuilt browser bundles or import modules in TypeScript with the appropriate compiler settings. The project documents Linux package names for Cairo-related native dependencies when using canvas-backed Node rendering.
Key features
- Vector paths on HTML5 Canvas
- PaperScript or JavaScript usage
- Browser and Node.js distributions
- SVG import and export variants
- Bundler-friendly npm packages
- Full and core prebuilt bundles
- Scene graph via paper.setup
- Server rendering with jsdom shims
Use cases
- Interactive canvas illustrations
- Vector animation in the browser
- Headless SVG processing in Node.js
- Graphics inside Electron apps