Skip to content

Open source CapCut alternative.

TypeScript

feat(site): titles stretch from the side grips [rebuild]

David Le2f847bbf7294
diff --git a/site/packages/effects-kit/src/render.ts b/site/packages/effects-kit/src/render.ts
index 499c5ab2..527fb518 100644
--- a/site/packages/effects-kit/src/render.ts
+++ b/site/packages/effects-kit/src/render.ts
@@ -25,6 +25,7 @@ import { elementPlugin } from "./registry";
import { kitCanvas } from "./surface";
import {
lineLikeShape,
+ textStretch,
type Overlay,
type ShapeKind,
type ShapeOverlay,
@@ -335,6 +336,24 @@ async function paintText(
frame: PaintFrame,
env: RenderEnv
) {
+ // Glyph stretch scales everything the element paints — plate, stroke,
+ // per-glyph motion — about its center, the same space the DOM pair
+ // stretches with its CSS transform.
+ const { sx, sy } = textStretch(overlay);
+ if (sx !== 1 || sy !== 1) {
+ const cx = overlay.x * frame.width;
+ const cy = overlay.y * frame.height;
+ ctx.save();
+ ctx.translate(cx, cy);
+ ctx.scale(sx, sy);
+ ctx.translate(-cx, -cy);
+ try {
+ await paintText(ctx, { ...overlay, stretchX: undefined, stretchY: undefined }, frame, env);
+ } finally {
+ ctx.restore();
+ }
+ return;
+ }
const { width, scale } = frame;
const fpx = overlay.size * scale;
const cssFont = textCssFont(overlay, fpx, env);
@@ -631,12 +650,18 @@ export async function measureElementBounds(
w += PLATE_PAD_X * fpx * 2;
h += PLATE_PAD_Y * fpx * 2;
}
- if (opts?.pad === false) return { cx, cy, w, h };
+ const { sx, sy } = textStretch(o);
+ if (opts?.pad === false) return { cx, cy, w: w * sx, h: h * sy };
const strokePad = (o.stroke?.width ?? 0) * fpx * 2;
const shadow = resolveShadow(o.shadow);
const shadowPad = shadow ? (shadow.blur + Math.abs(shadow.offsetY)) * frame.scale : 0;
// Ascenders/descenders overhang the em-box line grid a little.
- return { cx, cy, w: w + strokePad * 2 + shadowPad * 2, h: h + fpx * 0.3 + strokePad * 2 + shadowPad * 2 };
+ return {
+ cx,
+ cy,
+ w: (w + strokePad * 2 + shadowPad * 2) * sx,
+ h: (h + fpx * 0.3 + strokePad * 2 + shadowPad * 2) * sy,
+ };
}
/** One window of an animated element, ready to be drawn under a per-frame
diff --git a/site/packages/effects-kit/src/types.ts b/site/packages/effects-kit/src/types.ts
index 7942cb97..33e1909e 100644
--- a/site/packages/effects-kit/src/types.ts
+++ b/site/packages/effects-kit/src/types.ts
@@ -76,6 +76,11 @@ export interface TextOverlay extends OverlayBase {
/** How lines align inside the text block; absent = center. The block
* itself stays centered on (x, y). */
align?: TextAlign;
+ /** Glyph stretch: width and height multipliers on the laid-out block,
+ * applied about its center. The frame's side grips write these; absent
+ * means 1. */
+ stretchX?: number;
+ stretchY?: number;
/** Drop shadow: `true` = the legacy default look, an object customizes it. */
shadow: boolean | TextShadowSpec;
plate: boolean; // rounded plate behind the text
@@ -152,6 +157,11 @@ export function isTextOverlay(o: Overlay): o is TextOverlay {
return (o.kind ?? "text") === "text";
}
+/** A text element's glyph stretch, resolved to concrete multipliers. */
+export function textStretch(o: TextOverlay): { sx: number; sy: number } {
+ return { sx: o.stretchX ?? 1, sy: o.stretchY ?? 1 };
+}
+
export function isShapeOverlay(o: Overlay): o is ShapeOverlay {
return o.kind === "shape";
}
diff --git a/site/src/cut/components/Inspector.tools.ts b/site/src/cut/components/Inspector.tools.ts
index 65a10c10..cc71eb2a 100644
--- a/site/src/cut/components/Inspector.tools.ts
+++ b/site/src/cut/components/Inspector.tools.ts
@@ -72,6 +72,8 @@ export const INSPECTOR_TOOLS = [
align: { type: "string", enum: ["left", "center", "right"], description: "Multi-line alignment (titles)" },
letter_spacing: num("Tracking in em (titles; 0 = normal)"),
line_height: num("Line height multiplier (titles; default 1.25)"),
+ stretch_x: num("Glyph stretch, width multiplier 0.25..4 (titles; 1 clears)"),
+ stretch_y: num("Glyph stretch, height multiplier 0.25..4 (titles; 1 clears)"),
shadow: bool("Drop shadow (titles)"),
plate: bool("Backdrop plate (titles)"),
w: num("Width, fraction of frame width (shapes/stickers)"),
diff --git a/site/src/cut/components/OverlayLayer.tsx b/site/src/cut/components/OverlayLayer.tsx
index 7da7a729..a8f1a752 100644
--- a/site/src/cut/components/OverlayLayer.tsx
+++ b/site/src/cut/components/OverlayLayer.tsx
@@ -17,7 +17,7 @@ import {
subtitleLaneCount,
trackPos,
} from "@/cut/lib/subtitles";
-import { evalOverlayFrame, glyphStateAt, hasGlyphMotion, hasMaskKeys, hasOverlayKeys, isOverlayAnimated, lineLikeShape, maskFrameAt, paintMaskCoverage, resolveShadow, shapeMetrics, shapePathD, type LottieHandle, type Mask, type MaskKey, type OverlayFrameState } from "@donkeycut/effects-kit";
+import { evalOverlayFrame, glyphStateAt, hasGlyphMotion, hasMaskKeys, hasOverlayKeys, isOverlayAnimated, lineLikeShape, maskFrameAt, paintMaskCoverage, resolveShadow, shapeMetrics, shapePathD, textStretch, type LottieHandle, type Mask, type MaskKey, type OverlayFrameState } from "@donkeycut/effects-kit";
import {
LINE_HEIGHT,
PLATE_PAD_X,
@@ -628,11 +628,17 @@ function OverlayItem({
// The box carries position, rotation, and opacity; the content wrapper
// inside it carries a title's type styles (the edit caret inherits them)
// and the mask.
+ // A title's glyph stretch rides the box transform, so every rect the stage
+ // reads off the box — snapping, the rotate gesture — is the stretched one.
+ // The chrome twin composes its own transform from the base, keeping its
+ // grips circular.
+ const { sx, sy } = isText ? textStretch(o) : { sx: 1, sy: 1 };
+ const baseTransform = `translate(-50%, -50%)${animTransform}`;
const style: CSSProperties = {
// A keyframed element is placed by its pose, not by its resting x/y.
left: `${(live?.x ?? o.x) * 100}%`,
top: `${(live?.y ?? o.y) * 100}%`,
- transform: `translate(-50%, -50%)${animTransform}`,
+ transform: sx !== 1 || sy !== 1 ? `${baseTransform} scale(${sx}, ${sy})` : baseTransform,
opacity: (live ? live.opacity : (o.opacity ?? 1)) * (ghost ? 0.35 : 1),
};
const contentStyle: CSSProperties = {
@@ -741,12 +747,13 @@ function OverlayItem({
if (direct.length) s.updateOverlaysTransient(direct);
};
- // A grip resizes what the kind actually stores: a title's font size, a
- // shape's box, a sticker's width. The grip's opposite corner or side stays
- // planted: a corner takes both axes by how far it travels from the far
- // corner, a side grip takes width alone measured from the far side, and the
- // center walks out so the planted edge holds still on screen. A group
- // scales as one about the same planted point.
+ // A grip resizes what the kind actually stores: a corner takes a title's
+ // font size, a shape's box, a sticker's width; a side grip takes one axis
+ // alone — a shape's width or height, a title's glyph stretch. The grip's
+ // opposite corner or side stays planted: a corner takes both axes by how
+ // far it travels from the far corner, a side grip its own axis measured
+ // from the far side, and the center walks out so the planted edge holds
+ // still on screen. A group scales as one about the same planted point.
const resizeFrom = (handle: ResizeHandle, e: React.PointerEvent) => {
const s = useEditor.getState();
s.pushHistory();
@@ -757,9 +764,10 @@ function OverlayItem({
const axis = HANDLE_AXIS[handle];
const rad = (-(live?.rotation ?? o.rotation ?? 0) * Math.PI) / 180;
// The box's own size on screen: the bounding rect is the turned box's
- // envelope, so take the layout size under the pose's scale.
- const ow = el.offsetWidth * (live?.scale ?? 1);
- const oh = el.offsetHeight * (live?.scale ?? 1);
+ // envelope, so take the layout size under the pose's scale and the glyph
+ // stretch.
+ const ow = el.offsetWidth * (live?.scale ?? 1) * sx;
+ const oh = el.offsetHeight * (live?.scale ?? 1) * sy;
// The planted point, in the element's own space relative to its center.
const ax = (-axis.x * ow) / 2;
const ay = (-axis.y * oh) / 2;
@@ -777,8 +785,17 @@ function OverlayItem({
const d0 = Math.max(8, reach(e.clientX, e.clientY));
const members = groupSnapshot();
const self = members.find((m) => m.id === o.id) ?? members[0];
+ // A stretch multiplier, clamped and stored as absence at 1.
+ const stretchVal = (v: number): number | undefined => {
+ const c = Math.round(Math.min(4, Math.max(0.25, v)) * 1000) / 1000;
+ return Math.abs(c - 1) < 0.005 ? undefined : c;
+ };
const scaled = (m: Overlay, k: number): Partial<Overlay> => {
if (isTextOverlay(m)) {
+ // A side grip pulls one axis of the glyph stretch; a corner scales
+ // the font, stretch carried along.
+ if (axis.y === 0) return { stretchX: stretchVal((m.stretchX ?? 1) * k) };
+ if (axis.x === 0) return { stretchY: stretchVal((m.stretchY ?? 1) * k) };
return { size: Math.round(Math.min(320, Math.max(16, m.size * k))) };
}
if (m.kind === "shape") {
@@ -793,34 +810,48 @@ function OverlayItem({
if (m.kind === "sticker") return { w: Math.min(1.5, Math.max(0.02, m.w * k)) };
return {};
};
- // How much the grabbed element actually grew once its size clamps, so
- // the planted point holds through the clamp too.
- const grew = (patch: Partial<Overlay>): number => {
- const p = patch as { size?: number; w?: number; h?: number };
- if (isTextOverlay(self)) return (p.size ?? self.size) / self.size;
- // A top/bottom grip on a shape moves its height, so that is the side
- // the planted point reads.
- if (self.kind === "shape" && axis.x === 0) return (p.h ?? self.h) / self.h;
- if (self.kind === "shape" || self.kind === "sticker") return (p.w ?? self.w) / self.w;
- return 1;
+ // How much the grabbed element actually grew per axis once its size
+ // clamps, so the planted point holds through the clamp too.
+ const grew = (patch: Partial<Overlay>): { kx: number; ky: number } => {
+ const p = patch as {
+ size?: number;
+ w?: number;
+ h?: number;
+ stretchX?: number;
+ stretchY?: number;
+ };
+ if (isTextOverlay(self)) {
+ const ks = (p.size ?? self.size) / self.size;
+ return {
+ kx: "stretchX" in p ? (p.stretchX ?? 1) / (self.stretchX ?? 1) : ks,
+ ky: "stretchY" in p ? (p.stretchY ?? 1) / (self.stretchY ?? 1) : ks,
+ };
+ }
+ if (self.kind === "shape")
+ return { kx: (p.w ?? self.w) / self.w, ky: (p.h ?? self.h) / self.h };
+ if (self.kind === "sticker") {
+ const k = (p.w ?? self.w) / self.w;
+ return { kx: k, ky: k };
+ }
+ return { kx: 1, ky: 1 };
};
startDrag(e, {
onMove: (_dx, _dy, ev) => {
const k = reach(ev.clientX, ev.clientY) / d0;
- const keff = grew(scaled(self, k));
+ const { kx, ky } = grew(scaled(self, k));
// The center's walk that keeps the planted point on its screen spot,
// rotated back to the screen and into frame fractions.
- const sx = axis.x ? ((keff - 1) * axis.x * ow) / 2 : 0;
- const sy = axis.y ? ((keff - 1) * axis.y * oh) / 2 : 0;
- const mx = (sx * Math.cos(rad) + sy * Math.sin(rad)) / stageWidth;
- const my = (-sx * Math.sin(rad) + sy * Math.cos(rad)) / stageHeight;
+ const wx = axis.x ? ((kx - 1) * axis.x * ow) / 2 : 0;
+ const wy = axis.y ? ((ky - 1) * axis.y * oh) / 2 : 0;
+ const mx = (wx * Math.cos(rad) + wy * Math.sin(rad)) / stageWidth;
+ const my = (-wx * Math.sin(rad) + wy * Math.cos(rad)) / stageHeight;
writeTransform(
members.map((m) => ({
id: m.id,
patch: {
...scaled(m, k),
- x: clampPos(self.x + keff * (m.x - self.x) + mx),
- y: clampPos(self.y + keff * (m.y - self.y) + my),
+ x: clampPos(self.x + kx * (m.x - self.x) + mx),
+ y: clampPos(self.y + ky * (m.y - self.y) + my),
},
}))
);
@@ -1018,15 +1049,16 @@ function OverlayItem({
{liftChrome && chromeHost && chromeSize &&
createPortal(
(() => {
- // The twin: same placement, same transform chain, the box's own
- // laid-out size — so the chrome lands exactly on the element while
- // escaping the frame's clipping.
+ // The twin: same placement, the base transform chain, the box's
+ // laid-out size with the glyph stretch folded into it — so the
+ // chrome lands exactly on the element while escaping the frame's
+ // clipping, and the grips it carries stay circular.
const twinStyle: CSSProperties = {
left: style.left,
top: style.top,
- width: chromeSize.w,
- height: chromeSize.h,
- transform: style.transform,
+ width: chromeSize.w * sx,
+ height: chromeSize.h * sy,
+ transform: baseTransform,
};
return (
<>
@@ -1044,7 +1076,6 @@ function OverlayItem({
onDoubleClick={isText ? () => setEditing(true) : undefined}
>
<div className="pointer-events-none absolute -inset-[4.5px] rounded-[5px] border-[1.5px] border-dashed border-[#0a84ff]" />
- {chrome}
</div>
</div>
{/* The frame-clipped solid ring paints over it, so dashes show
@@ -1061,6 +1092,16 @@ function OverlayItem({
</div>
</div>
</div>
+ {/* The grips and the rotate button ride their own top layer, so
+ the solid ring never draws across their white faces. */}
+ <div
+ className="pointer-events-none absolute inset-0"
+ style={{ transform: bandTransform || undefined }}
+ >
+ <div className="absolute" style={twinStyle}>
+ {chrome}
+ </div>
+ </div>
</>
);
})(),
@@ -1147,6 +1188,10 @@ function useMaskCss(
disabled: boolean
): CSSProperties | undefined {
const m = o.mask;
+ // The mask image lands on the content wrapper, inside the box's glyph
+ // stretch — so the frame-space geometry pre-divides by the stretch, and the
+ // transform lands it back where every canvas renderer draws it.
+ const { sx, sy } = isTextOverlay(o) ? textStretch(o) : { sx: 1, sy: 1 };
// A behind (inverted subject) element renders in the canvas pass; the DOM
// masks shapes and front subject elements.
const subjectFront = !!m && m.kind === "subject" && !m.invert;
@@ -1201,17 +1246,17 @@ function useMaskCss(
ctx.drawImage(snap.canvas, 0, 0);
ctx.filter = "none";
const url = canvas.toDataURL();
- const boxLeft = o.x * stageWidth - box.w / 2;
- const boxTop = o.y * stageHeight - box.h / 2;
+ const posX = box.w / 2 - (o.x * stageWidth) / sx;
+ const posY = box.h / 2 - (o.y * stageHeight) / sy;
return {
maskImage: `url(${url})`,
WebkitMaskImage: `url(${url})`,
maskRepeat: "no-repeat",
WebkitMaskRepeat: "no-repeat",
- maskSize: `${stageWidth}px ${stageHeight}px`,
- WebkitMaskSize: `${stageWidth}px ${stageHeight}px`,
- maskPosition: `${-boxLeft}px ${-boxTop}px`,
- WebkitMaskPosition: `${-boxLeft}px ${-boxTop}px`,
+ maskSize: `${stageWidth / sx}px ${stageHeight / sy}px`,
+ WebkitMaskSize: `${stageWidth / sx}px ${stageHeight / sy}px`,
+ maskPosition: `${posX}px ${posY}px`,
+ WebkitMaskPosition: `${posX}px ${posY}px`,
};
}
// The canvas caps below the box size and the CSS mask stretches it back:
@@ -1236,7 +1281,9 @@ function useMaskCss(
// Map frame coordinates onto the box: the element's anchor sits at the
// box center, which is where the painter anchors the mask.
ctx.scale(s, s);
- ctx.translate(box.w / 2 - o.x * stageWidth, box.h / 2 - o.y * stageHeight);
+ ctx.translate(box.w / 2, box.h / 2);
+ ctx.scale(1 / sx, 1 / sy);
+ ctx.translate(-o.x * stageWidth, -o.y * stageHeight);
paintMaskCoverage(
ctx,
{ ...m, invert: undefined },
@@ -1256,7 +1303,7 @@ function useMaskCss(
// The keyed tick folds a 15fps-quantized tLocal in only when the mask
// actually animates; the matte stamp refreshes the subject branch.
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [active, m, box, o.x, o.y, stageWidth, stageHeight, scale, keyTick, snapTick]);
+ }, [active, m, box, o.x, o.y, sx, sy, stageWidth, stageHeight, scale, keyTick, snapTick]);
}
/**
diff --git a/site/src/cut/lib/aiContext.ts b/site/src/cut/lib/aiContext.ts
index b4f117fa..0138eff2 100644
--- a/site/src/cut/lib/aiContext.ts
+++ b/site/src/cut/lib/aiContext.ts
@@ -509,5 +509,7 @@ function describeOverlay(o: Overlay) {
plate: o.plate,
...(o.groupId ? { groupId: o.groupId } : {}),
...(o.plateRadius !== undefined && { plateRadius: r(o.plateRadius) }),
+ ...(o.stretchX !== undefined ? { stretchX: r(o.stretchX) } : {}),
+ ...(o.stretchY !== undefined ? { stretchY: r(o.stretchY) } : {}),
};
}
diff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.ts
index fd4425d7..c325cbba 100644
--- a/site/src/cut/lib/aiTools.ts
+++ b/site/src/cut/lib/aiTools.ts
@@ -3825,6 +3825,10 @@ function overlayPatch(input: Record<string, unknown>, kind: "text" | "shape" | "
patch.letterSpacing = Math.abs(input.letter_spacing) < 0.0025 ? undefined : clamp(input.letter_spacing, -0.05, 0.5);
if (isNum(input.line_height))
patch.lineHeight = Math.abs(input.line_height - 1.25) < 0.01 ? undefined : clamp(input.line_height, 0.7, 2.5);
+ if (isNum(input.stretch_x))
+ patch.stretchX = Math.abs(input.stretch_x - 1) < 0.005 ? undefined : clamp(input.stretch_x, 0.25, 4);
+ if (isNum(input.stretch_y))
+ patch.stretchY = Math.abs(input.stretch_y - 1) < 0.005 ? undefined : clamp(input.stretch_y, 0.25, 4);
if (typeof input.shadow === "boolean") patch.shadow = input.shadow;
if (typeof input.plate === "boolean") patch.plate = input.plate;
if (isNum(input.plateRadius)) patch.plateRadius = clamp(input.plateRadius, 0, 1);
diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.ts
index ee54aee7..5b7319ed 100644
--- a/site/src/cut/server/ai/catalog.ts
+++ b/site/src/cut/server/ai/catalog.ts
@@ -166,14 +166,14 @@ What the user sees on the transitions row: one badge per bar, and nothing else
The title lanes hold three overlay element kinds, all sharing timing (start/end), center position (x/y fractions 0..1), rotation (degrees), opacity, and a lane; \`overlays\` in editor_state lists them with their \`kind\`. All burn into the export exactly as previewed.
Rows are how elements stack (\`lane\`, 0 = the front row; a higher row draws further back). Two elements on ONE row never overlap in time — placing a title where a shape already sits slides it clear instead of laying it on top — so anything meant to sit over something else names a LOWER row: title on lane 0, the background shape behind it on lane 1. Every add tool and update_overlay take \`lane\`.
The frame's own color is set_background, not a full-frame rectangle: it fills the frame behind every clip and element, holds for the whole cut, letterboxes fitted footage, and shows through gaps on track 0. "Make the background white", a colored card behind a title sequence, a text-and-graphics video with no footage at all — all of them start with set_background. A rectangle element is for a panel or a band inside the frame, not for the frame itself.
-A whole run of text — lines timed to speech, a lyric video, a kinetic-typography passage, a quote sequence — is add_text_sequence, one call. Design is opt-in: called with no look it lays a plain run — one readable face, one place in the frame, a short fade, no cards, no keyframe moves, the frame color untouched — which is what a bare "add the text" asks for. Name a look when the user asked for a designed run, and then the look is the design of the whole run, not one line: the frame color, the cards, and the ensemble the run walks across its length — faces, entrances, where successive lines land, and what each holds. Read the text-videos skill for the looks and the flow, and text-creativity for the fifty devices that keep a long run from reading flat. A designed run is composed in the call, never laid identical and then repaired element by element. A video needs no footage. Titles, shapes and stickers over a background color are a complete cut on their own: it plays, exports, and shares like any other. Build one by setting the background, then placing elements on the rows the stack needs — reach for footage only when the user asks for it.
+A whole run of text — lines timed to speech, a lyric video, a kinetic-typography passage, a quote sequence — is add_text_sequence, one call. Design is opt-in: called with no look it lays a plain run — one readable face, one place in the frame, a short fade, no cards, no moves, the frame color untouched — which is what a bare "add the text" asks for. Name a look when the user asked for a designed run, and then the look is the design of the whole run, not one line: the frame color, the cards, and the ensemble the run walks across its length — faces, entrances, where successive lines land, and what each holds. Read the text-videos skill for the looks and the flow, and text-creativity for the fifty devices that keep a long run from reading flat. A designed run is composed in the call, never laid identical and then repaired element by element. A video needs no footage. Titles, shapes and stickers over a background color are a complete cut on their own: it plays, exports, and shares like any other. Build one by setting the background, then placing elements on the rows the stack needs — reach for footage only when the user asks for it.
Titles (add_title / update_overlay): text, size (frame px; the design short side is 1080), font (${FONTS.map((f) => `${f.id}=${f.label}`).join(", ")}), weight (400/700), color, shadow, plate (translucent dark backdrop).
Shapes (add_shape): rect, ellipse, line, arrow. w/h are frame fractions; rect/ellipse take fill + fill_opacity, corner radius (rect), and an outline (stroke_color/stroke_width); line/arrow draw in \`fill\` with h as their thickness, and rotation gives them their direction (0° points right, 90° points down).
Stickers (add_sticker): a project image asset (generated cutouts in the Elements panel carry origin "sticker"); w is a frame-width fraction and height follows the source's aspect. Lottie JSON uploads become animated stickers that loop for the element's duration.
Custom stickers (create_sticker): one call generates the image, removes the background, adds the die-cut outline, and places it — use it when the user asks for a sticker of something they don't have (it spends credits like image generation).
Effects (add_effect): time-ranged treatments over the finished picture — the footage and everything laid over it. Two families, one list: the treatments (${EFFECT_TREATMENTS.join(", ")}) and the graded looks (${LOOK_EFFECTS.join(", ")}). Placed like any element and tuned with \`amount\` (update_overlay); an effect added over a clip opens covering that clip, and trims like anything else. One effect at a time reads best, amounts under ~0.5. Effects are stylized post treatments on a stretch of timeline; pure color — exposure, warmth, a cinematic or film palette on one clip — is the per-clip grading tools instead (color-grading skill), whose preset catalog is separate from the look effects.
-Advanced text (update_overlay): italic, align (multi-line), letter_spacing (em), line_height, stroke_color/stroke_width (em outline behind the fill), and richer shadows. Bundled Google families join the system set — ${GOOGLE_FONT_IDS.join(", ")} — and so do the user's own: a .ttf/.otf/.woff/.woff2 file dropped on the Library is offered in every project under a font id like "font:<id>". Editor_state lists the ones this account has under \`fonts\` — use an id from there instead of guessing at a family name, and when someone asks for a typeface that is not in the list, tell them the Library takes font files.
-Animation (set_overlay_animation): every element takes preset In/Out ramps (${OVERLAY_ANIM_STYLE_IDS.join(", ")} — typewriter for titles only; the per-letter styles sweep a title character by character), a Loop (${OVERLAY_LOOP_STYLE_IDS.join(", ")}) that runs its whole duration, and a Move that says what it does WHILE it holds. Entrances 0.3–0.6s read well; one loop per scene, sparingly; a move on the lines that matter. Every one of these is keyframe data — the same poses set_overlay_keyframes writes — so a named move lands as ordinary keys the user can drag, and anything the names do not cover is keyed directly.
+Advanced text (update_overlay): italic, align (multi-line), letter_spacing (em), line_height, stretch_x/stretch_y (glyph stretch multipliers, the side grips' axis-only resize), stroke_color/stroke_width (em outline behind the fill), and richer shadows. Bundled Google families join the system set — ${GOOGLE_FONT_IDS.join(", ")} — and so do the user's own: a .ttf/.otf/.woff/.woff2 file dropped on the Library is offered in every project under a font id like "font:<id>". Editor_state lists the ones this account has under \`fonts\` — use an id from there instead of guessing at a family name, and when someone asks for a typeface that is not in the list, tell them the Library takes font files.
+Animation (set_overlay_animation): every element takes preset In/Out ramps (${OVERLAY_ANIM_STYLE_IDS.join(", ")} — typewriter for titles only; the per-letter styles sweep a title character by character), a Loop (${OVERLAY_LOOP_STYLE_IDS.join(", ")}) that runs its whole duration, and a Move that says what it does WHILE it holds. Entrances 0.3–0.6s read well; one loop per scene, sparingly; a move on the lines that matter. All four are slots on the element, applied internally; the keyframe track (set_overlay_keyframes) is the separate power tier for motion the names do not cover, and slots compose over it.
Keyframes (set_overlay_keyframes): for motion no preset covers — a path across the frame, a slow push in, a drift that holds first. A key is a whole pose (position, scale, rotation, opacity) at a time in seconds from the element's start; the pose moves linearly between keys and holds outside them, and presets still compose on top. Two or three keys carry almost everything; reach for a preset first and keyframes when the user describes a specific path or timing. In the UI the diamond in the inspector adds a key at the playhead, and dragging the element then records into it. set_clip_keyframes is the same track on a video clip (any track): pans, push-ins, picture-in-picture flights, spins, and fades on the footage itself.
Masks (set_mask): trim any element or video clip to a shape — rect, square, circle, linear, mirror — with feather, invert, and its own keyframe track for reveals and wipes. The subject kind trims by the person in the shot (on-device segmentation; preview and export match): inverted sits the item behind the speaker, plain keeps it only on the speaker. Behind-speaker reads well when the speaker is clearly separated from the background; with no detectable person it degrades to the plain picture. Groups: the user can group elements (select several, Group in the inspector) — selecting one selects all, and moves/resize/rotate/timing ride together.
Composite builds: these primitives compose. Stacked overlay video copies, masks and their keys, pose keyframes, staggered starts, and shapes construct effects beyond any preset list. Given a reference (a screenshot or clip of an effect the user wants), reverse-engineer it: