Communitygithub.com

Camera Direction

Design, move, and check the camera in a coded film, short, explainer, or 3D scene in Remotion, React Three Fiber, Three.js, or Blender. It keeps every subject in frame and travels between shots with weight.

What is Camera Direction?

A camera kit for films built in code: framing, weighted moves, and a frame-by-frame check so the shot does not fall apart.

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/PeterOla/camera-direction/tree/HEAD/skills/camera-direction

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

What does Camera Direction do?

A camera written by a coding agent tends to fail in the same four ways. Each has a mechanism in the kit.

FaultMechanism in the kit
One subject is shown while others were part of the same momentfit puts every subject's points inside the safe part of the frame
Bare cuts inside one scene, with no camera movementroute travels between named framings with weighted speed and blend
Nothing shows who is being spoken toeventClock stops the action; pulse rings the addressed subject
Nobody checked before showing itlint fails a subject out of frame, a jolt, an undeclared cut, a fast pan, a snap zoom

Two rules sit behind everything here:

  1. Everyone the scene is about is in the frame together. From the moment a scene involves more than one aircraft, vehicle or person (others are named, spoken to, or acting at the same time), all of them are on screen in the same shot, clear of the title and captions. A shot of one subject is right only while the story is about that one alone.
  2. Inside a scene the camera travels; it does not cut. It moves between framings with a slow start and a slower stop, then holds still for a second or more. A cut is kept for a new place or a new scene.

Method

Do these in order, in writing first. No camera code until step 3 is written down in the project's shot plan.

  1. List who is in play, per beat. For each line of narration or dialogue: which subjects the scene is about at that moment (not only the one named). All of them are in frame for that beat. If the list changes mid-scene, the framing widens before the newcomer matters: a subject is on screen before the line about it is heard.
  2. Pick one view direction per scene. Height is read side-on with a ground line. A scene keeps its direction; turning the camera round is a new scene.
  3. Name the framings. Two or three per scene, each a call to fit with the points that must be seen (each subject's nose, tail and wing tips, or head and feet, plus the ground reference the shot needs: a runway end, a fence, a road). Typical set: wide (everyone plus the ground reference) and a lean (the same group, pushed 10–25% towards the subject being spoken to). The kit's lean cuts the push back until every subject in play is still inside the safe area: it is a lean, not a close-up. A subject under about 2.5% of frame width is a dot: give lint a minSize and, when it fires, draw the subject larger than life (and note it in the project log) or shorten the ground reference; do not drop the other subjects.
  4. Lay the route. One Stop per framing: the second it has arrived, and how long the move into it takes. The camera holds each stop until the next move starts.
  5. Mark who is spoken to. On a line that changes what someone does (an order, a warning, a call to stop or turn), from the first word of their name: the action pauses (eventClock), the addressed subject pulses (pulse), and the camera finishes its lean onto it. The others stay in frame, still. Then the action resumes and the response plays at real speed. One pause per line that turns the story, never one per line of dialogue: replies, acknowledgements and routine lines play straight through. At most three in a film under a minute; each costs about 1.25 s of event time.
  6. Check. lint clean, stills, then a blind critic (below). Only then render for review.

Numbers

ThingDefault
A camera move1.2–2.5 s; weighted (speeds up over the first quarter, slows over the last 40%)
Hold after a move1 s or more before the next move; key information is read from a still camera
The shot of the event itself5 s or more, not cut as it happens; action at real speed
Pan speedunder 30° a second
Lens change15° or less, over half a second or more; prefer moving the camera to changing the lens
Kinds of motion at onceat most two of: travel, turn, zoom
Rollnone
Easescamera: slow in, slow out, longer out. Never overshoot, bounce or elastic on a camera
Pause on a nameaction eases to a stop in 0.25 s, holds about 1 s, eases back in 0.25 s
Pulsetwo hair-thin rings, 0.45 s apart, each 0.9 s, opening from the addressed subject; one flat colour, never a glow
A cutonly for a new place or a new scene; listed in cuts so the checker knows it was meant
Subject positioninside SAFE_SHORT (9:16: clear of a title strip and the caption quarter) or SAFE_WIDE (16:9); pass your own Safe for another layout
Still cameraa valid shot. No drift, shake or slow zoom added to fill a hold

A move must have a reason a viewer could name: a new subject enters the story, someone is spoken to, the danger point comes into play. No reason, no move.

The pause length and the look of the pulse are a starting point, not a finding. Change them when the person the film is for has seen them in a cut and said otherwise.

The kit

kit/camera.ts is one file of plain functions with no imports, so it runs inside Remotion, React Three Fiber, Three.js and plain Node. Copy it into the film's src/. Units are whatever the scene uses; time is in seconds. A framing is {pos, look, fov}: where the camera is, the point it looks at, and its vertical field of view in degrees.

FunctionWhat it gives
fit(points, dir, fov, aspect, safe)the closest framing along dir with every point inside the safe area
lean(base, towards, amount, keep)the same view pushed towards one subject, cut back so every kept point stays in frame
route(stops, t)the framing for second t: weighted travel between stops, holds in between
blend(a, b, p)one framing between two; the aim arrives slightly before the camera
weighted(p)move progress with a ramp up, a steady run and a longer ramp down
eventClock(t, pauses)the clock the action reads; it stops during a pause while the film clock runs on
pulse(t, start)ring sizes and fades for the subject being spoken to
project(framing, aspect, p)where a point lands in the frame (0–1 from the top-left), for rings and labels
lint(cam, subjects, opts)the list of faults, frame by frame

Wiring, from examples/check-camera.ts (a complete scene that runs as it stands: three aircraft on one approach, the second told to go around):

import {eventClock, fit, lean, lint, route} from './camera';
import type {Framing, Pause, Stop, V3} from './camera';

const FPS = 30;
const ASPECT = 1080 / 1920;
const SIDE: V3 = [0, -0.05, -1];                  // side-on, a little down
const PAUSES: Pause[] = [{at: 4.0, len: 1.0}];    // the action is fully stopped on the first word of the call
const eventAt = (s: number) => eventClock(s, PAUSES);

const subjects = (s: number) => aircraft(eventAt(s));          // {first: [nose, tail], second: [...], third: [...]}
const points = (s: number) => Object.values(subjects(s)).flat();

// one framing for the whole scene: everyone at its start and its end, plus the runway
const everyone: Framing = fit([...points(0), ...points(10), THRESHOLD, RUNWAY_END], SIDE, 30, ASPECT);
const ontoSecond = (s: number) => lean(everyone, subjects(s).second[0], 0.18, {points: points(s), aspect: ASPECT});

const STOPS: Stop[] = [
	{at: 0, move: 0, framing: everyone},
	{at: 4.4, move: 1.6, framing: ontoSecond},
	{at: 8.4, move: 2.0, framing: everyone},
];

/** the film's camera: a pure function of the frame */
export const camera = (frame: number) => route(STOPS, frame / FPS);

const faults = lint((s) => route(STOPS, s), subjects, {from: 0, to: 10, fps: FPS, aspect: ASPECT});

aircraft, THRESHOLD and RUNWAY_END are the film's own (V3 arrays in scene units); the example file defines them. Import the types with import type: a plain import of Pause or Stop fails under Node's type stripping. Under plain Node the import path needs its extension ('./camera.ts'); inside a bundler it does not. A scene that wants THREE.Vector3 wraps the result: camera.position.set(...f.pos), camera.lookAt(...f.look), camera.fov = f.fov.

camera(frame) stays a pure function of the frame. Never keep camera state in useFrame, a ref or a spring: a renderer such as Remotion draws frames out of order and in parallel, and a camera that depends on the frame before it will differ between preview and render.

A fit that follows moving subjects breathes as they spread or close. If that reads as restless, fit the whole beat instead, as the example does: pass the subjects' points at the start and the end of the beat together, and the framing is fixed for the beat.

Blender: the same numbers apply. Bake route to keyframes on the camera and its aim empty (one key per frame, or set the F-curves to the same ramps); do not leave the default Bezier ease on a camera move without checking it against the table.

The pause puts the picture behind the sound

While the action is stopped the narration or dialogue keeps playing, so after each pause the picture's clock is len + ramp seconds behind where it would have been. Plan for it: start the scene that much earlier in event time, or let any clock on screen stop with the action (it reads eventAt, so it does). An on-screen clock never jumps; if the story skips minutes, that is a declared cut with the clock shown before and after.

The check

  1. lint. Run it on the film's real camera and real subject points, over every scene, from a check-camera.ts beside the film. It must return nothing. out-of-frame is fixed by widening the framing, never by removing the subject from the list. Declare each intended cut by its film second in cuts.

    If the check imports only the kit and plain data, Node 22.6 or later runs it directly:

    node --experimental-strip-types --no-warnings check-camera.ts
    

    A real film's timeline usually imports three, JSON or extensionless modules, which plain Node will not load. Bundle the check first with the esbuild the project already has (Remotion and Vite both install it):

    node_modules/.bin/esbuild check-camera.ts --bundle --platform=node --format=esm --log-level=error --outfile=/tmp/check-camera.mjs && node /tmp/check-camera.mjs
    

    lint checks points, so a subject given as one point can pass while its wing is cut by the frame edge: give nose, tail and wing tips. When a reviewer rejects a shot that lint passed, the checker is what is wrong: add the fault to lint and to its test.

  2. Stills. For every move: one frame at its start, middle and end, and one in the middle of each hold. Look for: a subject cut by the frame edge or sitting under the captions, the horizon tilting, a subject that is a dot.

  3. Blind critic. A fresh subagent that has not seen the plan, given the frames or the clip and only these questions: How many aircraft (vehicles, people) are in each frame, and where? Which one is being spoken to, and how can you tell? Between frames, did the camera travel or did the picture jump? Was there a moment the action stopped? Anything cut off, too small to read, or hidden by text? Compare its answers with the shot plan. A wrong count or "I can't tell who is addressed" is a failed shot.

The kit's own maths is tested: node --experimental-strip-types --no-warnings kit/camera.test.ts prints camera kit: all checks pass. Run it after any change to the kit.

What this skill does not do

Advice common in other motion skills that this one leaves out on purpose:

  • "The camera never rests", "no still frame over 0.6 s", idle drift, a slow zoom on a still picture. Information is read from a still camera.
  • Handheld shake, crash zooms, whip pans. One steady witness camera per scene, at real speed.
  • "Cut instead of travelling" or "cut mid-motion" for energy. Inside one idea the camera moves.
  • A sound effect on a camera move. A move is silent or carries the scene's own sound.

Limits

  • lint checks the points it is given and the camera's path. It does not look at pixels, so it cannot see a subject hidden behind another object, text laid over it, or a model drawn in the wrong place. The stills and the blind critic are for that.
  • fit keeps one view direction. It does not choose the direction for you.
  • The kit is proven by its own tests and has been run on one real film so far. Treat a new kind of scene as untested until lint and the stills agree.

Where the ideas came from

Nothing was copied from these; the wording and code are our own. None of them had a rule for keeping several subjects in frame; fit and lean are new here.

  • Vincentwei1021/video-shotcraft (Apache-2.0): camera as keyframed position, aim and lens; two clocks for a freeze; hold after a move.
  • jestermaxdelta/roblox-building-skill, cinematics reference (no licence; ideas only): one speed profile per move, longer settle, pan and lens limits, at most two kinds of motion, a still frame is a shot.
  • Haseeburrahmann/3d-animator-skill (MIT): named framings, one move per beat starting on its first word, stills at the start, middle and end of every move.
  • digitalsamba/claude-code-video-toolkit, motion-craft.md (MIT): ease by role; nothing drifts once it has landed.
  • echris6/motion-video-kit (MIT): a fresh, independent critic working from extracted frames.

Related Skills