/genmotion:three-camerafrom genmotion
Provides camera arithmetic for Three.js scenes: a stage where 1 world unit = 100 composition px for exact sizing, an ease module with curves/springs/spline/log zoom/drift, and recipes for push, pull, orbit, fly-through, parallax, shake, match-push, and device-reveal moves.
Ships in genmotion. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
motion-language decides what the camera does and for how long (push 24–48f, punch 6–10f, orbit 10–30°, drift 4–7 px). On Three.js the camera is a real PerspectiveCamera, so every one of those moves is arithmetic on its position, target and fov. This skill is that arithmetic, distilled from the 3D templates (the LightPay and Samsung Pay launch films, the NotchBrowser one-shot, the crypto dashboard glide, the p(doom) music video) and checked by rendering it.
Two modules carry everything: components/stage.ts (units, fitting, a camera-locked overlay) and components/ease.ts (curves, closed-form springs, spline, log zoom, drift, kick). Both are in references/rig.md ready to copy; the move recipes are in references/moves.md.
Not for: choosing the move or its duration (motion-language), what sits in front of the lens at a cut (three-transitions), type that must survive a move (three-type).
Fit the camera so the z = 0 plane is 100 composition px per world unit, then lay everything out in px × PX (0.01). A 120 px headline is 120 px on screen in 16:9, 9:16 and 1:1 alike; nothing is guessed.
const D0 = fitCamera(camera, height); // 50 degree lens, on +z, looking at the origin
title.position.y = 140 * PX; // 140 px above centre, exactly
2 · tan(fov/2) · d. Px per unit at d: height / that. At 1080p with a 50° lens, D0 = 11.58.D0 / (D0 − z) times its z = 0 size. Use it to place parallax layers and to compute any matched framing.fitBlock(width, height, wPx, hPx) (an 8% margin per side) instead of shrinking type, and re-lay-out lines per aspect (safe zones per direction's pacing reference).PX = 0.01). An orthographic pixel camera (references/rig.md §4) suits a film with no depth at all (a pure 2D compositor, a keyed one-shot over a desktop); with it, every kit object is 100× too small, so scale those groups by 1 / PX.| Lens (vertical fov) | Use | Why |
|---|---|---|
| 50° (the host default) | Almost everything; type-led scenes | Neutral perspective; the house templates all use it |
| 28–35° | Product hero, logo in 3D | A longer lens flattens the object and keeps edges from bulging; move the camera back to compensate (unitDistance(height, fov)) |
| 60–75° | Flying through a space, a ring of tiles | Exaggerates depth and speed |
| −5 to −10° kick | Music hits only | An fov punch decays with kick(); it is an effect, not a move |
Never animate dolly and fov in one move (except a punch on a hit): the two fight and the perspective warps. After any fov change call updateProjectionMatrix() and re-fit the overlay.
Numbers from motion-language; recipes in references/moves.md.
| Move | Build | Gotcha |
|---|---|---|
| Push / pull | cam.position.z = logLerp(D0, D0 / zoom, prog(...)), look target fixed | Linear distance races at the start and crawls at the end |
| Creep | Same, zoom 1.015–1.06 over the whole scene, inOutSine | Pick creep or drift as the hold's life, plus at most one element behaviour |
| Punch-in | D0 / (1 + 0.1 · (in − out)), in 8f inCubic, hold ≥15f, out 12f | The only camera move under 24f |
| Orbit | Position on a circle of fixed radius, lookAt the subject, 10–30° | Often better as product.rotation.y: the lights stay put and highlights travel |
| Keyed path | [frame, x, y, zoom] keys through glide, zoom splined in log | Segmented interpolate stops dead at every interior key |
| Fly-through | CatmullRomCurve3(…, "centripetal"), getPointAt + look 2% ahead | Arc-length param gives even speed |
| Truck + parallax | Camera x only; three layers at different z | No foreground layer = a slide, not a move |
| Shake | Per-frame hash1(frame) offset × kick(time, hits) | Never a random source; dies within 3–6f |
| Slam | Headline z 6 → 0, scale keys 0.7 → 1.04 → 1 over 14f | Once per film |
| Subject rig | Pose the layout (pivot + scale + tilt) instead of the camera | For flat UI gliding in 3D, where camera math gets awkward |
| It was inside the device | Rig origin on the subject; device scaled logLerp(coverScale(...), 1) in x/y only, rig travels to the final framing, 45–60f | A plain pull-back lets the bezel into the close-up, or never covers the frame; references/moves.md §12 |
| Push on a flat film | Scale a map group about the focus (position = focus × (1 − k)) | Labels and screen-px strokes keep their size; references/moves.md §13 |
| Perspective UI showcase | A pivot posed per frame: back-tilt 20–35° easing to 10–20°, rise, apparent scale 1 → 1.25; each panel a two-texture plane (screen + pre-blurred twin) mixed by focus; an additive rim plane behind | Text on a panel tilted past ~20° is decoration; one panel sharp at a time; references/moves.md §14 |
| Card fan / card floor | Fan: one arm per card pivoting below it at the container's mouth, staggered rise and spread; floor: a grid on a group tilted ~60°, sliding toward camera, far rows faded | Rotating cards about their own centres is a shuffle, not a fan; floor cards are never read; references/moves.md §15 |
| Spring settle | springIn(frame, start, dur, "gentle") from the ease module | The preset's shape, settled exactly on start + dur; never re-derive the time scale |
When a camera move is the film's peak (the 10 in launch-taste's step 7), four rules, each learned from a judged film whose hit frame showed nothing:
D frames the speed on frame p after the start is 4 (p/D)² of the peak (p ≤ D/2), so a 36f move started 12f early is at 44% on the hit; a 4f lean-in is about 5% and reads as a still frame with a headline on it. Code: references/moves.md §1.launch-playbook), lerping the camera's x/y with the zoom; a subject grown in place at the frame edge, with the rest of the frame empty, is not a push.position = focus × (1 − k), references/moves.md §13; on a real camera, keep the look target on the focal and dolly along the line through it). A pull that slides the rows sideways and up is a re-layout, and it drags the world across its own labels.three-type, Layout).The engine's interpolate(frame, [0, 30, 60], [a, b, c], ease) eases each segment, so the camera decelerates to a standstill at frame 30. For any value with three or more keys use glide(keys, values): a monotone cubic through every key that never overshoots and keeps moving through interior keys (two equal values make a deliberate hold).
const kx = glide([0, 45, 96, 150], [0, 0, 120, 120]); // px; holds 0→45 and 96→150
const kz = glide([0, 45, 96, 150], [2.4, 1.02, 1.06, 2.4].map(Math.log));
cam.position.set(kx(frame) * PX, 0, D0 / Math.exp(kz(frame))); // zoom splined in log space
drift(time, amp) with amp 4–7 px × PX at 0.18–0.4 Hz, two incommensurate sines; divide amp by the current zoom so it reads the same everywhere.restDrift(progress, 4 * PX, 2.5 * PX) is exactly zero on the first and last frame. Use it whenever a cut must land on an identical frame (diagram explainers, board erases, any matched handoff), as the whiteboard template does on every scene.1 − push progress.| Handoff | Scene N | Scene N+1 |
|---|---|---|
| Match-push (land) | Push lands ≥10f before the cut at D1 = D0 · elementH / height, drift 0, hold | Fitted camera; element scaled by height / elementH, centred |
| Carry (at speed) | Log-distance falls at constant speed into the last frame: glide(..., 0, -v) | Starts at the same −v: glide(..., -v, 0) and eases to rest |
| Same framing, new subject | Camera parks on a shared pose | Opens on that pose, then moves |
| One-shot film | Each scene file is a window onto one keyed function of film frame | Same keys, its own start frame: nothing to match |
Put the handoff numbers (SCREEN, HANDOFF_ZOOM, CAM_POSE) in components/handoff.ts and import them in both scenes; never retype them. references/moves.md §7–8 have the code, tested so the last frame of N and the first of N+1 match.
A product hero opening on a pull-back, holding on a creep with drift, and handing off with a match-push into the app screen; the shape every camera-led scene takes. Tested end to end (the last frame matches the next scene's first).
import * as THREE from "three";
import type { ThreeSceneContext, ThreeSceneUpdate } from "@genmotion/three-engine";
import { fitCamera, PX } from "../components/stage";
import { inOutCubic, lerp, logLerp, prog, restDrift } from "../components/ease";
import { SCREEN } from "../components/handoff";
export default function buildScene(ctx: ThreeSceneContext): ThreeSceneUpdate {
const { camera, height, durationInFrames: D } = ctx;
const cam = camera as THREE.PerspectiveCamera;
const D0 = fitCamera(cam, height);
// ...build the product, the screen plane at SCREEN, lights (three-look)...
const D1 = D0 * (SCREEN.h / height); // the screen fills the frame height here
return ({ frame, progress }) => {
const open = prog(frame, 0, 48, inOutCubic); // pull-back 1.3x -> 1, 48f
const push = prog(frame, D - 34, 24, inOutCubic); // lands 10f before the cut, holds
const d = restDrift(progress, 5 * PX, 3 * PX);
const alive = 1 - push; // drift dies over the push
const z = push > 0 ? logLerp(D0, D1, push) : logLerp(D0 / 1.3, D0, open);
cam.position.set(lerp(0, SCREEN.x * PX, push) + d.x * alive, lerp(0, SCREEN.y * PX, push) + d.y * alive, z);
cam.lookAt(cam.position.x, cam.position.y, 0);
};
}
Family (direction) | Camera | Default move |
|---|---|---|
| Beat-cut kinetic type | Fitted, still | None; a 1.06 → 1 settle on each card is the type's, not the camera's |
| Soft-light SaaS | Fitted or orthographic | Push 2–2.5× onto the control that matters; creep on holds |
| 3D product hero | Fitted, 30–50° | Slam, orbit 10–30°, rush into the lens at the peak |
| One-shot film | Orthographic or fitted, keyed | Keyed [frame, x, y, zoom] path, 1.5–3 s moves, log zoom |
| Chat-UI social | Fitted | Push through the screen 45f; pull back 52f |
| Whiteboard | Fitted (or orthographic, groups scaled by 1 / PX) | restDrift ±4 / ±2.5 px, zoom +1.2% mid-scene |
| Textured tactile | Subject rig | Tilted glides over a dashboard; hard cut to flat close-ups |
| Music video | Perspective, 48–75° | Shots of 3–4 s on bar lines; fov punch and shake on hits |
| Milestone | Fitted | Creep on the number; punch 1.06 on the land |
| Social title-card launch (K) | Fitted for cards; subject rig for product beats | Cards still (the type moves); product beats a slow push 1.0 → 1.25 on a tilted panel, a lifted control springing to poster scale, a fan or floor for collections |
camera.position.z = 7 breaks in 9:16. Fit, then move in ratios of D0.new THREE.Vector3() per frame): build once, set/copy per frame.hash1(frame).| Need | What | Fallback when it is missing |
|---|---|---|
| Seeing the move | capture-frames at the start, middle and end of each move, and 5 consecutive frames around any interior key | None: a camera move is a frame check |
| Matched cuts | capture-frames on the last frame of N and the first of N+1 | Compare by numbers: both scenes import the same handoff constants |
| Timing and grammar | motion-language | — |
height (no literal camera distances); one scene re-captured in each shipped aspect keeps its subject framed with no edits.capture-frames at 0%, 50% and 100% of every move: the subject is in frame and the right size at all three.validate passes.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
threejs-camera, camera-moves, composition-pixels, easing, camera-rig
Other plugins' skills for the same job
npx claudepluginhub haxzie/genmotion --plugin genmotion35 skills in this plugin
/ad-qaThe pre-ship QA pass for a short-form or social ad, run on captured frames and the exported file: the exact frames to capture, eleven tests with pass criteria and fixes (hook frame, brand timing, mute, safe zones with a drawn overlay, captions, text size and contrast, pacing, CTA and ending, audio and loudness, ad codes, claims), then direction's critique rubric as the ship bar and a short report for the user. Every UGC owner ends here. Load it before telling anyone an ad is finished./ai-presenterPutting a person on screen in an ad when there is no footage: the user's own clip first, or a generated portrait driven by a lipsync model. Covers when not to use a face at all, the lipsync input spec (portrait, audio, neutral mouth), framing and headroom for 9:16, one take length (four seconds), lip-sync tolerance in frames, matching voice to face, the uncanny tells and the edit patterns that hide them, the seek-safe build on each engine, and the line between a synthetic presenter and a fabricated customer. Load it alongside a UGC owner, never instead of one./announce-featureThe 15 to 45 second feature announcement or changelog video, in the manner of Linear, Notion and Slack: what changed, why it matters, show it, where to find it. Covers naming the feature in the first six words, frame-budgeted beat sheets for 15, 20, 30 and 45 seconds with VO word budgets, the cursor, before-and-after and focus-push patterns with house timings, the CTA that points at the toggle, sound per interaction, and recuts for an in-app loop, a changelog embed and a vertical social clip. Load it for one feature or a small set, not a whole-product launch./announce-milestoneFunding rounds, ARR, GitHub stars, user and download counts, acquisitions: one number made to land. Covers what earns a milestone video, the count as the hook from frame 0, a clock that never parks (count capped at 40% of the film, the breath before the land), the subject's own object on the same clock, the 1.06 land punch and confetti, number sizing by width, the gratitude beat with an image, a living end card, the tick-riser-impact sound, and beat sheets for 10, 15, 20 and 30 seconds. Load it when the content is a number going up with no feature to demonstrate./app-store-previewApp Store and Google Play preview videos: up to three 15 to 30 second cuts per locale, each standalone (what it is, the best feature, the payoff). Covers the verified store specs (Apple's 886 x 1920 and 1200 x 1600 sizes, 30 fps cap, H.264 settings, the 5 second poster frame; Play's YouTube link rules), what each store rejects (hands, prices, dates, footage outside the app), muted-first design, native full-screen framing with touch hotspots, frame budgets, export and ffprobe checks. Load it when the ask is a store listing preview, not a general product video./brand-stingThe logo sting, bumper, ident or brand reveal: 2 to 8 seconds, no narration, one mark arriving. Covers the three shapes (build, reveal, transform), the sting energy curve with the hit at 40 to 60 percent, frame budgets for 2, 3, 5 and 8 second stings, mark size and clear space, the landing ease and what may move after lock, house devices with timings, the riser-hit-button-tail sonic logo, loop and overlay variants with an honest note on alpha, and frame-exact checks. Load it for a logo animation, intro or outro bumper, or a stronger closing lockup.