How to Teach Coding Agents to Generate Motion Graphics Videos

    This article explores how to make coding agents produce usable motion graphics videos, such as product promos, UI walkthroughs, and device form-factor transition animations. It presents a five-layer pipeline (reference, understanding, generation, editing, and acceptance), explains how to build a searchable motion reference library with metadata, how to turn vague requests into structured shot lists, and how keyframe and easing settings shape motion quality. It also covers edit-and-rework workflows, common failure modes, an acceptance checklist, and current capability limits: reference clips usually provide only visual feel and notes rather than editable source projects, so rebuilding the animation around the reference rhythm is the right path.

    When coding tools move from writing code to doing design, motion video is becoming a new output format. This article takes a neutral view of how to make a coding agent produce product promo clips, interface walkthroughs, and device form-factor transition animations: first build a motion reference library with searchable metadata, then transfer the reference rhythm to a new topic through template replication, constrain shots, duration, and transitions with structured prompts, and finally use timeline editing and lasso-based changes for local rework. The article includes prompt examples, keyframe and easing configuration samples, common failure modes, and an acceptance checklist to help teams build a stable, reusable “conversation-to-motion” production pipeline. It also states the current capability boundary clearly: reference material usually provides only visual feel and explanatory notes, not an editable project, so rebuilding the animation rather than swapping in the material is the correct path.

    1. Why Video Is Harder Than Web Pages for Agents

    Web and prototype design output is static structure with a large margin for error. Motion video is continuous expression in the time dimension, and any timing misalignment is perceived directly by viewers. To make a coding agent produce usable motion, four problems must be solved at once: narrative structure, visual consistency, timing control, and editability.

    Narrative structure decides what the piece says. A product promo usually has to set the scene, introduce a conflict or pain point, present the solution, and close, all within a dozen or so seconds. Visual consistency decides whether it looks like one coherent work, covering unified color, corner radius, shadows, font weight, and icon style. Timing control decides whether the rhythm is right, involving how long each shot holds, the easing curves, and the overlap window of transitions. Editability decides whether changes are possible; if the output is an inseparable finished clip, any later tweak means rerunning the whole pipeline at very high cost.

    2. Overall Approach: A Five-Layer Pipeline

    A practical implementation can be abstracted into five layers:

    1. Reference layer: a motion reference library storing clips, durations, rhythm notes, and tags;
    2. Understanding layer: parsing natural-language requirements into a structured shot list;
    3. Generation layer: rebuilding keyframes and animation curves from the shot list;
    4. Editing layer: timeline, layers, and lasso-based local changes;
    5. Acceptance layer: automated checks of duration, resolution, frame rate, and style consistency.

    The reference layer is the most often overlooked. Reference clips should not just be “good-looking videos”; they should carry searchable metadata such as applicable scenario, shot count, average shot duration, transition type, dominant colors, and whether text layout is included. Only with complete metadata can the agent retrieve “by rhythm” instead of imitating at random.

    3. Structured Prompts: Turning Vague Requests into an Executable Shot List

    Natural-language descriptions often lack executability. It is better to require the agent to output a shot list first and only then start generation. Example:

    1. {
    2. "total_duration": 17,
    3. "canvas": {"width": 1080, "height": 1920, "fps": 30},
    4. "shots": [
    5. {"id": 1, "duration": 4.0, "action": "Windows stack up from the bottom", "easing": "ease-out", "note": "Stacking slows down"},
    6. {"id": 2, "duration": 1.2, "action": "A single click triggers the collapse", "easing": "ease-in", "transition": "scale+fade"},
    7. {"id": 3, "duration": 6.0, "action": "Device form factor unfolds, layout switches from single column to two columns", "easing": "spring", "note": "Keep the frame continuous"}
    8. ]
    9. }

    The value of a shot list is that it can be reviewed and diffed. Reviewers do not need to watch the full video; they only judge whether the duration allocation and transition types are reasonable. During iteration, a modified shot can also be located precisely.

    4. Keyframes and Easing: Where Motion Quality Comes From

    Most quality differences come from easing rather than assets. Linear motion looks mechanical, bounce curves look cheap, and overly strong elasticity distracts. The general practice is to use a decelerating curve for entrances and an accelerating curve for exits, and to add slight bounce with limited amplitude when a sense of weight is needed.

    1. // Example: window stacking and collapse
    2. const stack = shots.map((s, i) => ({
    3. from: { y: 120 * i, scale: 0.92, opacity: 0 },
    4. to: { y: 24 * i, scale: 1, opacity: 1 },
    5. delay: i * 60, // 60ms stagger creates rhythm
    6. ease: [0.22, 1, 0.36, 1] // decelerating curve
    7. }));
    8. const collapse = {
    9. to: { y: 0, scale: 1, opacity: 1 },
    10. duration: 380,
    11. ease: [0.55, 0, 0.85, 0.36] // accelerating collapse for stronger impact
    12. };

    If a collapse shot lacks impact, the cause is usually not the asset but three poorly tuned parameters: the collapse duration is too long, the easing is too flat, and there is no matching mask or blur transition. Compressing the duration into the 300-450 millisecond range and adding a slight scale and opacity change will visibly tighten the result.

    5. Editing and Rework: Dividing Labor Between Lasso Changes and Manual Editing

    Generated results rarely pass on the first attempt, so editing capability affects efficiency more than generation capability. A sensible split is: structural changes go through conversation (adding or removing shots, changing total duration), local tweaks go through the timeline and lasso (the position of one layer, the hold time of one text element), and precise alignment goes to manual editing (frame-by-frame audio-video alignment, edge cleanup, masks).

    In engineering terms, it is advisable to keep a snapshot for every change so a traceable version chain forms:

    1. v1 initial shot list
    2. v2 shot 2 duration adjusted 1.2s -> 0.9s
    3. v3 collapse easing changed to an accelerating curve
    4. v4 120ms cross-dissolve added to the two-column layout switch

    Without a version chain, multi-turn conversational edits quickly get out of control, and it becomes impossible to tell which version is better.

    6. Common Failure Modes and How to Avoid Them

    • Style drift: colors inconsistent across shots. Fix the palette and the corner-radius and shadow tokens in the shot list.
    • Sluggish rhythm: a single shot runs too long. As a rule of thumb, product demo shots should stay within 2-5 seconds.
    • Abrupt transitions: no overlap window. Keep 100-200 milliseconds of cross overlap between adjacent shots.
    • Unreadable text: font too small or hold too short; guarantee at least 1.5 seconds of readable time for key copy.
    • Not editable: only the finished clip is exported. Keep the layered project and the shot list as well.

    7. Acceptance Checklist

    Before delivery, it is advisable to check automatically: total duration error, resolution and frame rate, whether the first and last frames are the expected images, per-shot duration deviation, palette consistency, and readable time for key copy. These metrics can be scripted, which avoids subjective arguments.

    8. Capability Boundaries and Implementation Advice

    The core limitation of the current general approach is that reference material often provides only visual feel and text notes, with no editable source project. The correct path is therefore to “reference the rhythm and rebuild the animation” rather than replace the material. For implementation, start by building an internal library from a small number of high-quality reference clips, solidify the shot list and prompt templates, then chain generation, editing, and acceptance into a pipeline. On the cloud side, use object storage for assets by general category, a message queue to decouple rendering tasks, a container platform to host rendering and transcoding, and logging and monitoring services to track failure rate and elapsed time. This yields stable output and makes it fast to locate the specific shot and parameters when quality falls short.