Open source CapCut alternative.
TypeScript
feat(app): animations default to keyframes [rebuild]
David Le7adc0fffb5cb
diff --git a/site/src/cut/components/AnimationTiles.tools.ts b/site/src/cut/components/AnimationTiles.tools.tsindex 93f39d50..f9ac9798 100644--- a/site/src/cut/components/AnimationTiles.tools.ts+++ b/site/src/cut/components/AnimationTiles.tools.ts@@ -1,8 +1,8 @@/**- * The assistant's overlay-animation tools — the preset In/Out/Loop ramps the- * `AnimationTiles` grid picks from, and the keyframed pose track that lives- * under those presets in the inspector. The catalog spreads this list into- * the model's toolset and `aiTools.ts` keys its handlers on+ * The assistant's overlay-animation tools — the keyframed pose track that+ * carries motion precisely, and the preset In/Out/Loop ramps the+ * `AnimationTiles` grid picks from, which compose over it. The catalog spreads+ * this list into the model's toolset and `aiTools.ts` keys its handlers on* `OverlayAnimationToolName`, so the style ids the model can pass are exactly* the ones the tiles render and a removed or renamed tool breaks the build* until every side catches up.@@ -36,7 +36,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; typewriter animates titles only; ${GLYPH_ANIM_STYLE_IDS.join(", ")} move a title's letters one at a time, and move any other kind as one piece. 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; use set_overlay_keyframes when no named move fits, and both 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".`,+ `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; typewriter animates titles only; ${GLYPH_ANIM_STYLE_IDS.join(", ")} move a title's letters one at a time, and move any other kind as one piece. 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".`,inputSchema: obj({id: str("Overlay element id"),move: {@@ -82,7 +82,7 @@ export const OVERLAY_ANIMATION_TOOLS = [{name: "set_overlay_keyframes",description:- "Give an overlay element a keyframed pose track, for motion no named move covers (a specific path across the frame, a timing tied to the footage). Each key is a whole pose at a time measured in seconds from the element's own start; the pose moves linearly between keys and holds outside them. Omitted fields on a key take the element's current value. Pass an empty list to clear the track and return the element to its resting pose. Preset In/Out/Loop animation still composes on top, so a keyframed title can also fade in.",+ "Give an overlay element a keyframed pose track — the default way to animate one, because a key names the exact pose at the exact second where a preset ramp approximates it. Each key is a whole pose at a time measured in seconds from the element's own start; the pose moves linearly between keys and holds outside them. Omitted fields on a key take the element's current value. Pass an empty list to clear the track and return the element to its resting pose. Preset In/Out/Loop animation still composes on top, so a keyframed title can also fade in.",inputSchema: obj({id: str("Overlay element id"),diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.tsindex f0a73cde..23ba4289 100644--- a/site/src/cut/server/ai/catalog.ts+++ b/site/src/cut/server/ai/catalog.ts@@ -324,7 +324,7 @@ Someone points at a video — a file they imported, a link you brought in, a cli**Rebuild the text as elements.** One add_title per card — the words exactly as they read, the face from the graphics skill's font ids, size in px at 1080 wide, and x/y as the fraction of the frame it sits at (a lower-third card is around y 0.75, a centered statement 0.5). A run of lines timed one after another is add_text_sequence in one call. Match the case the reference uses; match its weight and its color against the frame behind it.-**Then the motion.** set_overlay_animation carries 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. set_overlay_keyframes when the move is a specific path. add_shape 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 — which is how the timing lands on the reference's own frames. 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. add_shape is the rest of the graphics: bars, cards, rules, a block of color behind a line.**Say what is skeleton.** Close by telling them what to drop in: how many shots, how long each one runs, and that the titles and timing are already built around them.`,@@ -358,8 +358,8 @@ Stickers (add_sticker): a project image asset (generated cutouts in the ElementsCustom 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 cut. Three families, one list: the picture treatments (${EFFECT_TREATMENTS.join(", ")}), the graded looks (${LOOK_EFFECTS.join(", ")}), and the audio treatments (${AUDIO_EFFECT_IDS.join(", ")}). A picture effect treats the footage and everything laid over it; an audio effect treats everything audible under its window at once — clip sound, upper-track sound and the soundtrack — so "make this bit sound like a phone call", "put an echo on that line", or "muffle the music here" is an effect element over that stretch, and a per-clip volume, fade or duck is the audio tools instead. A handover on the sound at a cut belongs to the transition on that cut — the audiocross style — not here. Placed like any element and tuned with \`amount\` (update_overlay), and trims like anything else: a picture effect dropped over a clip opens covering that clip, while an audio effect opens at the standard length wherever it was placed — a treatment on the sound is aimed at a moment, so give it the window you mean. 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, 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. A title takes one more: Words (${WORD_EFFECT_IDS.join(", ")}), which plays the line word by word — an emphasis travelling along a line that is fully up, or a build assembling the line as it is spoken. Entrances 0.3–0.6s read well; one loop per scene, sparingly; a move on the lines that matter. All of them 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.+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. A title takes one more: Words (${WORD_EFFECT_IDS.join(", ")}), which plays the line word by word — an emphasis travelling along a line that is fully up, or a build assembling the line as it is spoken. Entrances 0.3–0.6s read well; one loop per scene, sparingly; a move on the lines that matter. All of them are slots on the element, applied internally, and they compose over its keyframe track. A slot is the reach when the motion is per-letter or per-word — typewriter, the glyph sweeps, the word effects — which one pose track cannot express; what the whole element does is keyed.+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. This is the default way to animate an element: a key names the exact pose at the exact second, where a named ramp only approximates it. Two or three keys carry almost everything. 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 — ${MASK_SHAPE_KINDS.join(", ")} — with feather, invert, rounded corners on a box, and its own keyframe track for reveals and wipes. The pen kind takes an outline as points, for any region the fixed shapes miss: the gap framed between two hands, a doorway, a screen — read the region's corners off a captured frame in frame fractions, and stack a masked copy of the shot (a filter, a title) so it shows through only there. 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. Group and Ungroup are in the timeline toolbar (⌘/Ctrl+G and ⇧⌘/Ctrl+G).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:1. Read the reference as layers. For each visible piece, decide what it is: live footage, a cropped or repeated slice of the footage, a solid graphic, text, or empty background.@@ -452,10 +452,10 @@ Read this before any text-heavy job the user calls flat, boring, samey, or "not32. **Follow the subject.** Over footage, place words in the empty half of the shot and move them when the shot changes.## Motion — arrival and hold-**Everything here is keyframes.** Entrances, exits, loops and moves are one format: a pose (position, scale, rotation, opacity, letter-spacing) keyed over a normalized window with cubic-bezier easing, plus a range selector that hands the motion from one character to the next — the After Effects text-animator model, the one Lottie serializes. So a named preset and a hand-keyed track are the same object at different levels of convenience. Reach for a name first; key it directly when no name says what you mean.+**Everything here is keyframes.** Entrances, exits, loops and moves are one format: a pose (position, scale, rotation, opacity, letter-spacing) keyed over a normalized window with cubic-bezier easing, plus a range selector that hands the motion from one character to the next — the After Effects text-animator model, the one Lottie serializes. So a named preset and a hand-keyed track are the same object at different levels of precision. Key it directly by default — the track says what pose the element holds at what second, and lands the motion on the frame you mean. The names earn their place on per-letter and per-word motion, which a single pose track cannot express.33. **Arrival and hold are two decisions.** \`in_style\` is how it appears; \`move\` is what it does for the rest of its life. A line with only an entrance freezes the moment it lands.-34. **The moves** — each is a slot beside the entrance and loop, applied for the element's whole hold; the keyframe track stays free for the user's own paths:+34. **The moves** — each is a slot beside the entrance and loop, applied for the element's whole hold and composing over whatever the keyframe track does:${textMoveCatalog()}35. **Per-glyph entrances.** rise, drop, grow, flip, swivel, bounce, wave, converge, streak, tumble and scatter move a title's letters one at a time. They cost nothing extra and are the difference between a title and kinetic typography.36. **Typewriter for a reveal.** Slow it to two thirds of the line's hold so the text finishes typing just before it leaves.@@ -464,7 +464,7 @@ ${textMoveCatalog()}39. **Exit matters.** A run where every line simply cuts out feels cheap; a 0.2s fade or a converge out costs nothing.40. **Contrast the move to the entrance.** A violent entrance (slam, tumble) into a still hold; a soft entrance (fade) into a slow push. Both loud reads as noise.41. **Match the move to the beat.** punch and slam on hits, push and creep under sustained notes, float and breathe under held vocals.-42. **Key it yourself when no name says it.** set_overlay_keyframes takes whole poses in seconds from the element's start — a path across the frame, a hold-then-drift, a beat that lands on a specific hit in the music. Two or three keys carry almost everything, and a preset entrance still composes over them.+42. **Key it yourself.** set_overlay_keyframes takes whole poses in seconds from the element's start — a path across the frame, a hold-then-drift, a beat that lands on a specific hit in the music. It is the first reach for motion, because a key lands on the second you name: two or three carry almost everything, and a preset entrance still composes over them.## Frame and color43. **Cards as punctuation.** A full-frame color card behind each line, cycling — the color change IS the edit. lyric-card and pastel-pop do it; \`cards: true\` adds it to any look that has them.