# Motion graphics

**Custom-made first.** When you can run code, design the motion graphics and
sound effects for this video yourself, render them, and place them as uploaded
assets (*Custom motion assets and phone-only creators*, below). The deployed
recipes on this page and the `sfxPick` library are the fallback: for an agent
without a code runtime, or for a piece you cannot make.

Availability is gated by deployment. `video_overlays` accepts `addGraphic`,
`updateGraphic` and `removeGraphic` where graphics authoring is enabled. Do not
assume a locally implemented recipe is deployed on the production server.

The catalog contains `stat`, `chart` (bar, column, line, donut, progress),
`lowerThird`, `callout`, `checklist`, `mark`, `cta`, `quote`, `compare`, `timeline`,
`badge`, `socialProof`, `deviceFrame`, `kinetic`, `backdrop`, `mapPin` and `accent`.
Start with `style: clean` for a small supporting overlay or `glass` for a card.
Editorial, paper, technical, cinematic and pop are curated for stats, callouts,
quotes, comparisons, badges and kinetic text. An unsupported combination is
refused naming the field, the value sent and the recipes that offer it, or that
none of its kind does; a profile the project's `setMotionPolicy` supplied is
named as such. `presentation: fullFrame` explicitly requests a scene
surface; its content still avoids protected captions and controls. Backgrounds
may sit behind captions. Recipes choose motion, padding and type hierarchy.
A headline with no plate behind it is a `kinetic` graphic with `style: clean`,
`presentation: overlay` and `contrast: "none"`: the words alone over the
picture, for footage calm enough to read them on. It takes an explicit `box`,
and a refusal names the smallest one that holds the line. A `kinetic` graphic
needs `data.template`: `wordByWord`, `lineReveal`, `splitFlap`, `typewriter` or
`maskWipe`. Its `tone` describes the footage, not the ink: unset or `dark` gives
white ink for dark footage, `light` gives near-black ink for light footage.


Supply content in `graphic.data`, optional `graphic.id`, `durationMs`,
`position` (`auto`, `side-left`, `side-right`) and `contrast` (`auto` or `none`).
An explicit `box` is normalized to the output canvas and still must fit safely.
Do not shrink type below its minimum or change source framing to force a fit.
An omitted duration is allocated for entrance, reading and exit. An explicit
duration stays fixed and may be refused.

On servers advertising recipe version `222.2.0`, all 17 kinds have explicit
`.v3` presets for their curated style/presentation combinations. Through a `.v3`
preset (`preset: 'stat.glass.card.v3'`) content elements offer `compact`, `standard`
and `prominent`; backgrounds and decorative marks/accents keep their advertised
size. Without a preset each style keeps its one catalog size (`compact` as an
overlay, `standard` otherwise), and a refused size names the preset that has it.
An explicit box is a hard fit boundary.
Read `sizeResolved` and `layoutResolved` (version, arrangement and content parts)
for the admitted result. Layout part lengths use the 360px canvas-width reference.
For v3 device frames, `data.mediaFit` is `contain` by default or `cover` to crop
inside the screen. Optional `data.mediaPosition: {x, y}` uses 0..1 coordinates,
centered by default. These settings never stretch media or crop device chrome.
The resolved `mediaSlots` carry the fit and position for preview and export.

Read `graphics[]` after every batch and from `video_project`. It returns IDs,
recipe/version, final geometry, visible windows, resolved cue events, contrast
evidence, warnings and sound decisions. These are server-owned results, never
input fields. Final timings are milliseconds on the export clock, so `read`
and `describe` label them "Graphics (export clock)" and print the project
window beside any that a transition or a speed change moves. To place a
graphic at a word, anchor it at the word's project time (`anchor.ms`, the time
`read` prints) or its `wordId`; the server converts. Never add an
`exportOffsets` offset to an anchor; subtract the offset in force before
reusing a returned time as one. `durationMs` is time on screen, so a window
across an overlapping transition covers more project time than that.
`video_preview { graphicId }` shows its window.

Placement prefers open space beside the presenter, but subject overlap is allowed.
Missing presenter evidence returns `placementUnmeasured`; overlap returns
`overlapsFace`. Neither is a measured safety claim. Caption/platform protection,
minimum readable sizes and timing remain enforced for independent graphics.
`GRAPHIC_PLACEMENT_FAILED` means no requested box fits those constraints;
`GRAPHIC_FIT_CONFLICT` needs a larger valid box or less copy; its message names
the narrowest width that fits your box's height, or says no box on the frame
fits and why. A timing conflict names
what to move and a time that fits. Keep narration cues fixed.

Media slots accept owned uploads (`upload:ID`, or bare upload ID) and generated
artifacts (`artifact:MESSAGE_ID#INDEX`). URLs and external paths are not inputs.
Logos, thumbnails and avatars require images; device frames accept images or
muted video. Graphics media and overlays share one limit: 50 <!-- const: MAX_TIMELINE_OVERLAYS -->
in any ten minutes of film, and at most 3 <!-- const: MAX_VISIBLE_OVERLAYS --> on screen at once.
A graphic's images count at once for its whole span, except ones that take turns: a social
proof's avatar and its rotating reviews' avatars show one at a time, so the card counts
one. The server checks ownership again when preparing preview/export and signs fresh
URLs; no signed URLs enter saved graphics.

Tool-provider grammar uses `data.valueText` for badge text and
`data.emphasisPhrases` for quote/kinetic emphasis. Comparison `cells` use exactly
one of `{text: "..."}`, `{number: 0}` or `{checked: false}` per cell. API/readback
uses canonical scalar cells and `value`/`emphasis` after normalization.

Marks can target an explicit box, a supported element semantic part, a cached
static face, or a transcript word rendered by a word-level caption style.
Word marks attach to the actual caption span and inherit caption placement;
readback identifies the word and labels the bounds as a caption container,
not an estimated word rectangle. An unavailable/ambiguous target refuses.
Attached decorations inherit the target window and add no new reading hold.


Supporting graphics are silent by default. Preview the complete entrance,
readable hold and exit. An unmeasured contrast fallback uses protection but is
not a measured readability pass; `contrastUnmeasured` in the edit result says
why. `contrast: none` deliberately preserves the
requested treatment and bypasses automatic protection.

## Three examples

These are input examples; replace IDs and anchors with values from the project.

1. A number that lands on a spoken word:

```json
{"op":"addGraphic","anchor":{"wordId":42},"graphic":{"id":"views","kind":"stat","style":"clean","data":{"value":12500,"unit":"views","label":"This month"}}}
```

For a stat, the anchor is the counter landing. The resolver reserves its entrance
before that instant. An anchor inside that entrance (0 ms, say) is refused with
the earliest `ms` that works.

2. Three steps bound to three narration moments:

```json
{"op":"addGraphic","anchor":{"ms":1000},"graphic":{"id":"steps","kind":"checklist","durationMs":10000,"data":{"items":[{"id":"plan","label":"Plan"},{"id":"record","label":"Record"},{"id":"share","label":"Share"}]},"cues":[{"id":"plan-in","target":{"itemId":"plan"},"event":"reveal","anchor":{"wordId":12}},{"id":"record-in","target":{"itemId":"record"},"event":"reveal","anchor":{"wordId":25}},{"id":"share-in","target":{"itemId":"share"},"event":"reveal","anchor":{"wordId":40}}]}}
```

A checklist's `data` is `items` and an optional `marker` (`check`, the default, or
`number`); each `data` field in the tool schema names the kinds that take it.

When a cut, insert, reorder or trim moves the words cues are anchored to, the
window follows them keeping its length (its start on the first cue's word if
the cues move apart), or else keeps its previous window, or else keeps its
place on the film clock, whichever first holds all its cues; the edit result's
`graphicsNote` says when it did not follow. If none holds them, the edit is
refused with the word's new time and the window: send `updateGraphic` (a
longer `durationMs` or a new `anchor`) or `removeGraphic` in the same call.

3. A glass donut with stable series identity:

```json
{"op":"addGraphic","anchor":{"ms":3000},"graphic":{"id":"split","kind":"chart","style":"glass","data":{"type":"donut","series":[{"id":"audience","values":[72,28]}],"labels":["Returning","New"]}}}
```

Use `updateGraphic { id, graphic }` for changes and `removeGraphic { id }` to
delete. Item IDs survive reorder. Chart point-index cues require explicit
rebinding when series structure changes. Scoped edits require a provably
contained fixed window; otherwise use a project-level edit.

## Still twin

`compose_layers` accepts a `kind: graphic` layer with the same authored `graphic`
and an explicit normalized layer `box`. The server resolves the recipe's
completed state, including the final count. Standalone stills have no source
transcript/caption context, so omit word anchors and word-target marks. For an attached word mark, use a VideoTimeline still during its returned window. Still readback distinguishes explicit canvas
placement from measured presenter safety. Existing images/text/shapes remain
ordinary compositor layers. Preview the final image; unavailable contrast
evidence must remain labelled unmeasured.

## Browse motion graphics

Use the [visual catalog](https://hyviral.com/docs/mcp/graphics) or its [agent-readable index](https://hyviral.com/skill/graphics/index.md) to choose an exact recipe. Check [production availability](https://hyviral.com/skill/graphics/release.json), inspect an image or complete motion clip, replace sample content and owned-media references, author it, then preview the actual project. Catalog previews demonstrate the design; they do not prove placement, timing or readability for the user's footage.

## Custom motion assets and phone-only creators

Pieces designed for this video, its topic, its brand and its words, look and
sound better than the built-in catalog, and their timing is yours to the
frame. So the custom route is the default whenever your runtime allows it, and every
video gets a different set: be SUPER CREATIVE rather than reusing the last
edit's pieces. The catalog is the fallback, not the first reach.

The creator's device and the agent's execution environment are separate
constraints. A phone can be the creator's only device: Claude's app with code
execution on and storage.googleapis.com allowed is a runtime
(`references/byof.md`, *Fallback: allow the storage domain*). Check what yours can do;
a model name or a mobile chat alone does not establish it. HYVIRAL never runs
agent code, and an MCP connection does not itself supply a runtime.

Choose the route before promising a treatment:

| Available capability | Route |
|---|---|
| A runtime that runs Node and Python, and uploads files | **The default.** Load `hyviral-studio` (https://hyviral.com/skill-studio/SKILL.md) and make the pieces with its kit: transparent overlays, cutaways and the sound effects. |
| A runtime without the kit (no Node, or it cannot fetch the kit) | **Still custom.** Synthesize each sound in Python (noise and sine, shaped, written as a WAV), and draw a piece's frames with the libraries you have, encoded to VP9 with alpha when ffmpeg is there. Use the catalog only for a piece you cannot make. |
| HYVIRAL MCP tools only, or no file upload | **The fallback.** Deployed graphic recipes, text, owned media, compositor stills, overlay keyframes and `sfxPick` sounds; HYVIRAL renders the final video. Tell the user custom pieces need a code runtime, and never make desktop software a hidden requirement for a phone-only creator. |

Prove the route before you promise it: one short piece and one sound, each
rendered, encoded and through one upload. If a step fails, take the next row
and say which capability was missing.

Design one short proof at the intended panel dimensions before the full
sequence: consistent palette and type, layered highlights and shadows,
eased entrances, readable holds, purposeful exits, and sound tied to measured
speech or picture events. Shape each sound for what it marks: its length,
pitch and weight follow the moment, quiet under speech. Keep editable source,
fonts/assets and timing notes.

Use transparent PNG layers for artwork whose position and scale should remain
editable through `boxKeyframes`. Use an encoded video for complex internal
motion. To keep its background transparent, encode it as VP9 (or VP8) with
alpha in WebM and place it by its `uploadId`: `video_project` then shows
`alpha: true` on the overlay. A transparent clip is at most 60 s long, 1,920 px
on its long edge and 200 MB. Ordinary H.264 MP4 has an opaque background.
Alpha in another codec (ProRes 4444, QuickTime Animation, PNG in MOV) uploads
as an ordinary video: `upload_complete` adds a note with the line that
converts it, and placing it as an overlay is refused until you do:
`ffmpeg -i input.mov -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 30 -an output.webm`.
Safari previews a transparent overlay opaque; the export is unaffected.
Preview crop and framing.

Each piece is one media overlay: 50 <!-- const: MAX_TIMELINE_OVERLAYS --> in any ten minutes
of film, and at most 3 <!-- const: MAX_VISIBLE_OVERLAYS --> on screen at the same moment
(`references/video.md`, *Limits per ten minutes of film*). Pieces that sit close
together, a lower third and the sticker that lands on it, can be rendered into
one transparent WebM within the 60 s, and it counts once. The price is that
they move together: changing one later means rendering that WebM again.
A sound effect is its own WAV, one file per sound, at most 60 s and 50 MB;
render the pieces themselves without sound, so every effect stays editable.

Upload a transparent WebM or a WAV with `upload_request` `purpose: "asset"`
(kept 30 days, so export within them or upload it again; a PNG layer or an
MP4 cutaway uploads as footage), GET the ticket, send the bytes, then
`upload_complete` (`references/byof.md`). Place a piece with
`video_overlays` `addOverlay` by its `uploadId`; set timing, source offset, framing and keyframes
as described in `references/text-and-motion.md`. Place a sound with
`video_audio` `addSound` by its `uploadId` at its `atMs`. Preview
the full movement with sound, then `video_export` and poll to `delivered`.

Record provenance in the handoff: where assets were authored, what HYVIRAL
animated and rendered, and what remains editable. An imported video's internal
motion is baked in; changing it requires re-rendering its source. Separate
image layers remain movable. A nested project's layers remain editable in that
source project, not inside its flattened export. Never label custom asset
authoring as native MCP code execution.

## A graphic has one job

<!-- budget: 250 -->
Add a graphic, a piece you made or an `addGraphic` recipe, only for what the
captions cannot carry: a relationship (`compare`, `timeline`), an example, or a number
(`stat`, `chart`). The common
redundancy is one hook in three forms: a title, a `kinetic` line and the
caption under them. The words carry a hook; it rarely needs a graphic.

Keep one main graphic per beat and leave room between graphics. Vary the kind
when the content changes, not to show range: a second number is still a
`stat`. Before export, name each graphic's job in one line; a graphic with no
job to name comes out.

At most two graphics can be visible at once (`GRAPHIC_VISIBLE_LIMIT_EXCEEDED`
refuses a third) and twelve fit in any ten minutes (each receipt's *Limits*
line). Aim for one, no text beside it (`references/text-and-motion.md`, *One
editorial element at a time*).

On a talking head, take the smallest size the recipe advertises
(`size: "compact"` where offered) and leave `position` on `auto`, which prefers open
space beside the speaker, or pick a side; then check the face is clear on a
`video_preview` frame. When the footage should stay readable through a
graphic, choose `style: glass`: the glass cards, `lowerThird`, `badge` and
`cta` chip sit on a translucent blurred plate, and the glass `mark` and
`accent` have no plate. A glass `backdrop` is a full-frame wash, the `tone`
colour at 60% over whatever is behind it; a `clean` one, or a `preset`
ending in v2 or v3, is opaque.

## Match the film: palette, variety, motion

<!-- budget: 250 -->
Take each `video_overlays` `addGraphic` piece's `accent` from the footage it
sits on, a colour already in the shot (wardrobe, set, brand), not the recipe's
sample colour, and keep one accent family across a film. Look at a
`video_preview` frame of the shot before choosing it.

Vary the kind with the content across a film. A film whose every piece is the
same card in the same corner reads as a template.

A still diagram that only slides in and out is not motion. Prefer a piece whose
parts move while it is on screen (*A graphic moves for its whole time on
screen*). An image you place yourself with `addOverlay` can be moved, resized,
pulsed and rotated, but its insides cannot animate. When a custom piece needs
internal motion, place it as a transparent video (VP9 or VP8 with alpha in
WebM, *Custom motion assets and phone-only creators*; any other video overlay
is opaque), build its states as separate images and show them
in turn, one at a time, or render the animation over the same source frames
and place that clip as an opaque overlay on exactly the frames it replaces.
For such a window, keep the source's own clock and frame rate when you cut it
(a 29.97 fps source drifts a frame under a naive conversion), and compare its
first and last frame against the source before accepting it: a one-frame
offset shows as a jump.

## A graphic moves for its whole time on screen

<!-- budget: 250 -->
Give each part of a graphic a cue on the word that names it. Without cues
every part reveals right after the entrance and holds, unless spread (below);
an entrance alone is not motion.

A cue is `{ id, target, event, anchor }`; `anchor` is exactly one of
`{ wordId }` or `{ ms }`. `reveal` shows a part. `highlight` emphasises it and
stays on; a timeline has one active part, so there it moves the ring and the
counter to that milestone. A milestone's `reveal` cue moves them too, 0.27 s
later, unless a `highlight` or `tick` does. `tick` draws a timeline
milestone's dot and makes it active, a checklist item's check or number, or
a compare row's cell marks. Targets:

- `checklist`, `timeline`: `{ itemId }`, an item or milestone id; reveal, tick, highlight.
- `compare`: `{ rowId }`; reveal, tick, highlight.
- `chart`: `{ seriesId, pointIndex? }`; reveal, highlight.
- `socialProof` with rotating items: `{ itemId }`; reveal, highlight.
- Other kinds: `{ stage }`; reveal, highlight.

A timeline that steps 01/03, 02/03, 03/03 on the narration, one `highlight`
per milestone:

```json
{"op":"addGraphic","anchor":{"ms":2000},"graphic":{"id":"story","kind":"timeline","durationMs":9000,"data":{"orientation":"horizontal","milestones":[{"id":"idea","label":"Idea"},{"id":"launch","label":"Launch"},{"id":"scale","label":"Scale"}]},"cues":[{"id":"idea-on","target":{"itemId":"idea"},"event":"highlight","anchor":{"wordId":8}},{"id":"launch-on","target":{"itemId":"launch"},"event":"highlight","anchor":{"wordId":19}},{"id":"scale-on","target":{"itemId":"scale"},"event":"highlight","anchor":{"wordId":33}}]}}
```

Its window opens at 2 s, so word 8 must play a little over 0.5 s later. Add
`reveal` cues only when the labels should appear one by one, each on an
earlier word than that milestone's `highlight`.

Check it across its whole window: `video_preview` `atMs` frames near the
start, the middle and the end of its `startMs`-`endMs`, each showing a
different state.

## Cue timing rules

<!-- budget: 250 -->
There is no hold per part; the window has to allow:

- A `reveal` on an item, row, milestone or series lands no earlier than the
  entrance after the window starts: about 0.3 s for an overlay, 0.4 s for a
  card, 0.6 s for a paper or pop card. A `highlight` or `tick` on a part with
  no `reveal` cue also waits for that part's own reveal: a little over 0.5 s
  for an overlay, 0.7 s for a card, 0.9 s for a paper or pop card.
- After the last cue the window still needs the reading time of the whole
  graphic plus its exit: about 2 s for a short English overlay. Long labels
  need longer, more so in Portuguese and German. A milestone stepped by its
  `reveal` needs 0.27 s more.
- Cues on different parts may be as close as you like, except rotating
  `socialProof` reviews, which need each review's reading time between them,
  and a stat's `delta`, which waits for the counter to land. Two cues on the
  same part need about 0.3 s between them: a `highlight` or `tick` waits for
  that part's `reveal` to finish, so both on one word are refused.

With no `anchor` the window opens at 0, stretched to its cues; when `durationMs`
cannot reach a cue from 0, it opens just before the first cue.

A refused window names what to move and a time that fits, else lengthen
`durationMs` or cut parts.

## Parts one by one without cues

<!-- budget: 250 -->
Where it is enabled, a `checklist`, `timeline`, `compare` or `chart` added
with `video_overlays` `addGraphic` shows its parts one by one across its time
on screen. It needs:

- An explicit `durationMs` with room for at least 0.6 s between parts, plus
  the reading time and the exit. For three parts that is about 4 s for a
  checklist or timeline, 6 s for a compare, 7 s for a chart. Without
  `durationMs` the parts appear together.
- No cue. One authored cue keeps the timing exactly as you cued it, so cue
  the parts yourself when they must land on specific words.

On a timeline the ring and the counter advance with each milestone, starting
from `data.activeIndex` when you set it.

`motion: { parts: "packed" }` keeps the parts together. `motion: { parts:
"spread" }` in `updateGraphic` opts in a graphic added earlier; where the
feature is off, `motion.parts` answers `GRAPHIC_PART_TIMING_DISABLED`.

Nothing is refused when the window is too short: the parts stay together.
Read the graphic back to check: `lifecycleIntent.partTiming: "spread.1"` says
the rule applies, and `timingResolved.events` holds one `reveal` per part at
its own time. Reveals bunched right after the entrance mean the window was too
short: lengthen `durationMs`.

Leave `motion.profile` and `motion.idle` off unless the chosen recipe lists
that value: `expressive` exists on paper and pop cards, `ambient` idle only on
backdrops. `compare` with `data.variant: "table"` needs a card or
`presentation: "fullFrame"`; an overlay offers `thisThat` and `beforeAfter`.
