nape-js

Fully typed 2D physics engine — modern TypeScript rewrite of Nape

Rigid bodies • Circles, Polygons & Capsules • Constraints • Fluid simulation • Collision callbacks • Spatial queries • Serialization • Web Worker support — tree-shakeable, zero dependencies.

npm install @newkrok/nape-js

Interactive Demos

Click/drag on the canvas to interact. Pick a demo below.

Loading engine…
FPS: — Bodies: — Step: —
Source Code

Benchmarks

Measured in your browser right now. Each test runs the physics step() in a tight loop and reports the median time per step.

Press the button to start.

API at a Glance

Core

  • Space — physics world
  • Body — rigid body
  • Vec2 — 2D vector
  • AABB — bounding box

Shapes