ZIM Physics is a helper module for the ZIM JavaScript Canvas Framework that works with Box2DWeb. In ZIM TEN, we integrated physics - see https://zimjs.com/physics - so it is as easy as:
new Circle().center().addPhysics();
and the circle will drop to the ground! Usually we create a Physics object first so we can set gravity and boundaries if needed and call various methods on the physics object such as drag. See the ZIM Docs at https://zimjs.com/docs.html?item=Physics and https://zimjs.com/docs.html?item=addPhysics.
const physics = new Physics();
physics.drag(); // will make dynamic objects draggable
new Circle().center().addPhysics({bounciness:.7});
Usually we use ES Modules to bring in ZIM and if we want Physics then we use the code below - see the starting template at the top of the https://zimjs.com/code page. The zim_physics also imports the zim_game module (where as the NPM version does not).
import zim from "https://zimjs.org/cdn/016/zim_physics";
This repository holds the NPM package so you can install from @zimjs/physics on NPM. It includes typings and loads the Box2DWeb package as a dependency. The ZIM package must be installed to work.
import zim from "zimjs"
import { Physics } from "@zimjs/physics"
See the ZIM repository at https://github.com/danzen/zimjs for information on ZIM and open source license, etc.