Camera — the viewport transform
camerais a per-stage transform over the whole scene — follow a target, deterministic shake, zoom, letterbox. Where motion carries a per-target transform,camerais the per-stage one: it doesn't move targets, it moves the view onto them, applied at render on top of everything else.
Status: design. Not built yet.
What it is
The camera is the window onto the stage: a position, zoom, and rotation for the viewport, through which the scene is drawn. It changes what you see, not where things are — so it composes cleanly on top of every per-target transform, as the last stage in the pipeline (path → per-play → per-target → **camera**).
Follow, shake, bounds
- Follow — track a target, with optional smoothing (a lerp toward it), a deadzone (don't move until the target leaves a central box), and world bounds (never scroll past the level edge).
- Shake — an impact wobble, driven by the seeded PRNG so it is deterministic and decays over a set time. Same seed, same shake.
- Zoom / rotate / letterbox — scale and turn the view; pillar/letterbox to a fixed aspect on any display.
On the stage
camera holds view state, not target state: it reads the followed target's position each tick and computes the viewport transform, applied at render, after React. Follow is a pure function of the target and the camera's parameters; shake is a pure function of the seed and time — so the view, like everything else, replays exactly.
Clients
- Luau —
require("camera"): follow, shake, zoom, set bounds. - AntBASIC —
CAMERA FOLLOW sprite%,CAMERA SHAKE amount,CAMERA ZOOM zfor a first scrolling game.
Related
- motion — the per-target transform this sits above · stage — the tick and seeded PRNG (shake) · sprite — what it frames
- luau_camera — the Luau API