Physics-baked character motion and sound for videos made in code
Characters that fall, pile up or get knocked over are rigid bodies baked once at 240 Hz, so every frame reads the same motion, live in a browser or rendered frame by frame. Each landing's speed sizes the squash on screen and the boing on the soundtrack. A motion check fails your build on pops, strobes, teleports, kinks, characters cropped by the edge and characters lost off it. The sound is synthesised: nothing to license.
Try it
Everything above is read from one simulation baked when the page loads. Play with sound runs it live on the audio clock (scrub, then play: the sound starts where you are). Render WAV offline renders the same schedule through an OfflineAudioContext. Run the motion check steps every frame of the real elements; tick Plant a bug to watch it catch a sticker that pops in at full size.
What's in it
romp/core
A planck.js (Box2D) Stage baked once per scene, bodies that record their impacts, springy letters that wobble back, and the motion vocabulary: impactResponse, landing, hop, jiggleParts, blinks. A Clock for live playback.
romp/check
The motion check: pops, strobes, teleports, spikes and crops, with exemptions for real impacts, deliberate whips, covered frames and fades. Collectors for DOM pages and three.js scenes; romp check for Remotion.
romp/audio
Synthesised voices and instruments, a mix tuned for phone speakers, and one schedule played live or rendered offline. romp/audio/cartoon adds plops, boings, slurps and gibberish character voices.
Adapters and CLI
romp/remotion (track()), romp/three (motionReport()), and the romp command: romp check and romp sound.
Quick start
romp isn't on npm yet. Install it from GitHub; planck.js is its one required peer.
bun add github:isaacrowntree/romp planck
bun add -d esbuild playwright # for the CLI
import { Stage, Body, poseAt, impactResponse } from "romp/core";
const stage = new Stage(); // screen space; new Stage({ yDown: false }) for three.js
stage.ground([{ x: 40, y: 200 }, { x: 40, y: 1830 }, { x: 1040, y: 1830 }, { x: 1040, y: 200 }]);
stage.add(new Body({ id: "hero", x: 540, y: -100, w: 150, h: 150, spawn: 10, vy: 900 }));
stage.bake({ frames: 200, fps: 30 }); // once
const hero = stage.get<Body>("hero");
const pose = poseAt(hero, frame); // { shown, x, y, angle }
const look = impactResponse(hero, frame); // { squashX, squashY, tilt, lift, blink, jiggle }
Then the guides: physics, motion, the two ways to play, sound and the motion check. Every export is in the API reference.
The rules it encodes
- Choreography says where and when; physics says how. Anything that falls is given a launch velocity, never a path.
- Bake once, read every frame. Reading a pose is a pure function of time, so a live viewer, a frame-by-frame renderer and the motion check see identical motion.
- Impacts drive the picture and the sound. One recorded impact sizes the squash, the closed eyes, the follow-through and the boing.
- Nothing pops, strobes or kinks unless you say it's deliberate, and the check runs in CI.
- Sound is restrained and belongs to the picture: one family of voices in the score's key, transients a frame early, energy where a phone speaker can play it.