nape-js

Modern TypeScript wrapper for the Nape 2D physics engine

Rigid bodies • Convex polygons • Circle shapes • Constraints • Collision callbacks • Spatial queries — all with a clean, typed API.

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

  • Circle — radius-based
  • Polygon — convex hull
  • Polygon.box(w, h)
  • Polygon.regular(r, r, n)