Skip to content

Open source CapCut alternative.

TypeScript

feat(site): read slot reels and typed letters off a reference and set them [rebuild]

David Leb46491e8dcfb
diff --git a/site/packages/effects-kit/src/anim.ts b/site/packages/effects-kit/src/anim.ts
index 8789ce2d..9855d67d 100644
--- a/site/packages/effects-kit/src/anim.ts
+++ b/site/packages/effects-kit/src/anim.ts
@@ -31,6 +31,7 @@ import type { OverlayWords } from "./words";
import { splitScale } from "./stretch";
import { capStreak, ELEMENT_BLUR_MAX } from "./camera";
import { EASE_BEZIER, type EaseId } from "./ease";
+import { SLOT_PITCH, type ReelDirection, type ReelShape } from "./dive";
export type OverlayAnimStyle =
| "fade"
@@ -149,6 +150,21 @@ export interface OverlayEdge {
* falling out of focus. 0 takes a soft style's own blur away. Absent = the
* style's own. */
blur?: number;
+ /** Slot only: which way the reel turns (up brings each character in from
+ * below, down from above). Absent = up. */
+ reel?: ReelDirection;
+ /** Slot only: how far apart the reel's characters sit, em of the type
+ * size. Absent = the style's own, tighter than a line. */
+ pitch?: number;
+ /** Slot only: how far the band the reel shows through reaches either side
+ * of the line's middle, em. Absent = the line itself. */
+ band?: number;
+ /** Slot only: how far, em, the reel runs past each character's slot before
+ * it settles back into it — a reel that lands with a bounce. */
+ overshoot?: number;
+ /** Slot only, with an overshoot: the share of each character's move spent
+ * settling back from the far side, 0..0.6. Absent = 0.3. */
+ settle?: number;
}
export type EdgeOrder = "reading" | "shuffle";
@@ -244,7 +260,8 @@ export const edgeMotion = (slot: OverlayEdge | undefined): MotionPreset | undefi
!(slot.distance! > 0) &&
!slot.ease &&
(slot.fade === undefined || slot.fade === true) &&
- slot.blur === undefined;
+ slot.blur === undefined &&
+ !hasReelShape(slot);
if (!base || plain) return base;
let made = shaped.get(slot);
if (!made) {
@@ -345,9 +362,65 @@ function shapeEdge(base: MotionPreset, slot: OverlayEdge): MotionPreset {
...(preset.animateOut ? { animateOut: reshaped(preset.animateOut) } : {}),
};
}
+ if (preset.animate.roll && (slot.ease || hasReelShape(slot) || slot.fade === false)) {
+ preset = reelEdge(preset, slot);
+ }
return preset;
}
+/** The share of a character's move an overshoot spends settling back, when
+ * the edge names none, and the most it may take. */
+const SETTLE_DEFAULT = 0.3;
+export const EDGE_SETTLE_MAX = 0.6;
+/** The widest a slot reel's pitch, band or overshoot may be set, em. */
+export const EDGE_REEL_EM_MAX = 4;
+/** The style's own pitch in em, at the editor's default line height (render.ts
+ * LINE_HEIGHT): what an overshoot is counted in characters against when the
+ * edge names no pitch. */
+const SLOT_PITCH_EM = SLOT_PITCH * 1.25;
+
+/** Whether an edge sets any part of a slot's reel. */
+const hasReelShape = (slot: OverlayEdge): boolean =>
+ slot.reel !== undefined ||
+ slot.pitch !== undefined ||
+ slot.band !== undefined ||
+ slot.overshoot !== undefined ||
+ slot.settle !== undefined;
+
+/** A slot edge's reel written into its preset: the roll on the edge's curve,
+ * run past the slot and settled back when it overshoots, and the reel's shape
+ * for the renderers to draw it by. */
+function reelEdge(preset: MotionPreset, slot: OverlayEdge): MotionPreset {
+ const keys = preset.animate.roll!;
+ const from = keys[0].v;
+ const curve = slot.ease ? EASE_BEZIER[slot.ease] : keys[0].ease;
+ let roll = keys.map((key, k) => (k < keys.length - 1 && curve ? { ...key, ease: curve } : key));
+ // An overshoot: the reel comes to rest past the slot, then glides back.
+ const past = slot.overshoot! > 0 ? slot.overshoot! / (slot.pitch! > 0 ? slot.pitch! : SLOT_PITCH_EM) : 0;
+ if (past > 0) {
+ const settle = Math.min(EDGE_SETTLE_MAX, Math.max(0.05, slot.settle ?? SETTLE_DEFAULT));
+ roll = [
+ { t: 0, v: from, ...(curve ? { ease: curve } : {}) },
+ { t: 1 - settle, v: -past, ease: EASE_BEZIER["sine.inOut"] },
+ { t: 1, v: 0 },
+ ];
+ }
+ const shape: ReelShape = {
+ ...(slot.reel ? { dir: slot.reel } : {}),
+ ...(slot.pitch! > 0 ? { pitch: slot.pitch } : {}),
+ ...(slot.band! > 0 ? { band: slot.band } : {}),
+ ...(slot.fade === false ? { solid: true } : {}),
+ };
+ // A solid reel is still out of sight before its turn: it shows whole the
+ // moment it starts to roll, not standing still while it waits.
+ const opacity = slot.fade === false ? [{ t: 0, v: 0, ease: EASE_BEZIER.linear }, { t: 0.001, v: 1 }, { t: 1, v: 1 }] : preset.animate.opacity;
+ return {
+ ...preset,
+ animate: { ...preset.animate, roll, ...(opacity ? { opacity } : {}) },
+ ...(Object.keys(shape).length ? { reel: shape } : {}),
+ };
+}
+
export const loopMotion = (slot: OverlayLoop | undefined): MotionPreset | undefined =>
slot ? (slot.preset ?? loopPreset(slot.style)) : undefined;
@@ -578,6 +651,8 @@ export interface GlyphAnimState {
/** Characters its reel still rolls past before it lands (slot); absent or
* 0 = the character alone. `slotReel` says what to draw. */
roll?: number;
+ /** The reel's shape while it rolls, when its edge sets one. */
+ reel?: ReelShape;
/** Defocus, design px; absent = sharp. */
blur?: number;
/** How far a red and a cyan copy pull apart either side, design px; absent
@@ -626,7 +701,8 @@ export function glyphAnimAt(phase: GlyphPhase, index: number, count: number): Gl
if (!preset?.selector) return GLYPH_IDLE;
const n = Math.max(1, count);
const at = (q: number) => asGlyph(evalPreset(preset, q, index, n, exiting, 0, phase.stagger), index, n);
- const g = at(p);
+ const rolled = at(p);
+ const g = rolled.roll && preset.reel ? { ...rolled, reel: preset.reel } : rolled;
const e = phase.exposure ?? 0;
if (!(e > 0)) return g;
// The letter's travel over the part of the exposure inside the ramp,
@@ -666,6 +742,7 @@ export function glyphStateAt(
rotate: ramp.rotate + loop.rotate,
alpha: ramp.alpha * loop.alpha,
...(roll ? { roll } : {}),
+ ...(roll && ramp.reel ? { reel: ramp.reel } : {}),
...(blur ? { blur } : {}),
...(split ? { split } : {}),
...(ramp.streak ? { streak: ramp.streak } : {}),
diff --git a/site/packages/effects-kit/src/dive.test.ts b/site/packages/effects-kit/src/dive.test.ts
index dd45c4e5..fd73bcf9 100644
--- a/site/packages/effects-kit/src/dive.test.ts
+++ b/site/packages/effects-kit/src/dive.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
-import { diveView, DIVE_MAX_SCALE, slotReel, slotSeed } from "./dive";
+import { diveView, DIVE_MAX_SCALE, reelBand, slotReel, slotSeed } from "./dive";
import { evalOverlayAnim } from "./anim";
const frame = { width: 1080, height: 1920, scale: 1 };
@@ -80,3 +80,36 @@ describe("dive", () => {
expect(evalOverlayAnim(inn, 0.999, 3).dive).toBeLessThan(0.01);
});
});
+
+describe("a slot reel's own shape", () => {
+ const seed = slotSeed("2026");
+
+ test("a reel turning down brings the landing character in from above", () => {
+ const up = slotReel("6", 3, 0.5, seed).find((r) => r.ch === "6")!;
+ const down = slotReel("6", 3, 0.5, seed, { dir: "down" }).find((r) => r.ch === "6")!;
+ expect(up.y).toBeGreaterThan(0);
+ expect(down.y).toBeCloseTo(-up.y, 6);
+ });
+
+ test("its characters sit `pitch` em apart, shown through a band `band` em either side", () => {
+ // 1 em is 1/1.2 of a line at line height 1.2.
+ const em = 1 / 1.2;
+ const reel = slotReel("6", 3, 0.25, seed, { pitch: 1.5, band: 1 }, em);
+ const ys = reel.map((r) => r.y).sort((a, b) => a - b);
+ for (let k = 1; k < ys.length; k++) expect(ys[k] - ys[k - 1]).toBeCloseTo(1.5 * em, 6);
+ expect(reelBand({ band: 1 }, em)).toBeCloseTo(em, 6);
+ expect(reelBand(undefined, em)).toBe(0.5);
+ });
+
+ test("a solid reel keeps every character at full strength", () => {
+ for (const r of slotReel("6", 3, 0.4, seed, { solid: true })) expect(r.alpha).toBe(1);
+ expect(slotReel("6", 3, 0.4, seed).some((r) => r.alpha < 1)).toBe(true);
+ });
+
+ test("a reel run past its slot shows the landing character beyond it", () => {
+ const past = slotReel("6", 3, -0.3, seed, { dir: "down", pitch: 1.5 }, 1 / 1.2);
+ const six = past.find((r) => r.ch === "6")!;
+ // Turning down, the overshoot carries it below its slot.
+ expect(six.y).toBeGreaterThan(0);
+ });
+});
diff --git a/site/packages/effects-kit/src/dive.ts b/site/packages/effects-kit/src/dive.ts
index 98e6c2d9..a7948c94 100644
--- a/site/packages/effects-kit/src/dive.ts
+++ b/site/packages/effects-kit/src/dive.ts
@@ -92,27 +92,60 @@ export function diveView(
* line, so the band shows the letters above and below the one in the slot. */
export const SLOT_PITCH = 0.62;
+/** Which way a slot's reel turns: up brings the landing character in from
+ * below, down from above. */
+export type ReelDirection = "up" | "down";
+export const REEL_DIRECTIONS: readonly ReelDirection[] = ["up", "down"];
+
+/** A slot's reel as a reference sets it, each part absent for the style's
+ * own: which way it turns, how far apart its characters sit and how far the
+ * band they show through reaches either side of the line's middle (both in
+ * em of the type size), and whether every character on it stays solid. */
+export interface ReelShape {
+ dir?: ReelDirection;
+ pitch?: number;
+ band?: number;
+ solid?: boolean;
+}
+
+/** The band's reach either side of the line's middle, in line heights:
+ * `em` is one em in line heights (size ÷ line height). The style's own band
+ * is the line itself. */
+export const reelBand = (shape: ReelShape | undefined, em = 1): number =>
+ shape?.band !== undefined ? shape.band * em : 0.5;
+
/** A slot character's reel: what is in sight at `roll`, each at its vertical
* offset in line heights (positive is below) and its own opacity. Letters roll
* through letters of their own case and digits through digits; anything else
* — a space, a mark — holds still. The fillers are a fixed draw per title and
* position (`seed` is `slotSeed` of the title), so each title rolls through
- * its own characters and rolls the same way every time it plays. */
+ * its own characters and rolls the same way every time it plays. A negative
+ * roll is the reel run past its slot, before it settles back. `shape` sets
+ * the reel as a reference does; `em` is one em in line heights. */
export function slotReel(
ch: string,
index: number,
roll: number,
- seed: number
+ seed: number,
+ shape?: ReelShape,
+ em = 1
): { ch: string; y: number; alpha: number }[] {
const pool = reelPool(ch);
- if (!pool || roll <= 0) return [{ ch, y: 0, alpha: 1 }];
- const lo = Math.floor(roll);
+ if (!pool || roll === 0) return [{ ch, y: 0, alpha: 1 }];
+ const pitch = shape?.pitch !== undefined ? shape.pitch * em : SLOT_PITCH;
+ const sign = shape?.dir === "down" ? -1 : 1;
+ // Past the band's edge nothing of the character shows.
+ const reach = (reelBand(shape, em) + 0.4) / pitch;
+ const lo = Math.floor(roll - reach);
const out: { ch: string; y: number; alpha: number }[] = [];
- for (let j = Math.max(0, lo - 1); j <= lo + 2; j++) {
- const y = (roll - j) * SLOT_PITCH;
- // Past the band's edge nothing of the character shows.
- if (Math.abs(y) >= 0.9) continue;
- out.push({ ch: j === 0 ? ch : filler(pool, ch, index, j, seed), y, alpha: 1 - Math.min(1, Math.abs(y)) * 0.7 });
+ for (let j = lo; j <= Math.ceil(roll + reach); j++) {
+ const y = sign * (roll - j) * pitch;
+ if (Math.abs(y) >= reach * pitch) continue;
+ // The landing character ends the reel: nothing follows it, even while
+ // the reel runs past its slot.
+ if (j < 0) continue;
+ const alpha = shape?.solid ? 1 : 1 - Math.min(1, Math.abs(y)) * 0.7;
+ out.push({ ch: j === 0 ? ch : filler(pool, ch, index, j, seed), y, alpha });
}
return out;
}
diff --git a/site/packages/effects-kit/src/edgeShape.test.ts b/site/packages/effects-kit/src/edgeShape.test.ts
index 13222955..9c6b98fe 100644
--- a/site/packages/effects-kit/src/edgeShape.test.ts
+++ b/site/packages/effects-kit/src/edgeShape.test.ts
@@ -253,3 +253,35 @@ describe("an order's own timing", () => {
expect(firstShow({ ...edge, orderAt: undefined }, order[1])).toBeCloseTo(0.5, 1);
});
});
+
+describe("a slot edge's reel", () => {
+ const SLOT_TEXT = "2026";
+ const roll = (edge: OverlayEdge, t: number, i = 0) => glyphStateAt(evalOverlayAnim({ in: edge }, t, 6, true), i, 4).roll ?? 0;
+
+ test("the edge's ease shapes the roll", () => {
+ const own: OverlayEdge = { style: "slot", seconds: 1, stagger: 0 };
+ const linear: OverlayEdge = { ...own, ease: "linear" };
+ expect(roll(linear, 0.5)).toBeCloseTo(2.5, 1);
+ expect(Math.abs(roll(own, 0.5) - roll(linear, 0.5))).toBeGreaterThan(0.3);
+ });
+
+ test("an overshoot runs the reel past its slot, then settles it back", () => {
+ const edge: OverlayEdge = { style: "slot", seconds: 1, stagger: 0, overshoot: 0.6, pitch: 1.5, settle: 0.3 };
+ // 0.6 em past at a 1.5 em pitch is 0.4 of a character, at 70% of the move.
+ expect(roll(edge, 0.7)).toBeCloseTo(-0.4, 2);
+ expect(roll(edge, 0.999)).toBeCloseTo(0, 1);
+ expect(roll(edge, 0.3)).toBeGreaterThan(0);
+ });
+
+ test("its direction, spacing, band and solidity reach every renderer through the glyph", () => {
+ const edge: OverlayEdge = { style: "slot", seconds: 1, stagger: 0, reel: "down", pitch: 1.5, band: 1, fade: false };
+ const g = glyphStateAt(evalOverlayAnim({ in: edge }, 0.3, 6, true), 0, SLOT_TEXT.length);
+ expect(g.reel).toEqual({ dir: "down", pitch: 1.5, band: 1, solid: true });
+ // Solid, a digit waiting its turn is out of sight, not a still reel.
+ const waiting = glyphStateAt(evalOverlayAnim({ in: { ...edge, stagger: 0.8 } }, 0.05, 6, true), 3, SLOT_TEXT.length);
+ expect(waiting.alpha).toBe(0);
+ // Without any of them the glyph carries no shape, and the reel is the style's own.
+ const plain = glyphStateAt(evalOverlayAnim({ in: { style: "slot", seconds: 1 } }, 0.3, 6, true), 0, 4);
+ expect(plain.reel).toBeUndefined();
+ });
+});
diff --git a/site/packages/effects-kit/src/motion/types.ts b/site/packages/effects-kit/src/motion/types.ts
index 9c494dc8..99f2ef27 100644
--- a/site/packages/effects-kit/src/motion/types.ts
+++ b/site/packages/effects-kit/src/motion/types.ts
@@ -17,6 +17,8 @@
/** Cubic bezier timing handles, [x1, y1, x2, y2], the curve running [0,0] to
* [1,1] — the same shape Lottie's `o`/`i` handles and CSS cubic-bezier take.
* Absent = linear. */
+import type { ReelShape } from "../dive";
+
export type Easing = [number, number, number, number];
/**
@@ -150,6 +152,9 @@ export interface MotionPreset {
animate: MotionProperties;
/** An exit that is not simply the entry played backwards. */
animateOut?: MotionProperties;
+ /** A slot's reel as an edge sets it (see `ReelShape`); absent = the
+ * style's own. */
+ reel?: ReelShape;
}
export interface MotionCatalog {
diff --git a/site/packages/effects-kit/src/render.ts b/site/packages/effects-kit/src/render.ts
index c4a966ef..daa8a78e 100644
--- a/site/packages/effects-kit/src/render.ts
+++ b/site/packages/effects-kit/src/render.ts
@@ -27,7 +27,7 @@ import {
type GlyphPhase,
type OverlayAnim,
} from "./anim";
-import { diveView, slotReel, slotSeed, type DiveFocus, type DiveView } from "./dive";
+import { diveView, reelBand, slotReel, slotSeed, type DiveFocus, type DiveView } from "./dive";
import { cutAtFaces, cycleFaceTag, fontCycleCuts, fontCycleVariants, withFontCycle } from "./fontCycle";
import { evalWhole, presetExtent } from "./motion/evaluate";
import { countStep, countText } from "./count";
@@ -974,13 +974,16 @@ async function paintText(
drawTinted(ch, off, drop, SPLIT_CYAN);
}
if (g.roll) {
- // A rolling reel shows through its own line band only; sideways
- // it stays open, so a wide filler is not cut to the slot.
+ // A rolling reel shows through its own band only — the line, or
+ // the band its edge sets; sideways it stays open, so a wide
+ // filler is not cut to the slot.
+ const em = fpx / lineH;
+ const band = reelBand(g.reel, em) * lineH;
ctx.beginPath();
- ctx.rect(-w * 3, -lineH / 2, w * 6, lineH);
+ ctx.rect(-w * 3, -band, w * 6, band * 2);
ctx.clip();
const a = ctx.globalAlpha;
- for (const r of slotReel(ch, gi - 1, g.roll, slotSeed(overlay.text))) {
+ for (const r of slotReel(ch, gi - 1, g.roll, slotSeed(overlay.text), g.reel, em)) {
ctx.globalAlpha = a * r.alpha;
drawText(r.ch, 0, r.y * lineH + drop);
}
@@ -2066,7 +2069,13 @@ export async function renderOverlayFrames(
accent && (overlay.kind ?? "text") === "text"
? wordReach(accent) * (overlay as TextOverlay).size * scale
: 0;
- const travel = (edgeTravel + loop.travel + move.travel) * scale + wordTravel;
+ // A slot reel set to show through a band wider than its line reaches past
+ // the line by up to that band, em of the type's own size.
+ const reelTravel =
+ (overlay.kind ?? "text") === "text"
+ ? Math.max(0, ...edges.map((p) => p.reel?.band ?? 0)) * (overlay as TextOverlay).size * scale
+ : 0;
+ const travel = (edgeTravel + loop.travel + move.travel) * scale + wordTravel + reelTravel;
// A keyframed element carries its own travel and its own zoom: the region
// spans every pose the track visits, at the largest scale it reaches.
const keyed = hasOverlayKeys(overlay);
diff --git a/site/src/cut/components/AiPanel.tools.ts b/site/src/cut/components/AiPanel.tools.ts
index 755030a9..ad3f8b50 100644
--- a/site/src/cut/components/AiPanel.tools.ts
+++ b/site/src/cut/components/AiPanel.tools.ts
@@ -301,7 +301,7 @@ export const AI_PANEL_TOOLS = [
{
name: "track_element",
description:
- `Measure where an element of a source's picture sits, frame by frame, and how it moves, so a grow, a slide or a pop is keyed with set_overlay_keyframes to the reference's own numbers. Give a stretch of a video (SOURCE seconds) and a \`seed\` box on the element at \`from\`; boxes in and out are x/y centre and w/h size as frame fractions — what add_shape, add_title and the keys take. The element is found by colour: \`color\` (sample_color reads it), or else the seed's median colour on the first frame, so draw the seed inside the element's edges at a moment it is on screen. \`match\` shape follows the one connected piece of that colour the seed sits on — a card, a bar, a sticker — as it moves and changes size; ink takes every pixel of that colour inside the seed (or \`within\`), the ink of a line of type whose letters are separate pieces: its centre is where the title sits and its height is about 0.7 of the font size when the line is capitals. letters reads a line of type coming in letter by letter — a drop, a rise, a fall out of focus: give \`text\` (the words as they read), \`to\` a moment just after the last letter lands, \`from\` before the first one shows, and a seed close around the landed line; it returns each letter's timing (shows, starts, lands, alpha, soft — the defocus it shows in at) and \`entrance\`, the whole entrance as set_overlay_animation takes it, plus \`crosses\`, other ink the letters pass in front of or behind, which says which lane goes in front. Leave out \`to\` to measure one frame. \`moves\` lists each move of x, y, w and h with from/to (the source seconds it starts and lands), start/end values, the ease that fits it (${EASE_IDS.join(", ")}) and \`error\`, the RMS miss as a share of the move: under 0.03 is that curve, over 0.1 none fits and the move keys from \`path\` point by point. A size move keys as scale: w over the element's resting w. \`path\` lists the box wherever it changes (a hold is one entry); a null box is a frame where the element was not found. Up to ${TRACK_FRAMES_MAX} frames a call; when \`truncated\`, continue from \`coveredTo\`. Works on a still image too (one frame).`,
+ `Measure where an element of a source's picture sits, frame by frame, and how it moves, so a grow, a slide or a pop is keyed with set_overlay_keyframes to the reference's own numbers. Give a stretch of a video (SOURCE seconds) and a \`seed\` box on the element at \`from\`; boxes in and out are x/y centre and w/h size as frame fractions — what add_shape, add_title and the keys take. The element is found by colour: \`color\` (sample_color reads it), or else the seed's median colour on the first frame, so draw the seed inside the element's edges at a moment it is on screen. \`match\` shape follows the one connected piece of that colour the seed sits on — a card, a bar, a sticker — as it moves and changes size; ink takes every pixel of that colour inside the seed (or \`within\`), the ink of a line of type whose letters are separate pieces: its centre is where the title sits and its height is about 0.7 of the font size when the line is capitals. letters reads a line of type coming in letter by letter — a drop, a rise, a fall out of focus, digits rolling in on a slot reel, letters popping in where they stand: give \`text\` (the words as they read), \`to\` a moment just after the last letter lands, \`from\` before the first one shows, and a seed close around the landed line; it returns each letter's timing (shows, starts, lands, alpha, soft — the defocus it shows in at) and \`entrance\`, the whole entrance as set_overlay_animation takes it — a reel comes back as in_style slot with its turn, spacing, band and landing bounce, letters that appear without moving as a typewriter — plus \`crosses\`, other ink the letters pass in front of or behind, which says which lane goes in front. Leave out \`to\` to measure one frame. \`moves\` lists each move of x, y, w and h with from/to (the source seconds it starts and lands), start/end values, the ease that fits it (${EASE_IDS.join(", ")}) and \`error\`, the RMS miss as a share of the move: under 0.03 is that curve, over 0.1 none fits and the move keys from \`path\` point by point. A size move keys as scale: w over the element's resting w. \`path\` lists the box wherever it changes (a hold is one entry); a null box is a frame where the element was not found. Up to ${TRACK_FRAMES_MAX} frames a call; when \`truncated\`, continue from \`coveredTo\`. Works on a still image too (one frame).`,
inputSchema: obj(
{
asset_id: str("Project asset id (video or image)"),
@@ -316,7 +316,7 @@ export const AI_PANEL_TOOLS = [
type: "string",
enum: [...TRACK_MATCHES],
description:
- "shape: the one connected piece the seed sits on (default). ink: every pixel of the colour inside the seed or within — type. letters: a line of type coming in letter by letter, read as one per-letter entrance (needs text and to)",
+ "shape: the one connected piece the seed sits on (default). ink: every pixel of the colour inside the seed or within — type. letters: a line of type coming in letter by letter — moving, rolling on a slot reel or typed — read as one entrance (needs text and to)",
},
picture: pictureArg,
},
diff --git a/site/src/cut/components/AnimationTiles.tools.ts b/site/src/cut/components/AnimationTiles.tools.ts
index 1152d9ba..86c182aa 100644
--- a/site/src/cut/components/AnimationTiles.tools.ts
+++ b/site/src/cut/components/AnimationTiles.tools.ts
@@ -31,6 +31,9 @@ import {
EDGE_BLUR_MAX,
EDGE_DISTANCE_MAX,
EDGE_ORDERS,
+ EDGE_REEL_EM_MAX,
+ EDGE_SETTLE_MAX,
+ REEL_DIRECTIONS,
edgeMaxSeconds,
OVERLAY_ANIM_MIN_SECONDS,
GLYPH_ANIM_STYLE_IDS,
@@ -77,7 +80,7 @@ export const OVERLAY_ANIMATION_TOOLS = [
{
name: "set_overlay_animation",
description:
- `Animate an overlay element (title, shape, or sticker): preset In/Out ramps, a Loop that runs its whole duration, and a Move that says what the element does WHILE it holds. Omitted slots keep their setting; pass "none" to clear one. In/Out styles: ${OVERLAY_ANIM_STYLE_IDS.join(", ")} — slide names are the motion direction; ${TEXT_ONLY_ANIM_STYLE_IDS.join(", ")} animate titles only; ${GLYPH_ANIM_STYLE_IDS.join(", ")} move a title's letters one at a time, and move any other kind as one piece; in_stagger/out_stagger set how much of their ramp the hand-off from the first letter to the last takes, so a 1.6s drop at stagger 0.8 lands a letter every ~0.27s, each moving for ~0.3s. in_order/out_order "shuffle" deals the letters their turns in a scattered order instead of left to right — letters landing at random; in_sequence names the exact order when it is read off a reference. in_ease sets the curve the move travels on, in_fade false keeps letters solid while they fall, and in_blur starts each letter out of focus (design px) to sharpen as it lands. in_distance/out_distance set how far the motion travels from rest, design px. A reference's letters coming in are read in one call, never by eye: track_element match letters with the line's words over the stretch they come in returns \`entrance\`, every one of these settings as it goes in (in_style, in_seconds, in_stagger, in_sequence, in_sequence_at — each letter's own turn — in_distance, in_ease, in_fade — false, a share of the move, or true — and in_blur) and the source second the ramp starts — one letter's move is in_seconds × (1 − in_stagger). A per-letter ramp on an element with update_overlay motion_blur streaks each letter along its own move, the smear a fast fall wears — a different look from a soft start. ${edgeNotes()} ${DIVE_ANIM_STYLE_IDS.join(", ")} as the exit is the zoom-through-a-letter transition: the shot after the element shows once the ink has filled the frame, so it needs no freeze frames, image stills or per-letter keyframes. Loop styles: ${OVERLAY_LOOP_STYLE_IDS.join(", ")} — ${GLYPH_LOOP_STYLE_IDS.join(", ")} carry a title's letters on their own delays, and carry any other kind as one piece. A move is a slot like the others and never touches the element's keyframe track; set_overlay_keyframes is the precise way to move an element and the default reach, so name a move when it is exactly what you mean — the two compose together. Word effects — words_style, titles only — play the line word by word, timed against the cut's transcript when there is one and spread across the element's own span when there is not: an emphasis travels along a line that is fully up, and a build assembles the line as it is spoken. It is the slot for "make each word pop as I say it" and for "have the words appear one by one". A typewriter entrance on a title can carry a caret: a thin bar at the end of the typed text, solid while it types, then blinking every ${CARET_BLINK_SECONDS}s — the typed comment or search box of a call-to-action card. A hit plays one motion once at a moment inside the element (hit_at seconds from its start), between its entrance and exit: ${hitNotes()}. Use press for a button being pressed, a tap on a UI element, a like or post button; pair it with a click from stock_search kind "sound" placed at the same moment when the tap should be heard. A font cycle flickers a title through typefaces — a new face font_cycle_rate times a second, from font_cycle_at for font_cycle_seconds — and then the title settles back into its own face: the typeface-shuffle beat of a teaser title. Give each face a scale (and tracking) so it fills about the room the title's own face does; a wide tracked title cycling through condensed or hand-drawn faces wants tracking 0 and a scale above 1 on them. A face keeps the title's own line breaks: where its scale makes a line wider than the room the title wraps in, that face is set smaller to fit rather than broken onto another line. Time the faces to the music with font_cycle_beats — a new face on each beat of that clip's detect_beats grid, font_cycle_beat_step 2 for every other beat or 0.5 for half beats — or to a reference's own face changes with font_cycle_switches, the timeline seconds you read them at; either sets every hold and repeats the faces in order to fill the run. A face's own hold times one face by hand; faces repeat in the list to revisit a typeface.`,
+ `Animate an overlay element (title, shape, or sticker): preset In/Out ramps, a Loop that runs its whole duration, and a Move that says what the element does WHILE it holds. Omitted slots keep their setting; pass "none" to clear one. In/Out styles: ${OVERLAY_ANIM_STYLE_IDS.join(", ")} — slide names are the motion direction; ${TEXT_ONLY_ANIM_STYLE_IDS.join(", ")} animate titles only; ${GLYPH_ANIM_STYLE_IDS.join(", ")} move a title's letters one at a time, and move any other kind as one piece; in_stagger/out_stagger set how much of their ramp the hand-off from the first letter to the last takes, so a 1.6s drop at stagger 0.8 lands a letter every ~0.27s, each moving for ~0.3s. in_order/out_order "shuffle" deals the letters their turns in a scattered order instead of left to right — letters landing at random; in_sequence names the exact order when it is read off a reference. in_ease sets the curve the move travels on, in_fade false keeps letters solid while they fall, and in_blur starts each letter out of focus (design px) to sharpen as it lands. in_distance/out_distance set how far the motion travels from rest, design px. A slot entrance's reel takes its shape off the reference too: in_reel (the way it turns), in_reel_pitch (how far apart its characters sit), in_reel_band (how far it shows above and below the line), in_overshoot and in_settle (a landing that runs past its slot and settles back), and in_fade false keeps every character on it solid. A reference's letters coming in are read in one call, never by eye: track_element match letters with the line's words over the stretch they come in returns \`entrance\`, every one of these settings as it goes in (in_style, in_seconds, in_stagger, in_sequence, in_sequence_at — each letter's own turn — in_distance, in_ease, in_fade — false, a share of the move, or true — and in_blur; for a slot reel its in_reel settings, for letters typed in place a typewriter's in_seconds) and the source second the ramp starts — one letter's move is in_seconds × (1 − in_stagger). A per-letter ramp on an element with update_overlay motion_blur streaks each letter along its own move, the smear a fast fall wears — a different look from a soft start. ${edgeNotes()} ${DIVE_ANIM_STYLE_IDS.join(", ")} as the exit is the zoom-through-a-letter transition: the shot after the element shows once the ink has filled the frame, so it needs no freeze frames, image stills or per-letter keyframes. Loop styles: ${OVERLAY_LOOP_STYLE_IDS.join(", ")} — ${GLYPH_LOOP_STYLE_IDS.join(", ")} carry a title's letters on their own delays, and carry any other kind as one piece. A move is a slot like the others and never touches the element's keyframe track; set_overlay_keyframes is the precise way to move an element and the default reach, so name a move when it is exactly what you mean — the two compose together. Word effects — words_style, titles only — play the line word by word, timed against the cut's transcript when there is one and spread across the element's own span when there is not: an emphasis travels along a line that is fully up, and a build assembles the line as it is spoken. It is the slot for "make each word pop as I say it" and for "have the words appear one by one". A typewriter entrance on a title can carry a caret: a thin bar at the end of the typed text, solid while it types, then blinking every ${CARET_BLINK_SECONDS}s — the typed comment or search box of a call-to-action card. A hit plays one motion once at a moment inside the element (hit_at seconds from its start), between its entrance and exit: ${hitNotes()}. Use press for a button being pressed, a tap on a UI element, a like or post button; pair it with a click from stock_search kind "sound" placed at the same moment when the tap should be heard. A font cycle flickers a title through typefaces — a new face font_cycle_rate times a second, from font_cycle_at for font_cycle_seconds — and then the title settles back into its own face: the typeface-shuffle beat of a teaser title. Give each face a scale (and tracking) so it fills about the room the title's own face does; a wide tracked title cycling through condensed or hand-drawn faces wants tracking 0 and a scale above 1 on them. A face keeps the title's own line breaks: where its scale makes a line wider than the room the title wraps in, that face is set smaller to fit rather than broken onto another line. Time the faces to the music with font_cycle_beats — a new face on each beat of that clip's detect_beats grid, font_cycle_beat_step 2 for every other beat or 0.5 for half beats — or to a reference's own face changes with font_cycle_switches, the timeline seconds you read them at; either sets every hold and repeats the faces in order to fill the run. A face's own hold times one face by hand; faces repeat in the list to revisit a typeface.`,
inputSchema: obj({
id: str("Overlay element id"),
move: {
@@ -141,6 +144,16 @@ export const OVERLAY_ANIMATION_TOOLS = [
out_blur: num(`Exit: how soft it ends, design px; 0 keeps it sharp, -1 restores the style's own`),
in_distance: num(`Entrance: how far the motion travels from rest at its far end, design px at 1080, 1..${EDGE_DISTANCE_MAX}; 0 restores the style's own reach`),
out_distance: num(`Exit: the same reach for the exit ramp, design px; 0 restores the style's own`),
+ in_reel: {
+ type: "string",
+ enum: [...REEL_DIRECTIONS, "style"],
+ description:
+ 'Slot entrance: which way the reel turns — "up" brings each character in from below, "down" from above (a landing letter that arrives from above, whatever a fast spin seems to do between frames); "style" restores the style\'s own (up). track_element match letters reads it',
+ },
+ in_reel_pitch: num(`Slot entrance: how far apart the reel's characters sit, design px at 1080 (kept in em of the title's size, up to ${EDGE_REEL_EM_MAX} em); 0 restores the style's own, tighter than a line`),
+ in_reel_band: num(`Slot entrance: how far the band the reel shows through reaches above and below the line's middle, design px; 0 restores the style's own (the line itself)`),
+ in_overshoot: num("Slot entrance: how far, design px, each character's reel runs past its slot before it settles back — a landing bounce; 0 clears it"),
+ in_settle: num(`Slot entrance with an overshoot: the share of each character's move spent settling back, 0.05..${EDGE_SETTLE_MAX} (default 0.3)`),
loop_style: {
type: "string",
enum: [...OVERLAY_LOOP_STYLE_IDS, "none"],
diff --git a/site/src/cut/components/Inspector.tsx b/site/src/cut/components/Inspector.tsx
index f4a5df9c..9a636019 100644
--- a/site/src/cut/components/Inspector.tsx
+++ b/site/src/cut/components/Inspector.tsx
@@ -57,6 +57,12 @@ import {
EDGE_STAGGER_MAX,
EDGE_BLUR_MAX,
EDGE_DISTANCE_MAX,
+ EDGE_REEL_EM_MAX,
+ EDGE_SETTLE_MAX,
+ LINE_HEIGHT,
+ REEL_DIRECTIONS,
+ SLOT_PITCH,
+ type ReelDirection,
EASE_IDS,
type EaseId,
edgeOwnReach,
@@ -3690,6 +3696,17 @@ function AnimationToolbar({ overlay: o, slot, peers }: { overlay: Overlay; slot:
ck.begin();
writeOverlayAnim(o, anim, { [slot]: { ...edge, ...patch } }, peers);
};
+ // A slot on a title: its reel's turn, spacing, window and landing, shown in
+ // design px of the title's size (the edge keeps them in em).
+ const rolls = isTextOverlay(o) && !!edgeMotion(edge)?.animate.roll;
+ const typeSize = isTextOverlay(o) ? o.size : 0;
+ const lineEm = (isTextOverlay(o) ? o.lineHeight : undefined) ?? LINE_HEIGHT;
+ const edgeReel: ReelDirection = edge?.reel ?? "up";
+ const edgeReelPitch = (edge?.pitch ?? SLOT_PITCH * lineEm) * typeSize;
+ const edgeReelBand = (edge?.band ?? lineEm / 2) * typeSize;
+ const edgeOvershoot = (edge?.overshoot ?? 0) * typeSize;
+ const edgeSettle = edge?.settle ?? 0.3;
+ const reelItems: Record<ReelDirection, string> = { up: t("reelUp"), down: t("reelDown") };
return bar(
<>
<Row label={t("duration")}>
@@ -3834,6 +3851,76 @@ function AnimationToolbar({ overlay: o, slot, peers }: { overlay: Overlay; slot:
/>
</Row>
)}
+ {rolls && (
+ <Row label={t("reel")}>
+ <Select
+ value={edgeReel}
+ items={reelItems}
+ onValueChange={(id) => {
+ writeEdge({ reel: id as ReelDirection });
+ ck.end();
+ }}
+ >
+ <SelectTrigger className="h-8 w-36 text-[12px]">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {REEL_DIRECTIONS.map((id) => (
+ <SelectItem key={id} value={id} className="text-[12px]">
+ {reelItems[id]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Row>
+ )}
+ {rolls &&
+ (
+ [
+ ["reelPitch", edgeReelPitch, "pitch", 0.2],
+ ["reelBand", edgeReelBand, "band", 0.2],
+ ["overshoot", edgeOvershoot, "overshoot", 0],
+ ] as const
+ ).map(([label, value, field, minEm]) => (
+ <Row key={field} label={t(label)}>
+ <ValueSlider
+ label={t(label)}
+ sliderClassName="data-horizontal:w-24"
+ valueClassName="w-9 text-muted-foreground"
+ value={value}
+ min={minEm * typeSize}
+ max={EDGE_REEL_EM_MAX * typeSize}
+ step={1}
+ format={(v) => String(Math.round(v))}
+ parse={(t) => Number(t)}
+ onDraft={(v) => writeEdge({ [field]: v > 0 ? v / typeSize : undefined })}
+ onCommit={(v) => {
+ writeEdge({ [field]: v > 0 ? v / typeSize : undefined });
+ ck.end();
+ }}
+ />
+ </Row>
+ ))}
+ {rolls && edgeOvershoot > 0 && (
+ <Row label={t("settle")}>
+ <ValueSlider
+ label={t("settle")}
+ sliderClassName="data-horizontal:w-24"
+ valueClassName="w-9 text-muted-foreground"
+ value={edgeSettle}
+ min={0.05}
+ max={EDGE_SETTLE_MAX}
+ step={0.01}
+ format={(v) => `${Math.round(v * 100)}%`}
+ parse={(t) => Number(t.replace("%", "")) / 100}
+ onDraft={(v) => writeEdge({ settle: v })}
+ onCommit={(v) => {
+ writeEdge({ settle: v });
+ ck.end();
+ }}
+ />
+ </Row>
+ )}
{edge && (
<Row label={t("blur")}>
<ValueSlider
diff --git a/site/src/cut/components/OverlayLayer.tsx b/site/src/cut/components/OverlayLayer.tsx
index 24b096de..129bd5b2 100644
--- a/site/src/cut/components/OverlayLayer.tsx
+++ b/site/src/cut/components/OverlayLayer.tsx
@@ -30,7 +30,7 @@ import { elementCameraAt } from "@/cut/lib/groupCamera";
import { cameraPoint, worldPoint } from "@donkeycut/effects-kit";
import { TILT_PERSPECTIVE } from "@donkeycut/effects-kit";
import { CARET_GAP_EM, CARET_HEIGHT_EM, CARET_WIDTH_EM, typeCaret } from "@donkeycut/effects-kit";
-import { diveView, evalOverlayFrame, glyphStateAt, measureDiveFocus, paintElementInto, slotReel, slotSeed, hasGlyphMotion, hasMaskKeys, hasOverlayKeys, isOverlayAnimated, lineLikeShape, MASK_FEATHER_MAX, MASK_RADIUS_MAX, maskFrameAt, maskHasRadius, maskInverts, maskOutlinePathD, maskSizeAxes, overlayWords, paintMaskCoverage, PEN_MIN_POINTS, penClosed, resolveShadow, shapeMetrics, shapePathD, WORD_ACCENT_DEFAULT, wordDrawsAt, type LottieHandle, type Mask, type MaskKey, type DiveFocus, type MaskPoint, type OverlayFrameState, type WordDraw } from "@donkeycut/effects-kit";
+import { diveView, evalOverlayFrame, glyphStateAt, measureDiveFocus, paintElementInto, reelBand, slotReel, slotSeed, hasGlyphMotion, hasMaskKeys, hasOverlayKeys, isOverlayAnimated, lineLikeShape, MASK_FEATHER_MAX, MASK_RADIUS_MAX, maskFrameAt, maskHasRadius, maskInverts, maskOutlinePathD, maskSizeAxes, overlayWords, paintMaskCoverage, PEN_MIN_POINTS, penClosed, resolveShadow, shapeMetrics, shapePathD, WORD_ACCENT_DEFAULT, wordDrawsAt, type LottieHandle, type Mask, type MaskKey, type DiveFocus, type MaskPoint, type OverlayFrameState, type WordDraw } from "@donkeycut/effects-kit";
import {
LINE_HEIGHT,
PLATE_PAD_X,
@@ -1424,6 +1424,7 @@ function OverlayItem({
tail={caretBar}
texture={texture}
typed={typed}
+ em={1 / ((isTextOverlay(o) ? o.lineHeight : undefined) ?? LINE_HEIGHT)}
/>
) : wordDraw ? (
<WordText
@@ -1594,6 +1595,7 @@ function GlyphText({
tail,
texture,
typed,
+ em = 1 / LINE_HEIGHT,
}: {
text: string;
phase: Parameters<typeof glyphStateAt>[0];
@@ -1609,6 +1611,9 @@ function GlyphText({
texture?: TextTexture;
/** Characters a typewriter has typed; the rest hold their room unseen. */
typed?: number;
+ /** One em of the type in line heights: a slot reel's pitch and band are
+ * set in em. */
+ em?: number;
}) {
const total = Math.max(1, [...text].length);
const lines = text.split("\n");
@@ -1622,9 +1627,11 @@ function GlyphText({
const i = gi++;
const g = glyphStateAt(phase, i, total);
const unseen = typed !== undefined && i >= typed;
- // A slot character shows its reel through its own line band; the
- // band clips top and bottom only, so a wide filler is not cut.
- const reel = g.roll ? slotReel(ch, i, g.roll, seed) : null;
+ // A slot character shows its reel through its own line band, or the
+ // band its edge sets; the band clips top and bottom only, so a wide
+ // filler is not cut.
+ const reel = g.roll ? slotReel(ch, i, g.roll, seed, g.reel, em) : null;
+ const bandInset = reel && g.reel?.band !== undefined ? (0.5 - reelBand(g.reel, em)) * 100 : null;
// A letter sharpening out of a blur wears its own defocus.
const blur = g.blur ? (g.blur * scale) / zoom : 0;
// A splitting letter shows a red and a cyan copy either side.
@@ -1661,7 +1668,9 @@ function GlyphText({
`translate(${g.dx * scale}px, ${g.dy * scale}px)` +
` rotate(${g.rotate}deg) scale(${g.sx}, ${g.sy})`,
...(reel
- ? { position: "relative", overflowX: "visible", overflowY: "clip", verticalAlign: "top" }
+ ? bandInset !== null
+ ? { position: "relative", clipPath: `inset(${bandInset.toFixed(2)}% -1000%)`, verticalAlign: "top" }
+ : { position: "relative", overflowX: "visible", overflowY: "clip", verticalAlign: "top" }
: {}),
...(texture && ch !== " " ? textureMask(texture) : {}),
}}
diff --git a/site/src/cut/components/inspectorToolFields.test.ts b/site/src/cut/components/inspectorToolFields.test.ts
index b943567e..40d2dfac 100644
--- a/site/src/cut/components/inspectorToolFields.test.ts
+++ b/site/src/cut/components/inspectorToolFields.test.ts
@@ -117,6 +117,11 @@ const PANEL_NAME: Record<string, string> = {
in_distance: "edgeDistance",
out_distance: "edgeDistance",
in_blur: "edgeBlur",
+ in_reel: "edgeReel",
+ in_reel_pitch: "edgeReelPitch",
+ in_reel_band: "edgeReelBand",
+ in_overshoot: "edgeOvershoot",
+ in_settle: "edgeSettle",
in_sequence_at: "edgeSequence",
out_sequence_at: "edgeSequence",
out_blur: "edgeBlur",
diff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.ts
index 6920c0b1..aba91f48 100644
--- a/site/src/cut/lib/aiTools.ts
+++ b/site/src/cut/lib/aiTools.ts
@@ -67,6 +67,10 @@ import {
EDGE_BLUR_MAX,
EDGE_DISTANCE_MAX,
EDGE_ORDERS,
+ EDGE_REEL_EM_MAX,
+ EDGE_SETTLE_MAX,
+ REEL_DIRECTIONS,
+ type ReelDirection,
EASE_IDS,
type EaseId,
type EdgeOrder,
@@ -689,7 +693,36 @@ async function trackLettersResult(
...(l.soft !== null ? { soft: Math.round(l.soft) } : {}),
...(l.error !== null ? { error: Math.round(l.error * 1000) / 1000 } : {}),
})),
- ...(e && start !== undefined
+ ...(e && start !== undefined && e.reel
+ ? {
+ entrance: {
+ starts: roundT(start),
+ in_style: "slot",
+ in_seconds: r2(e.seconds),
+ in_stagger: r2(Math.min(0.95, e.stagger)),
+ in_sequence: e.sequence,
+ in_sequence_at: e.sequenceAt.map((v) => Math.round(v * 1000) / 1000),
+ in_reel: e.reel.dir,
+ in_reel_pitch: Math.round(e.reel.pitch),
+ in_reel_band: Math.round(e.reel.band),
+ in_overshoot: Math.round(e.reel.overshoot),
+ ...(e.reel.settle !== null ? { in_settle: r2(e.reel.settle) } : {}),
+ in_fade: e.fade,
+ },
+ entranceNote:
+ "The letters roll in on a slot reel, read off every frame: the way it turns (from how each letter arrives at its slot — a fast spin aliases between frames, so trust this over a contact sheet), how far apart its characters sit and how far the band reaches either side of the line's middle (design px), how far each letter lands past its slot and how long it takes settling back, the order and hand-off. Set the title's size first (the lengths are kept in em of it), begin it on the timeline second `starts` maps to, and pass these to set_overlay_animation as they are.",
+ }
+ : e && start !== undefined && e.typed
+ ? {
+ entrance: {
+ starts: roundT(start),
+ in_style: "typewriter",
+ in_seconds: r2(e.seconds),
+ },
+ entranceNote:
+ "The letters appear where they stand, one at a time, without moving: typed. A typewriter shows each character (spaces included) once its share of in_seconds has passed, so with the title beginning on the timeline second `starts` maps to, each letter lands on the frame the reference shows it. Compare the letters' `shows` with that spacing: a turn far off it is a beat the typing holds, which a typewriter cannot — split the title there.",
+ }
+ : e && start !== undefined
? {
entrance: {
starts: roundT(start),
@@ -1189,6 +1222,36 @@ const toolRuns: Record<BrowserToolName, ToolRun> = {
delete rest.blur;
anim[slot] = blur < 0 ? rest : { ...rest, blur: clamp(blur, 0, EDGE_BLUR_MAX) };
}
+ // A slot's reel as a reference sets it. Lengths come in design px, as
+ // track_element reads them, and are kept in em of the title's size so
+ // they follow it when it is resized; 0 (or "style") hands each back.
+ const reel = input[`${slot}_reel`];
+ if (typeof reel === "string" && anim[slot]) {
+ if (reel !== "style" && !(REEL_DIRECTIONS as readonly string[]).includes(reel))
+ throw new ToolError(`Unknown ${slot}_reel: ${reel}. Use one of: ${REEL_DIRECTIONS.join(", ")}, or "style".`);
+ const rest = { ...anim[slot]! };
+ delete rest.reel;
+ anim[slot] = reel === "style" ? rest : { ...rest, reel: reel as ReelDirection };
+ }
+ const size = (o.kind ?? "text") === "text" ? (o as { size?: number }).size ?? 0 : 0;
+ for (const [key, field] of [
+ [`${slot}_reel_pitch`, "pitch"],
+ [`${slot}_reel_band`, "band"],
+ [`${slot}_overshoot`, "overshoot"],
+ ] as const) {
+ const px = input[key];
+ if (!isNum(px) || !anim[slot]) continue;
+ if (!(size > 0)) throw new ToolError(`${key} sets a title's slot reel; this element has no type size.`);
+ const rest = { ...anim[slot]! };
+ delete rest[field];
+ anim[slot] = px <= 0 ? rest : { ...rest, [field]: Math.min(EDGE_REEL_EM_MAX, px / size) };
+ }
+ const settle = input[`${slot}_settle`];
+ if (isNum(settle) && anim[slot]) {
+ const rest = { ...anim[slot]! };
+ delete rest.settle;
+ anim[slot] = settle <= 0 ? rest : { ...rest, settle: clamp(settle, 0.05, EDGE_SETTLE_MAX) };
+ }
};
edge("in", "in_style", "in_seconds");
edge("out", "out_style", "out_seconds");
diff --git a/site/src/cut/lib/measure/letters.test.ts b/site/src/cut/lib/measure/letters.test.ts
index d3570009..c8ae037d 100644
--- a/site/src/cut/lib/measure/letters.test.ts
+++ b/site/src/cut/lib/measure/letters.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
-import { evalOverlayAnim, glyphStateAt, type OverlayEdge } from "@donkeycut/effects-kit";
+import { evalOverlayAnim, glyphStateAt, reelBand, slotReel, slotSeed, type OverlayEdge } from "@donkeycut/effects-kit";
import { readLetters, type LetterFrame } from "./letters";
type Rgb = [number, number, number];
@@ -201,3 +201,113 @@ describe("reading a line's letters as they come in", () => {
expect(() => read(frames)).toThrow(/letters? of that colour/);
});
});
+
+// A 320×180 picture: a pixel is 6 design px. "2026" in teal on black, each
+// digit 40 px tall at rest — type of 55.6 px (digits stand 0.72 em), lines
+// 1.25 em apart.
+const RW = 320;
+const RH = 180;
+const RUNIT = 1080 / RH;
+const TEAL: Rgb = [0, 73, 89];
+const DIGITS = "2026";
+const EM_PX = 40 / 0.72;
+const LINE_PX = EM_PX * 1.25;
+const DIGIT_REST = [0, 1, 2, 3].map((i) => ({ x: 100 + i * 32, y: 70, w: 18, h: 40 }));
+
+/** The picture at `t` with "2026" coming in on a slot `edge`, each digit's
+ * reel drawn through its band as the renderers draw it. */
+function reelFrameAt(t: number, edge: OverlayEdge): LetterFrame {
+ const data = new Uint8ClampedArray(RW * RH * 4);
+ for (let i = 0; i < RW * RH; i++) data.set([0, 0, 0, 255], i * 4);
+ const st = evalOverlayAnim({ in: edge }, t, 10, true);
+ const em = 1 / 1.25;
+ [...DIGITS].forEach((ch, gi) => {
+ const g = glyphStateAt(st, gi, DIGITS.length);
+ const rest = DIGIT_REST[gi];
+ const mid = rest.y + rest.h / 2;
+ const band = g.roll ? reelBand(g.reel, em) * LINE_PX : Infinity;
+ const reel = g.roll ? slotReel(ch, gi, g.roll, slotSeed(DIGITS), g.reel, em) : [{ ch, y: 0, alpha: 1 }];
+ for (const r of reel) {
+ const top = Math.round(mid + r.y * LINE_PX - rest.h / 2);
+ for (let y = Math.max(0, top, Math.ceil(mid - band)); y < Math.min(RH, top + rest.h, Math.floor(mid + band)); y++)
+ for (let x = rest.x; x < rest.x + rest.w; x++) {
+ const k = r.alpha * Math.min(1, Math.max(0, g.alpha));
+ const i = (y * RW + x) * 4;
+ data.set([...mix([data[i], data[i + 1], data[i + 2]], TEAL, k), 255], i);
+ }
+ }
+ });
+ return { data, width: RW, height: RH, t };
+}
+
+describe("reading a line whose letters roll in on a slot reel", () => {
+ // Turning down, its digits 1.6 em apart behind a band 1 em either side,
+ // solid, each landing 0.4 em past its slot and settling back.
+ const edge: OverlayEdge = {
+ style: "slot",
+ seconds: 2,
+ stagger: 0.6,
+ reel: "down",
+ pitch: 1.6,
+ band: 1,
+ overshoot: 0.4,
+ settle: 0.3,
+ fade: false,
+ };
+ const frames = Array.from({ length: Math.round((edge.seconds + 0.3) * 30) }, (_, f) => reelFrameAt(f / 30, edge));
+ const r = readLetters(frames, { text: DIGITS, region: { x: 90, y: 55, w: 140, h: 70 }, ink: TEAL, unit: RUNIT });
+
+ test("reads it as a reel: its turn, its spacing, its band and its landing", () => {
+ const reel = r.edge?.reel;
+ expect(reel).toBeDefined();
+ expect(reel!.dir).toBe("down");
+ const em = EM_PX * RUNIT;
+ expect(reel!.pitch / em).toBeCloseTo(1.6, 1);
+ expect(reel!.band / em).toBeGreaterThan(0.9);
+ expect(reel!.band / em).toBeLessThan(1.1);
+ expect(reel!.overshoot / em).toBeGreaterThan(0.3);
+ expect(reel!.overshoot / em).toBeLessThan(0.5);
+ expect(reel!.settle).toBeGreaterThan(0.2);
+ expect(reel!.settle).toBeLessThan(0.4);
+ expect(r.edge!.fade).toBe(false);
+ });
+
+ test("times the hand-off and each digit's turn", () => {
+ expect(r.edge!.sequence).toEqual([0, 1, 2, 3]);
+ // Each digit's move is 2 × 0.4 = 0.8s; the starts span 2 × 0.6 = 1.2s.
+ expect(r.edge!.move).toBeCloseTo(0.8, 1);
+ expect(r.edge!.seconds * r.edge!.stagger).toBeCloseTo(1.2, 1);
+ expect(r.edge!.start).toBeCloseTo(0, 1);
+ });
+});
+
+describe("reading a line whose letters pop in where they stand", () => {
+ // Each letter appears whole at its rest, a character every 0.5s — the
+ // space takes its turn too: typing.
+ const shows = [0.6, 1.1, 1.6, 2.1, 3.1, 3.6];
+ const frames = Array.from({ length: 120 }, (_, f) => {
+ const t = f / 30;
+ const data = new Uint8ClampedArray(W * H * 4);
+ for (let i = 0; i < W * H; i++) data.set([...GROUNDS[0], 255], i * 4);
+ REST.forEach((rest, k) => {
+ if (t < shows[k]) return;
+ for (let y = rest.y; y < rest.y + rest.h; y++)
+ for (let x = rest.x; x < rest.x + rest.w; x++) data.set([...RED, 255], (y * W + x) * 4);
+ });
+ return { data, width: W, height: H, t };
+ });
+
+ test("reads a typewriter whose turns land on each letter's frame", () => {
+ const e = read(frames).edge;
+ expect(e?.typed).toBe(true);
+ // "ABCD EF" is 7 characters, the space among them: letter k is glyph g,
+ // shown once the typed share passes g / 7.
+ const glyphs = [0, 1, 2, 3, 5, 6];
+ glyphs.forEach((g, k) => {
+ const at = e!.start + (e!.seconds * g) / 7;
+ // Typed share passes g / 7 just after `at`: the letter shows on the
+ // frame after, within a frame of the reference.
+ expect(Math.abs(at - shows[k])).toBeLessThan(0.05);
+ });
+ });
+});
diff --git a/site/src/cut/lib/measure/letters.ts b/site/src/cut/lib/measure/letters.ts
index 0579b807..faa00171 100644
--- a/site/src/cut/lib/measure/letters.ts
+++ b/site/src/cut/lib/measure/letters.ts
@@ -49,6 +49,15 @@ const PASS_MIN = 30;
const MARK = 6;
/** Share of the crossed ink a letter's colour must take to be in front. */
const FRONT_SHARE = 0.15;
+/** A letter rolls on a reel when this many of its frames show two characters
+ * in its column at once. */
+const REEL_FRAMES = 2;
+/** A run this share of the letter's rest height or more is a whole character
+ * on the reel; a shorter one is cut by the band. */
+const REEL_WHOLE = 0.85;
+/** A reel character whose strongest pixels reach this share of the letter's
+ * colour is solid, not faded. */
+const REEL_SOLID = 0.85;
export interface LetterTiming {
char: string;
@@ -101,6 +110,15 @@ export interface LetterRead {
fade: boolean | number;
/** Defocus at the far end, design px, clearing on the move's curve. */
blur: number;
+ /** The letters roll in on a slot reel: which way it turns (read off how
+ * each letter arrives at its slot, since a fast spin aliases between
+ * frames), how far apart its characters sit and how far its band reaches
+ * either side of the line's middle (design px), how far each lands past
+ * its slot (design px) and the share of its move spent settling back. */
+ reel?: { dir: "up" | "down"; pitch: number; band: number; overshoot: number; settle: number | null };
+ /** The letters appear where they stand, no move: typed, one character's
+ * turn every seconds ÷ characters, the spaces taking theirs. */
+ typed?: boolean;
} | null;
passes: LetterPass[];
}
@@ -201,6 +219,42 @@ function columnInk(px: Pixels, x0: number, x1: number, ink: Rgb, tall = 0): { y0
return { y0: best.y0, y1: best.y1, mass: sum };
}
+/** Every run of inked rows in one column, a one-row gap bridged, with the
+ * strongest share of the letter's colour any of its pixels reach: the
+ * characters a reel shows there at once. */
+function columnRuns(px: Pixels, x0: number, x1: number, ink: Rgb): { y0: number; y1: number; peak: number }[] {
+ const ground = groundOf(px, { x: x0, y: 0, w: x1 - x0, h: px.height }, ink);
+ if (dist(ground, ink) < 30) return [];
+ const rows: number[] = [];
+ const peaks: number[] = [];
+ for (let y = 0; y < px.height; y++) {
+ let n = 0;
+ let peak = 0;
+ for (let x = x0; x < x1; x++) {
+ const v = mixOf(at(px, x, y), ground, ink);
+ if (v >= INK_MIX) n++;
+ peak = Math.max(peak, v);
+ }
+ rows.push(n);
+ peaks.push(peak);
+ }
+ const runs: { y0: number; y1: number; peak: number }[] = [];
+ let y = 0;
+ while (y < rows.length) {
+ if (rows[y] < ROW_INK) {
+ y++;
+ continue;
+ }
+ let e = y;
+ let peak = 0;
+ while (e < rows.length && (rows[e] >= ROW_INK || (e + 1 < rows.length && rows[e + 1] >= ROW_INK))) peak = Math.max(peak, peaks[e++]);
+ // A sliver of a few rows is a character's edge leaving the band.
+ if (e - y >= 3) runs.push({ y0: y, y1: e, peak });
+ y = e;
+ }
+ return runs;
+}
+
/** The letters' columns on the settled frame: runs of columns holding ink,
* left to right — a letter's pieces (an i's dot) share one. */
function columnsOf(px: Pixels, region: PixelRect, ink: Rgb, count: number): { x0: number; x1: number; y0: number; y1: number }[] {
@@ -462,6 +516,11 @@ export function readLetters(
);
const step = frames.length > 1 ? median(frames.slice(1).map((f, i) => f.t - frames[i].t)) : 1 / 30;
+ // Letters rolling in on a slot reel show two characters in a column at
+ // once; that is read as a reel, not fitted as a move.
+ const reel = readReel(frames, cols, chars, opts.ink, opts.unit);
+ if (reel) return { ...reel, passes: [] };
+
// Each letter's frames: where it shows, and how solid.
const reads = cols.map((c) => {
const rest = columnInk(last, c.x0, c.x1, opts.ink);
@@ -627,8 +686,184 @@ export function readLetters(
};
}
+ // Letters that appear where they stand were typed: the typed share passes
+ // glyph g of n at start + seconds × g / n (the spaces take turns too), and
+ // each shows on the frame after.
+ if (!edge && !travels && letters.every((l) => l.shows !== null)) {
+ const glyphs: number[] = [];
+ [...opts.text].forEach((c, gi) => {
+ if (c.trim()) glyphs.push(gi);
+ });
+ const n = [...opts.text].length;
+ const xs = glyphs;
+ const ys = letters.map((l) => l.shows!);
+ const mx = xs.reduce((a, b) => a + b, 0) / xs.length;
+ const my = ys.reduce((a, b) => a + b, 0) / ys.length;
+ const sxx = xs.reduce((a, x) => a + (x - mx) ** 2, 0);
+ const slope = sxx > 0 ? xs.reduce((a, x, k) => a + (x - mx) * (ys[k] - my), 0) / sxx : 0;
+ const start = my - slope * mx - step / 2;
+ const seconds = Math.max(step, slope * n);
+ edge = {
+ sequence: letters.map((l) => l.index),
+ sequenceAt: letters.map((_, k) => (letters.length > 1 ? k / (letters.length - 1) : 0)),
+ seconds,
+ stagger: 0,
+ start,
+ move: 0,
+ distance: 0,
+ direction: "none",
+ ease: null,
+ fade: false,
+ blur: 0,
+ typed: true,
+ };
+ }
+
return { letters, edge, passes: passesOf(frames, cols, opts.ink) };
}
+
+/** How a line rolls in on a slot reel, or null when its letters do not: on
+ * enough of their frames, two characters show in one column at once. */
+function readReel(
+ frames: LetterFrame[],
+ cols: { x0: number; x1: number; y0: number; y1: number }[],
+ chars: string[],
+ ink: Rgb,
+ unit: number,
+): Omit<LetterRead, "passes"> | null {
+ const last = frames[frames.length - 1];
+ const per = cols.map((c) => {
+ const rest = columnInk(last, c.x0, c.x1, ink);
+ const mid = rest ? (rest.y0 + rest.y1) / 2 : (c.y0 + c.y1) / 2;
+ const h = rest ? rest.y1 - rest.y0 : c.y1 - c.y0;
+ return { mid, h, runs: frames.map((f) => columnRuns(f, c.x0, c.x1, ink)) };
+ });
+ // Two characters in sight reach further than one letter can, even one cut
+ // in two by a line drawn over it or streaking along its fall.
+ const twoInSight = (p: (typeof per)[number], runs: { y0: number; y1: number }[]) =>
+ runs.length >= 2 && Math.max(...runs.map((r) => r.y1)) - Math.min(...runs.map((r) => r.y0)) > p.h * TALL;
+ const rolls = per.filter((p) => p.runs.filter((r) => twoInSight(p, r)).length >= REEL_FRAMES).length;
+ if (rolls < Math.ceil(cols.length / 2)) return null;
+
+ const reads = per.map((p) => {
+ const whole = (r: { y0: number; y1: number }) => r.y1 - r.y0 >= p.h * REEL_WHOLE;
+ // Where the run nearest the slot sits, px from rest (+ below); one cut by
+ // the band is placed by its uncut side.
+ const offsetOf = (r: { y0: number; y1: number }) =>
+ whole(r) ? (r.y0 + r.y1) / 2 - p.mid : r.y0 < p.mid - p.h / 2 ? r.y1 - (p.mid + p.h / 2) : r.y0 - (p.mid - p.h / 2);
+ const nearest = (runs: { y0: number; y1: number }[]) =>
+ runs.reduce<{ y0: number; y1: number } | null>((b, r) => (!b || Math.abs(offsetOf(r)) < Math.abs(offsetOf(b)) ? r : b), null);
+ const shows = p.runs.findIndex((r) => r.length > 0);
+ const multi = p.runs.flatMap((r, i) => (twoInSight(p, r) ? [i] : []));
+ // The spacing: a whole character's top to the next one's top, or a whole
+ // character's bottom to the one above's bottom (a band cuts the far side).
+ const pitches: number[] = [];
+ const peaks: number[] = [];
+ for (const i of multi) {
+ const runs = [...p.runs[i]].sort((a, b) => a.y0 - b.y0);
+ for (let k = 1; k < runs.length; k++) {
+ const a = runs[k - 1];
+ const b = runs[k];
+ const d = whole(a) ? b.y0 - a.y0 : whole(b) ? b.y1 - a.y1 : 0;
+ if (d >= p.h) pitches.push(d);
+ }
+ for (const r of runs) if (whole(r)) peaks.push(r.peak);
+ }
+ // The band: as far from the slot as any character ever shows.
+ let band = p.h / 2;
+ for (const runs of p.runs) for (const r of runs) band = Math.max(band, p.mid - r.y0, r.y1 - p.mid);
+ // The landing: which side the character nearest its slot arrives from on
+ // the last frame with two in sight, then how far past it runs and when
+ // it is still.
+ const lastMulti = multi.length ? multi[multi.length - 1] : shows;
+ const near = lastMulti >= 0 ? nearest(p.runs[lastMulti]) : null;
+ const dir: "up" | "down" = near && offsetOf(near) < 0 ? "down" : "up";
+ const sign = dir === "down" ? 1 : -1;
+ let peak = 0;
+ let peakAt = lastMulti;
+ const after: { i: number; o: number }[] = [];
+ for (let i = Math.max(0, lastMulti + 1); i < frames.length; i++) {
+ const r = nearest(p.runs[i]);
+ if (!r) continue;
+ const o = offsetOf(r);
+ after.push({ i, o });
+ if (sign * o > peak) {
+ peak = sign * o;
+ peakAt = i;
+ }
+ }
+ const overshoot = peak > REST_PX * 2 ? peak : 0;
+ const showsT = shows >= 0 ? frames[shows].t : null;
+ // Settling back glides in and out, so it is halfway home halfway
+ // through: that crossing, between frames, times it better than the
+ // moment it looks still.
+ let landsT: number | null = null;
+ if (overshoot) {
+ const k = after.findIndex((a) => a.i > peakAt && sign * a.o <= overshoot / 2);
+ if (k > 0) {
+ const a = after[k - 1];
+ const b = after[k];
+ const half = frames[a.i].t + ((sign * a.o - overshoot / 2) / Math.max(1e-6, sign * (a.o - b.o))) * (frames[b.i].t - frames[a.i].t);
+ landsT = frames[peakAt].t + 2 * (half - frames[peakAt].t);
+ }
+ }
+ if (landsT === null) {
+ const still = after.find((a, k) => a.i > lastMulti && after.slice(k).every((b) => Math.abs(b.o) <= REST_PX * 2));
+ landsT = still ? frames[still.i].t : showsT;
+ }
+ const settle =
+ overshoot && showsT !== null && landsT !== null && landsT > showsT ? (landsT - frames[peakAt].t) / (landsT - showsT) : null;
+ return { showsT, landsT, pitches, peaks, band, dir, overshoot, settle };
+ });
+
+ const letters: LetterTiming[] = reads.map((r, index) => ({
+ char: chars[index],
+ index,
+ shows: r.showsT,
+ starts: r.showsT,
+ lands: r.landsT,
+ from: null,
+ alpha: r.peaks.length ? Math.min(1, median(r.peaks)) : null,
+ soft: null,
+ ease: null,
+ error: null,
+ }));
+ if (letters.some((l) => l.shows === null || l.lands === null)) return { letters, edge: null };
+ const order = [...letters].sort((a, b) => a.starts! - b.starts! || a.index - b.index);
+ const first = order[0].starts!;
+ const span = order[order.length - 1].starts! - first;
+ const move = median(letters.map((l) => l.lands! - l.starts!));
+ const seconds = span + move;
+ // A reel first shows on the frame after its turn begins.
+ const step = frames.length > 1 ? median(frames.slice(1).map((f, i) => f.t - frames[i].t)) : 1 / 30;
+ const start = first - step / 2;
+ const downs = reads.filter((r) => r.dir === "down").length;
+ const settles = reads.flatMap((r) => (r.settle !== null ? [r.settle] : []));
+ const peaks = reads.flatMap((r) => r.peaks);
+ return {
+ letters,
+ edge: {
+ sequence: order.map((l) => l.index),
+ sequenceAt: order.map((l) => (span > 0 ? (l.starts! - first) / span : 0)),
+ seconds,
+ stagger: seconds > 0 ? span / seconds : 0,
+ start,
+ move,
+ distance: 0,
+ direction: "none",
+ ease: null,
+ fade: peaks.length > 0 && median(peaks) >= REEL_SOLID ? false : true,
+ blur: 0,
+ reel: {
+ dir: downs * 2 >= reads.length ? "down" : "up",
+ pitch: median(reads.flatMap((r) => r.pitches)) * unit,
+ band: median(reads.map((r) => r.band)) * unit,
+ overshoot: median(reads.map((r) => r.overshoot)) * unit,
+ settle: settles.length ? median(settles) : null,
+ },
+ },
+ };
+}
/** Which side of other ink the moving letters pass. The other ink is read off
* the last frame inside the letters' columns, above and below the line; on
* each frame a moving letter's box covers some of it, and each covered pixel
diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.ts
index 3f035d33..ac26fe74 100644
--- a/site/src/cut/server/ai/catalog.ts
+++ b/site/src/cut/server/ai/catalog.ts
@@ -363,7 +363,7 @@ Someone points at a video — a file they imported, a link you brought in, a cli
**Rebuild the text as elements.** One title per card, a stretch of cards per add_title call — the words exactly as they read, size in px at 1080 wide, and x/y where suggest_font sets it on that card — a title is set from the middle of its line, so the centre of its ink box (track_element, match ink, the text's colour) sits off it by the face's own offset. A run of lines timed one after another is add_text_sequence in one call. Match the case the reference uses, and its colour from sample_color. The face comes off the frame: suggest_font with the card's moment, a region close around its words and the words themselves ranks every face Donkey has and hands back the font, weight, size, tracking and x/y to set. Call it on each card: cards in one face share its weight, size and tracking, but each sits its own way in its space, so its x/y comes from its own read, never from a neighbour's place. A title that cycles through typefaces is one call per face it shows. A no_match verdict means the reference uses a face Donkey does not bundle: say so, and set the closest one it named. Without a suggestion, size comes off the ink: capitals stand about 0.7 of the size tall, so size is the ink height in px at 1080 wide ÷ 0.7 (h × 1920 ÷ 0.7 on 9:16). A cycle whose faces change on the music's beats times itself with set_overlay_animation font_cycle_beats on the soundtrack clip after detect_beats; one whose changes follow the reference's own rhythm takes font_cycle_switches, the timeline seconds detect_cuts reads each change at.
-**Then the motion.** set_overlay_keyframes gives each card its own pose track — where it sits, at what scale, at what second. track_element over a move hands you the keys: each move's from/to, start/end and ease, with scale as w over the resting w. set_overlay_animation composes on top for the entrance, the exit, a loop, and what a line does while it holds; 0.3-0.6s reads as an entrance, and a per-letter style is what makes a card read as typed. A line whose letters land one at a time is a per-letter entrance read off detect_cuts' \`changes\`, and it is read in one call, never by eye from sheets: track_element with match letters, the line's \`text\`, a seed close around the landed line, \`from\` before the first letter shows and \`to\` just after the last one lands. Its \`entrance\` is the set_overlay_animation call — in_style, in_seconds, in_stagger, in_sequence, in_sequence_at, in_distance, in_ease, in_fade, in_blur — and \`starts\`, the source second the title's ramp begins; pass them as they come. Its \`crosses\` says whether the letters pass in front of or behind other ink on their way in — a smaller line above them — and so which of the two takes the lower row. motion_blur on the element (update_overlay) is for letters that streak along their fall; one that comes in soft is in_blur. add_shape, a stretch per call, is the rest of the graphics: bars, cards, rules, a block of color behind a line.
+**Then the motion.** set_overlay_keyframes gives each card its own pose track — where it sits, at what scale, at what second. track_element over a move hands you the keys: each move's from/to, start/end and ease, with scale as w over the resting w. set_overlay_animation composes on top for the entrance, the exit, a loop, and what a line does while it holds; 0.3-0.6s reads as an entrance, and a per-letter style is what makes a card read as typed. A line whose letters land one at a time is a per-letter entrance read off detect_cuts' \`changes\`, and it is read in one call, never by eye from sheets: track_element with match letters, the line's \`text\`, a seed close around the landed line, \`from\` before the first letter shows and \`to\` just after the last one lands. Its \`entrance\` is the set_overlay_animation call — in_style, in_seconds, in_stagger, in_sequence, in_sequence_at, in_distance, in_ease, in_fade, in_blur — and \`starts\`, the source second the title's ramp begins; pass them as they come. Digits spinning into place like a slot machine and letters popping in where they stand are read by the same call: it hands back a slot entrance with the reel's turn, spacing, band and landing bounce (a fast spin seems to turn the wrong way between frames, so take the turn from the call, never from a sheet), or a typewriter. Its \`crosses\` says whether the letters pass in front of or behind other ink on their way in — a smaller line above them — and so which of the two takes the lower row. motion_blur on the element (update_overlay) is for letters that streak along their fall; one that comes in soft is in_blur. add_shape, a stretch per call, is the rest of the graphics: bars, cards, rules, a block of color behind a line.
**Look at what you made.** A build that reads right from your own notes is still a guess until you measure it. compare_to_source does: mode sweep scores every frame of the cut against the source — 0 is the same picture, under ${SWEEP_TARGET} reads as one — and names the worst stretches with a grid of where each differs; mode moments shows those peaks beside the source's frames. Sweep as you build, since an error in the first card is in every card after it: look at the worst stretches, fix what differs, sweep again, and stop when the median is under ${SWEEP_TARGET} and no stretch stands out. A \`shift\` means the right thing lands early or late by that much. Read each picture for colour, the words and their face, where a thing sits, its size, and how far along a move is; a title the same colour as the block behind it reads as correct in the document and shows up here, and a sweep's \`titles\` names each title whose letters are another colour than the source's. A block keeps its footage's difference, so judge a shot by the cells over what you built. That is the only difference no edit removes: a glow, a tint on type, a soft edge or a flash is built like everything else (a glow is a bright shadow at shadow_y 0 on the title or shape, keyed in by the opacity of a copy that wears it), so a stretch over what you built stands out until you build it.
diff --git a/site/src/i18n/messages/.source-lock.json b/site/src/i18n/messages/.source-lock.json
index fa10be07..18bad015 100644
--- a/site/src/i18n/messages/.source-lock.json
+++ b/site/src/i18n/messages/.source-lock.json
@@ -1724,6 +1724,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -4753,6 +4760,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -7782,6 +7796,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -10811,6 +10832,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -13840,6 +13868,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -16869,6 +16904,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
@@ -19898,6 +19940,13 @@
"anim.orderHint": "9e4d5ac144e6",
"anim.distance": "423208095dd7",
"anim.blur": "900aa998d355",
+ "anim.reel": "cacfa94fbbf7",
+ "anim.reelUp": "2038bdec9210",
+ "anim.reelDown": "bf93e5ce8bc1",
+ "anim.reelPitch": "2acbb307953b",
+ "anim.reelBand": "41dfc0a6c927",
+ "anim.overshoot": "3754f768f9f2",
+ "anim.settle": "3ebe66ce7cf6",
"fontCycle.removeFace": "5e8edcbf9347",
"fontCycle.weight": "69c0b81540bd",
"fontCycle.italic": "1616e2e5405e",
diff --git a/site/src/i18n/messages/de/inspector.json b/site/src/i18n/messages/de/inspector.json
index 9a1b5606..0606db98 100644
--- a/site/src/i18n/messages/de/inspector.json
+++ b/site/src/i18n/messages/de/inspector.json
@@ -526,7 +526,14 @@
"order": "Reihenfolge",
"orderHint": "Buchstaben in der Reihenfolge ihrer Bewegung",
"distance": "Abstand",
- "blur": "Weichzeichner"
+ "blur": "Weichzeichner",
+ "reel": "Rolle",
+ "reelUp": "Nach oben",
+ "reelDown": "Nach unten",
+ "reelPitch": "Abstand",
+ "reelBand": "Fenster",
+ "overshoot": "Überschwingen",
+ "settle": "Einpendeln"
},
"fontCycle": {
"removeFace": "Schriftschnitt entfernen",
diff --git a/site/src/i18n/messages/en/inspector.json b/site/src/i18n/messages/en/inspector.json
index afebdd31..5f4df6c5 100644
--- a/site/src/i18n/messages/en/inspector.json
+++ b/site/src/i18n/messages/en/inspector.json
@@ -526,7 +526,14 @@
"order": "Order",
"orderHint": "Letters in the order they move",
"distance": "Distance",
- "blur": "Blur"
+ "blur": "Blur",
+ "reel": "Reel",
+ "reelUp": "Up",
+ "reelDown": "Down",
+ "reelPitch": "Spacing",
+ "reelBand": "Window",
+ "overshoot": "Overshoot",
+ "settle": "Settle"
},
"fontCycle": {
"removeFace": "Remove face",
diff --git a/site/src/i18n/messages/es/inspector.json b/site/src/i18n/messages/es/inspector.json
index ceba8050..c9ca95e7 100644
--- a/site/src/i18n/messages/es/inspector.json
+++ b/site/src/i18n/messages/es/inspector.json
@@ -526,7 +526,14 @@
"order": "Orden",
"orderHint": "Letras en el orden en que se mueven",
"distance": "Distancia",
- "blur": "Desenfoque"
+ "blur": "Desenfoque",
+ "reel": "Carrete",
+ "reelUp": "Arriba",
+ "reelDown": "Abajo",
+ "reelPitch": "Espaciado",
+ "reelBand": "Ventana",
+ "overshoot": "Exceso",
+ "settle": "Estabilización"
},
"fontCycle": {
"removeFace": "Eliminar fuente",
diff --git a/site/src/i18n/messages/fr/inspector.json b/site/src/i18n/messages/fr/inspector.json
index 67bc4329..195ff5ed 100644
--- a/site/src/i18n/messages/fr/inspector.json
+++ b/site/src/i18n/messages/fr/inspector.json
@@ -526,7 +526,14 @@
"order": "Ordre",
"orderHint": "Lettres dans l'ordre où elles bougent",
"distance": "Distance",
- "blur": "Flou"
+ "blur": "Flou",
+ "reel": "Rouleau",
+ "reelUp": "Haut",
+ "reelDown": "Bas",
+ "reelPitch": "Espacement",
+ "reelBand": "Fenêtre",
+ "overshoot": "Dépassement",
+ "settle": "Stabilisation"
},
"fontCycle": {
"removeFace": "Supprimer la fonte",
diff --git a/site/src/i18n/messages/ja/inspector.json b/site/src/i18n/messages/ja/inspector.json
index 8d9c8ea6..afa4bbb6 100644
--- a/site/src/i18n/messages/ja/inspector.json
+++ b/site/src/i18n/messages/ja/inspector.json
@@ -526,7 +526,14 @@
"order": "順序",
"orderHint": "文字が動く順序",
"distance": "距離",
- "blur": "ブラー"
+ "blur": "ブラー",
+ "reel": "リール",
+ "reelUp": "上",
+ "reelDown": "下",
+ "reelPitch": "間隔",
+ "reelBand": "ウィンドウ",
+ "overshoot": "オーバーシュート",
+ "settle": "収束"
},
"fontCycle": {
"removeFace": "書体を削除",
diff --git a/site/src/i18n/messages/ko/inspector.json b/site/src/i18n/messages/ko/inspector.json
index 3f141d4c..5c59e2bd 100644
--- a/site/src/i18n/messages/ko/inspector.json
+++ b/site/src/i18n/messages/ko/inspector.json
@@ -526,7 +526,14 @@
"order": "순서",
"orderHint": "글자가 움직이는 순서",
"distance": "거리",
- "blur": "블러"
+ "blur": "블러",
+ "reel": "릴",
+ "reelUp": "위",
+ "reelDown": "아래",
+ "reelPitch": "간격",
+ "reelBand": "윈도우",
+ "overshoot": "오버슈트",
+ "settle": "안정화"
},
"fontCycle": {
"removeFace": "서체 제거",
diff --git a/site/src/i18n/messages/pt-BR/inspector.json b/site/src/i18n/messages/pt-BR/inspector.json
index fc2db57f..c03c5a26 100644
--- a/site/src/i18n/messages/pt-BR/inspector.json
+++ b/site/src/i18n/messages/pt-BR/inspector.json
@@ -526,7 +526,14 @@
"order": "Ordem",
"orderHint": "Letras na ordem em que se movem",
"distance": "Distância",
- "blur": "Desfoque"
+ "blur": "Desfoque",
+ "reel": "Carretel",
+ "reelUp": "Para cima",
+ "reelDown": "Para baixo",
+ "reelPitch": "Espaçamento",
+ "reelBand": "Janela",
+ "overshoot": "Ultrapassagem",
+ "settle": "Estabilização"
},
"fontCycle": {
"removeFace": "Remover fonte",
diff --git a/site/src/i18n/messages/zh-CN/inspector.json b/site/src/i18n/messages/zh-CN/inspector.json
index 87a170f9..e20c1eb6 100644
--- a/site/src/i18n/messages/zh-CN/inspector.json
+++ b/site/src/i18n/messages/zh-CN/inspector.json
@@ -526,7 +526,14 @@
"order": "顺序",
"orderHint": "字母移动的顺序",
"distance": "距离",
- "blur": "模糊"
+ "blur": "模糊",
+ "reel": "滚轮",
+ "reelUp": "向上",
+ "reelDown": "向下",
+ "reelPitch": "间距",
+ "reelBand": "窗口",
+ "overshoot": "过冲",
+ "settle": "回稳"
},
"fontCycle": {
"removeFace": "移除字体",