# Motion

<StatusBadge status="available" /> `format: motion` turns a story into a **film**: every
scene is a **shot**, played by an animated block (title, chapter, statement, stat, list, compare
bars, UI mock, UI scene, text card, sprite, pixel, bars, line) in `16:9`, `1:1`, `9:16` or `4:5`.

The Markdown syntax below and its parser are ready (`@recit/motion/source`). A film plays in a page
with `<StoryEmbed slug="…" format="motion" />`, and [motion.recit.dev](https://recit.dev/motion) shows the
gallery in every aspect.

A motion story is written like a deck: front matter, scenes separated by `---`, attributes on the
separator, `:::notes`. There is no second syntax. The Markdown is read through a **closed inference
table**: a scene whose shape matches no row is an error with its line number, never a guess.

## A minimal story

```md title="hello.story.md"
---
title: Hello, Récit
format: motion
aspectRatio: 9:16
theme: warm-editorial
---

--- id=open

Récit

# Films from a JSON file.

--- id=why

One film. One engine. Two render paths that **match**.

:::notes
Voice-over: lorem ipsum dolor sit amet.
:::

--- type=stat id=proof hold=1

# 30s

vertical film

_rendered locally_
```

The first scene is a `title` (a line, then a `#` heading), the second a `statement` (one paragraph,
the **bold** run is underlined in the accent), the third a `stat`, which is never inferred and so
declares `type=stat`.

## Scenes and attributes

Each scene starts with a separator. Its attributes are the canonical way to set a scene:

```md
--- type=stat id=proof hold=1
```

| Attribute     | Role                                                                                                                  |
| ------------- | --------------------------------------------------------------------------------------------------------------------- |
| `id`          | stable id of the scene, used by edits. Default: `s1`, `s2`…                                                           |
| `type`        | block of the scene. Inferred from the content when absent, except `stat`                                              |
| `dur`         | duration in seconds, instead of the computed reading time                                                             |
| `hold`        | extra seconds held after the motion settles                                                                           |
| `accent`      | accent colour of this scene alone, replacing the theme accent (highlighted bar, curve, underline of emphasised words) |
| `motion`      | Ken Burns movement of an image: `zoom-in`, `zoom-out`, `pan-left`, `pan-right`                                        |
| `audio`       | audio track of this scene alone (a recorded voice), relative to the story; experimental                               |
| `layout`      | deck layout: `cover` is a `title`, `section` a `chapter`, `quote` a `statement`                                       |
| any other key | a prop of the block (`kicker`, `number`, `unit`, `caption`…), checked by block                                        |

A value with spaces is quoted: `caption="One reply, sent and logged"`. An attribute that is not a
prop of the block is an error (`unknown attribute "color"`), and so is a prop set both by an
attribute and by the content.

`accent=` sets the accent colour of one scene without changing the rest of the film:

```md
--- type=bars accent=#0f766e
```

A scene that holds a single local image becomes a `panel` shot sized from the file, with optional
`motion=` on the separator:

```md
--- motion=zoom-in

![Lorem](photo.jpg)
```

### HTML comment alias

An HTML comment on the first line of a scene is an alias of the separator attributes. It stays
invisible on GitHub:

```md
---

<!-- type: stat, id: proof, hold: 1 -->

# 30s

vertical film
```

When both set the same key, the separator wins. Rewrites always emit the separator form.

## Inference table

A scene without `type` is read by its shape. The table is closed: a shape that is not listed is an
error.

| Markdown shape                                          | Block          | Props                                                                                                 |
| ------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------- |
| `# Heading` alone                                       | `title`        | heading → `text`                                                                                      |
| a line, then `# Heading`                                | `title`        | line → `kicker`, heading → `text`                                                                     |
| `## Heading` alone                                      | `chapter`      | heading → `title`; `## 01 · Title` → `number` and `title`                                             |
| one paragraph                                           | `statement`    | text → `text`, **bold** runs → `emphasis`                                                             |
| optional heading, then a bullet list                    | `list`         | heading → `title`, items → `items`                                                                    |
| optional heading, then a `label`/`before`/`after` table | `compare-bars` | heading → `title`, rows → `rows`, `unit` as an attribute                                              |
| `![alt](src)` alone                                     | `panel`        | local image → `image` (sized from the file), optional `motion=`                                       |
| `type=stat`, never inferred                             | `stat`         | `#` heading → `value`, line → `label`, _italic_ or quote → `caption`                                  |
| `type=ui-mock`, `type=ui-scene`, `type=still`           | same           | a ` ```yaml ` block holds the props (`still` animates an SVG figure)                                  |
| a `> quote` of one paragraph                            | `statement`    | as one paragraph                                                                                      |
| `:::textcard{variant=…}` alone                          | `textcard`     | the card's Markdown and attributes ([Text cards](#text-cards))                                        |
| `:::dialogue{cast=…}` alone                             | `textcard`     | a `quote` card: the line → `text`, the speaker's name from the bible → `attribution`                  |
| `::sprite{…}` alone, optional caption paragraph         | `sprite`       | attributes of the directive ([Sprite sheets](#sprite-sheets))                                         |
| ` ```pixel ` fence, optional caption paragraph          | `pixel`        | legend and grid → `legend` and `grid`, fence attributes ([Pixel art](#pixel-art))                     |
| `::pixel{gen=sprite …}`, optional caption paragraph     | `pixel`        | generated `grid` and `legend`, directive attributes ([Pixel art](#pixel-art))                         |
| `type=bars`, never inferred                             | `bars`         | a ` ```yaml ` block holds `items` and optional props ([Bars and line charts](#bars-and-line-charts))  |
| `type=line`, never inferred                             | `line`         | a ` ```yaml ` block holds `points` and optional props ([Bars and line charts](#bars-and-line-charts)) |

The heading of a `list` or a `compare-bars` may have any level. With an explicit `type`, a block
also accepts its close variants: `type=title` (or `layout=cover`) takes the kicker before or after
the heading, and `type=chapter` (or `layout=section`) takes a `#` heading.

### Blocks

```md
--- id=chapter

## 01 · How it works

--- id=list

## Three steps

- Reads the thread
- Drafts a reply
- You hit send

--- id=compare unit=m

## Response time

| label  | before | after |
| ------ | -----: | ----: |
| manual |     42 |     3 |

--- type=stat id=stat

# 92%

replies drafted

_before a human opens the thread_
```

Numbers in a `compare-bars` table are numbers: `42`, `3.5`, `-2`. Anything else is an error, since
no metric is ever made up.

On screen, a `compare-bars` shot puts its `title` above the chart, as `bars` and `line` do, and
names its two bars in a legend under it: **Before** and **After**, or **Avant** and **Après** when
the story's language is French. The legend sits at the size of the row labels, so the two bars are
never told apart by their colour alone.

### Text cards

A scene made of one `:::textcard{variant=…}` — or `--- type=textcard variant=…` on the separator
with the card's Markdown directly in the scene — plays as a `textcard` shot (`motion` and `webstory`
only in v1): a card of text fitted to the frame, animated with the entrance of the block its variant
dresses (`statement`, `title`, `stat` or `list`).

```md
--- id=quote

:::textcard{variant=quote background=gradient}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

— Lorem Ipsum
:::
```

See [Text cards](/formats/webstory/overview#text-cards) on the webstory page for the five variants,
content shapes and attributes (`variant`, `background`, `source`, `id`, `mark`). A `mark` (a
watermark) stays still in the bottom corner of the safe area while the text enters.

### Sprite sheets

`::sprite{character pose}` draws one pose (one row) of a character's sprite sheet — declared with
`::sheet{src layout}` in [the bible](/documentation/scenario/bible) named by `cast:`, or passed
directly with `src=` and `layout=` — by framing its cell through an SVG `viewBox` over the sheet. As
a compiled HTML directive (such as a [`webstory`](/formats/webstory/overview#cards) card), under
`prefers-reduced-motion`, or when `frame=` is set, it shows a still image (`frame`, `0` by default).
In a film without `frame=`, a scene holding one `::sprite{…}` and an optional caption paragraph (or
`--- type=sprite cast=lorem pose=waving` on the separator) plays the row's frames from their
cumulative durations: two plays of a `loop` pose, or one play of a `once` pose holding its last
frame.

```md
--- id=hello

::sprite{character=lorem pose=waving alt="Lorem, waving"}

Lorem waves, then holds.
```

| Attribute   | Values                                                                                                 | Default              | Role                                                                                                     |
| ----------- | ------------------------------------------------------------------------------------------------------ | -------------------- | -------------------------------------------------------------------------------------------------------- |
| `character` | character `id` in `cast:`                                                                              | none                 | Character of [the bible](/documentation/scenario/bible) with a `::sheet` (`character` or `src` required) |
| `src`       | local path or URL                                                                                      | from `character`     | Sprite sheet image when `character` is not used                                                          |
| `layout`    | `codex-pet-v1`                                                                                         | `codex-pet-v1`       | Sheet grid and row timings (1536×1872 px, 8×9 cells of 192×208 px)                                       |
| `pose`      | `idle`, `running-right`, `running-left`, `waving`, `jumping`, `failed`, `waiting`, `running`, `review` | `idle`               | Row of `layout` to show                                                                                  |
| `loop`      | `loop`, `once`                                                                                         | row's playback       | Overrides the row's playback (`waving`, `jumping` and `failed` default to `once`; the others to `loop`)  |
| `frame`     | non-negative integer (`0`, `1`…)                                                                       | `0` (still) / played | Fixed frame index in `pose` (`0` by default in still cards and under `prefers-reduced-motion`)           |
| `alt`       | string                                                                                                 | none                 | Accessible description (`role="img"`); omitting or blanking it emits a `sprite-alt` warning              |
| `caption`   | string                                                                                                 | none                 | Caption under the sprite (or one paragraph below `::sprite` in a film, never both)                       |
| `id`        | string                                                                                                 | none                 | Stable id of the image across languages                                                                  |

### Pixel art

The `pixel` block draws a pixel-art sprite from data — a character grid and a colour legend, with no
image file — as crisp-edged SVG (`shape-rendering="crispEdges"`, merged `<rect>` runs per colour).
With `reveal=scan`, its rows draw from top to bottom over `1` s; with `reveal=dissolve`, its cells
appear in a fixed scattered order over `1` s; multi-frame grids play at `fps` (`4` by default) and
keep the scene on screen for the reveal plus two loops of the frames, or of the colour `cycle` when
it is longer (`caption` fades in once drawn and is read for duration; under
`prefers-reduced-motion`, frame `0` is held with all rows drawn).

Two Markdown forms name a `pixel` scene (`type=pixel` on the separator is optional), each followed
by an optional caption paragraph (never both `caption=` and a paragraph):

1. **A ` ```pixel ` fenced block** for a hand-drawn sprite. The opening fence takes `key=value`
   image attributes (`id`, `alt`, `caption`, `scale`, `fps`, `reveal`, `cycle`). Inside the fence,
   write the legend first, one `char = colour` per line (`char` is one non-space character; `colour`
   is `transparent`, a theme token — `bg`, `surface`, `text`, `muted`, `accent`, `data.peach`,
   `data.mint`, `data.beforeBar`, `data.beforeNum`, `data.afterBar`, `data.afterNum` — or a hex
   colour `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`), then a blank line and the grid of equal-width
   rows (up to `128×128` cells). Additional grids separated by blank lines are animation frames of
   the same size (up to `32` frames).
2. **A `::pixel{gen=sprite …}` leaf directive** for a deterministic sprite generated from a seed
   (32-bit integer PRNG). It takes the recipe attributes below alongside the image attributes (`id`,
   `alt`, `caption`, `scale`, `fps`, `reveal`).

````md
--- id=hand-drawn

```pixel id=sprout alt="Lorem sprout, waving" fps=4 reveal=scan
. = transparent
k = text
g = accent
m = data.mint

...kk...
..kggk..
.kggggk.
..kmmk..
...kk...
...mm...

...kk...
..kggk.k
.kggggkk
..kmmk..
...kk...
...mm...
```

Dolor sit amet.

--- id=generated

::pixel{gen=sprite seed=lorem variants=2 body=accent id=figure alt="Lorem figure, generated from a seed" fps=2}

Ipsum, from a seed.
````

| Prop      | Values                                                                                      | Default  | Role                                                                                                                                                   |
| --------- | ------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `grid`    | `string[]` or `string[][]` (`1`–`32` frames, up to `128×128` equal-width rows)              | required | Rows of one frame, or frames of rows, built from the fence or `::pixel` recipe                                                                         |
| `legend`  | `Record<char, colour>` (`transparent`, theme token or `#rgb`/`#rgba`/`#rrggbb`/`#rrggbbaa`) | required | Maps each single non-space grid character to a colour                                                                                                  |
| `id`      | non-empty string                                                                            | none     | Stable id of the image across languages                                                                                                                |
| `alt`     | non-empty string                                                                            | none     | Accessible description (`role="img"`); omitting or blanking it emits a `pixel-alt` warning (an error under `--strict`)                                 |
| `caption` | non-empty string                                                                            | none     | Line under the sprite, read for duration (or one paragraph below the fence or directive, never both)                                                   |
| `scale`   | `auto`, integer `1`–`64`                                                                    | `auto`   | Display size in px per cell; `auto` fits the frame                                                                                                     |
| `fps`     | number `> 0` and `<= 60`                                                                    | `4`      | Frames per second of a multi-frame grid                                                                                                                |
| `reveal`  | `scan`, `dissolve`, `none`                                                                  | `none`   | Entrance animation over `1` s: `scan` draws rows top to bottom, `dissolve` shows cells in a fixed scattered order; `none` shows everything immediately |
| `cycle`   | `2`–`16` legend keys, each once (`cycle=abc`)                                               | none     | Colour cycling: each key takes the colour of the next one in the list, one step per frame at `fps`, as water or fire in pixel art                      |

Recipe attributes of `::pixel{gen=sprite …}` and `::pixel{gen=noise …}`:

| Attribute  | Values                                                                            | Default    | Role                                                                                               |
| ---------- | --------------------------------------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------------- |
| `gen`      | `sprite`, `noise`                                                                 | required   | Seeded generator: a mirrored character (`sprite`) or a scattered texture (`noise`)                 |
| `seed`     | integer `0`–`4294967295`, or non-empty string up to `64` characters               | required   | Seed of the deterministic 32-bit generator                                                         |
| `mask`     | `humanoid`, `creature`, or equal-width rows of `.` `#` `o` `?` `*` joined by `\|` | `humanoid` | Half-mask sampled by the seed (`.` empty, `#` outline, `o` body, `?` body/empty, `*` body/outline) |
| `mirror`   | `x`, `y`, `xy`, `none`                                                            | `x`        | How `mask` is mirrored into the sprite (within `128×128` cells after mirroring)                    |
| `palette`  | `ink`, `moss`, `dusk`, `ember`, `tide`                                            | none       | Named palette: its `outline`, `body` and `shade`; a colour written beside it wins                  |
| `outline`  | `transparent`, theme token or hex colour                                          | `text`     | Colour of `#` cells and empty 4-neighbours around the body                                         |
| `body`     | `transparent`, theme token or hex colour                                          | `bg`       | Colour of `o` and sampled body cells                                                               |
| `shade`    | `transparent`, theme token or hex colour                                          | none       | Optional colour for body cells with no body cell directly below                                    |
| `variants` | integer `1`–`32`                                                                  | `1`        | Frame count: frame `1` is the base sprite, subsequent frames re-sample `*` cells                   |

`gen=noise` draws a seeded texture for a background or a starfield: about `density` percent of its
cells take `body` (half of those take `shade` when it is set), the others stay transparent, with no
outline. Each variant is drawn again from its own seed. It refuses `mask`, `mirror` and `outline`,
and `gen=sprite` refuses the three attributes below.

| Attribute | Values            | Default | Role                                |
| --------- | ----------------- | ------- | ----------------------------------- |
| `width`   | integer `1`–`128` | `16`    | Columns of the texture              |
| `height`  | integer `1`–`128` | `16`    | Rows of the texture                 |
| `density` | integer `0`–`100` | `50`    | Percent of cells filled with `body` |

```md
::pixel{gen=noise seed=stars width=32 height=18 density=8 body=accent variants=2 fps=2 alt="Lorem starfield"}
```

### Bars and line charts

`bars` draws `1` to `12` vertical bars rising from the bottom on a shared axis (`0.3` s start,
`0.08` s stagger, formatted values fading in above each bar). `line` traces a polyline curve of `2`
to `60` points from left to right in the accent colour (`0.3` s to `1.5` s), with horizontal axis
labels (first, last, and middle above `6` points) and a value callout on the active point.

Neither block is inferred from a Markdown table (`@recit/motion/source` only reads
`label | before | after` tables as `compare-bars`). A scene declares `type=bars` or `type=line` on
the separator and passes its `{ label, value }` rows in a ` ```yaml ` (or ` ```json `) block
(`items` for `bars`, `points` for `line`); scalar props (`title`, `unit`, `highlight`, `source`) may
sit in the YAML mapping or on the separator. When the CLI builds a `format: motion` story with
`data:` tables, an untyped `::chart{type=bar …}` (`1` to `12` non-negative single-series rows
without gaps) or `::chart{type=line …}` (`2` to `60` single-series points without gaps) also
compiles to a `bars` or `line` shot, taking the scene's first heading as `title` (other chart shapes
stay `still`). A scene with a `:::form{url=…}` is the film's end screen, a `still` of its QR code
and address ([Forms](/documentation/writing/forms#at-the-end-of-a-film)).

````md
--- id=bars type=bars

```yaml
title: Lorem ipsum
unit: "%"
highlight: Sit
source: Lorem dataset, 2026
items:
  - label: Lorem
    value: 12
  - label: Ipsum
    value: 28
  - label: Sit
    value: 34
```

--- id=line type=line

```yaml
title: Dolor sit amet
unit: "%"
highlight: Mar
source: Lorem dataset, 2026
points:
  - label: Jan
    value: 12
  - label: Feb
    value: 19
  - label: Mar
    value: 27
```
````

| Prop        | Block          | Values                                                               | Default                      | Role                                                                                               |
| ----------- | -------------- | -------------------------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------- |
| `items`     | `bars`         | `1`–`12` `{ label: string, value: number }` rows (`value >= 0`)      | required                     | Bars in order on a shared axis (`label` non-empty)                                                 |
| `points`    | `line`         | `2`–`60` `{ label: string, value: number }` rows (negatives allowed) | required                     | Curve points in order along the horizontal axis (`label` non-empty)                                |
| `title`     | `bars`, `line` | string                                                               | none                         | Label shown above the chart                                                                        |
| `unit`      | `bars`, `line` | string                                                               | none                         | Unit suffix formatted with values (such as `"%"`)                                                  |
| `highlight` | `bars`, `line` | string                                                               | none (`line` calls out last) | `label` of the bar drawn in the accent colour, or of the point marked with an accent dot and value |
| `source`    | `bars`, `line` | non-empty string                                                     | none                         | Source line drawn under the chart                                                                  |

### A described character (preview)

A story whose front matter names a bible with `cast:` can play a character the bible describes (its
`model`, see [Images of an animation](/documentation/scenario/animation-frames)): in a pose, or
playing one of its cycles from the start of the scene. The scene attributes name it, or one
`::character{…}` and an optional caption line:

```md
--- id=hello type=character cast=lorem animation=hello

--- id=still cast=lorem pose=waving

::character{expression=joy render=pix}

Dolor sit amet.
```

`animation=` is a cycle of the model, `pose=` and `expression=` hold a pose instead, `render=` picks
a `vector`, `pixel` or `frames` render of the model and `variant=` one of its variants (a `frames`
render plays the images generated for the animation, see
[Images of an animation](/documentation/scenario/animation-frames)); anything the model does not
declare is an error with its line. The CLI resolves the character to its model and the film carries
it whole, so the player reads no file. A scene stays for two plays of a looping cycle, one of a
cycle played once; under `prefers-reduced-motion`, the first image is held. The block needs
`@recit/character`, an optional peer of `@recit/motion-blocks`, and a film without a character
leaves it out of the player.

### The ` ```yaml ` escape hatch

A scene made of one ` ```yaml ` (or ` ```json `) block takes its props from it, whatever the block.
Everything a `film.json` can say stays possible in Markdown, including the blocks of a third-party
pack. The separator must name the block with `type=`, and scalar props may still be attributes:

````md
--- type=ui-scene id=scene chrome=app caption="One reply, sent and logged"

```yaml
states:
  - id: skeleton
    hold: 1
  - id: loaded
    hold: 2.5
root:
  kind: col
  children:
    - kind: bar
      w: 50%
```
````

## Voice-over

`:::notes` becomes the `voiceover` of the scene: the text read over the shot, or its caption. It is
never drawn by the blocks. A voice-over longer than the text on screen keeps the scene on screen
longer (its words at `wordsPerSecond`).

```md
--- id=why

One film. **One engine.**

:::notes
Voice-over: lorem ipsum dolor sit amet.
:::
```

Each voice-over is one caption over its scene (`filmCues`, the `.vtt` of `recit render`). When the
voice of a scene is timed (a speech provider that returns `timings`, such as ElevenLabs through
`@recit/ai`), `filmCues(film, timing, { voices })` cuts it in step with the voice: one caption per
sentence, or before it passes two lines of 42 characters. A voice that says another text, or runs
past its scene, keeps the single caption.

## Errors

The parser never guesses. Every problem names the file, the line and the block:

````text
✖ story.md:14 — (stat): label is required
✖ story.md:7 — a stat is never inferred: add type=stat to the separator
✖ story.md:10 — (compare-bars): row 2: before "lots" is not a number
✖ story.md:9 — (list): use a bullet list (- item) for a list
✖ story.md:7 — (ui-mock): ui-mock takes its props from a ```yaml block
✖ story.md:7 — a ```yaml block needs type= on the separator
✖ story.md:7 — layout "grid" has no motion block
✖ story.md:9 — a code block (ts) has no motion block
````

Code blocks, math, images mixed with text (or remote images), raw HTML, directives such as `:::card`
and the deck layouts `grid`, `columns`, `split` and `image-*` have no motion block yet: they are
errors, not silently dropped. A deck written for slides renders as a film when its scenes keep to
the table above. Its `:::step` blocks are shown with the scene, and each one holds the shot one more
second (an explicit `hold=` wins); bullet lists split across steps make one `list`.

## Settings

Settings go in the front matter of the story.

| Key              | Value                                                    | Default   |
| ---------------- | -------------------------------------------------------- | --------- |
| `title`          | label of the film                                        | none      |
| `format`         | `motion`                                                 | `deck`    |
| `aspectRatio`    | `16:9`, `1:1`, `9:16` or `4:5` (alias: `aspect`)         | `9:16`    |
| `theme`          | `marques`, `warm-editorial`, `saas-product` or an import | `marques` |
| `wordsPerSecond` | narration pace that sets scene durations                 | `2.2`     |
| `audio`          | soundtrack path or `{ src, fadeOut }`                    | none      |

Settings are **flat**, like every format. A nested `motion:` block is accepted as well, and the
`motion:` section of `recit.config.ts` gives the defaults of a project. Precedence: flat key, then
the nested `motion:` block, then `recit.config.ts`. A theme can also come from `theme.name`, the
[named theme](/theme/named-themes) a story shares with its deck: `warm-editorial` and `saas-product`
are the same tokens in both formats. A film with no theme takes `marques`, the film of the "Marques"
direction (an ink frame, white titles in Red Hat Display); name `warm-editorial` to keep the cream
frame and the serif of the films made before.

```ts title="recit.config.ts"
export default defineConfig({
  motion: { theme: "saas-product", wordsPerSecond: 2.6, aspect: "9:16" },
});
```

`audio` adds a soundtrack under the whole film (`mp3`, `m4a`, `wav` or `ogg`, resolved relative to
the story), written as a path string (`audio: track.mp3`, `1.5` s fade-out) or as
`audio: { src: track.mp3, fadeOut: 2 }` (`0` to `30` s; also read from `motion.audio`). During
`recit render`, `ffmpeg` (required) mixes the track under the rendered video and cuts it at the end
of the film with the fade-out; the soundtrack counts towards the MP4 size and `--max-bytes`.

`audio=` on a separator gives one scene its own track (`--- type=title audio=voice/intro.mp3`):
`recit render` plays it from the scene's first frame, cuts it at its last and mixes it over the
soundtrack at full level. The field is `audio` in the JSON twin and in `film.json`, says nothing
about where the file comes from, and is experimental (`x-recit-stability: preview`). A web story
turned into a film keeps the `audio=` of each card. A missing file stops the render before the first
frame, naming the scene.

## The JSON twin

A motion story has three interchangeable forms. All of them end in the same validated film.

| Form            | File                                    | Role                                                |
| --------------- | --------------------------------------- | --------------------------------------------------- |
| Markdown        | `hello.story.md`                        | written by people, read on GitHub                   |
| typed JSON twin | `hello.story.json` (`kind: "story"`)    | the Markdown as typed JSON, scene by scene          |
| film            | `hello.film.json` (`version`, `scenes`) | the render model: one block and its props per scene |

```json title="hello.story.json"
{
  "$schema": "https://recit.dev/schema/v1/motion.json",
  "kind": "story",
  "version": 1,
  "format": "motion",
  "meta": { "title": "Hello, Récit" },
  "settings": { "aspectRatio": "9:16", "theme": "warm-editorial" },
  "scenes": [
    { "id": "proof", "type": "stat", "hold": 1, "body": "# 30s\n\nvertical film" }
  ]
}
```

A scene of the twin has typed fields: `type`, `dur`, `hold`, `accent`, `props` (the ` ```yaml `
block), `voiceover` (the `:::notes`), then `attrs` for the other separator attributes (`unit`…) and
`body` for the natural Markdown form. `settings` holds `aspectRatio`, `theme`, `wordsPerSecond` and
`audio` (`settings.audio` or `settings.motion.audio`). In a `film.json`, each scene carries `id`,
`type`, `props` and the optional `dur`, `hold`, `accent` and `voiceover`.

`recit convert` turns the Markdown into its twin and back. A `film.json` turns into Markdown with
`filmToMarkdown`: the output is canonical, with an `id=` on every separator, the natural form of
each block and a ` ```yaml ` block for props without one. Writing a film back to a `.md` file
rewrites the whole story in this canonical form (v1): comments, blank lines and front matter keys
other than the film settings are not kept.

## Commands

Outside a site, `recit build hello.md` builds the film page alone: `index.html` with the film,
`assets/main.js` (the player, React in its production build), `assets/main.css` and the local media
the film names, in `./dist` (`-o` to change it). `recit dev hello.md` previews it; on a `9:16`,
`4:5` or `1:1` film, **G** (or the **Safe area** button) shades the margins covered by the chosen
network preset (`instagram-story`, `tiktok`, `instagram-post`, `square`, `linkedin-post`) without
touching a built page or an MP4. `recit render hello.md` writes `<story>.mp4`, `<story>.vtt` and
`<story>.txt` (`--preset instagram-story,square` renders one `<story>.<preset>.mp4` per preset of
`MEDIA_PRESETS` at its ratio, and `--aspect 9:16,1:1,4:5` renders one `<story>.<WxH>.mp4` per ratio
into the output folder) and records each MP4 in `exports.json` (`kind: "mp4"`).
`recit validate hello.md --preset instagram-story` (and `--burn-captions` to reserve the caption
band) measures each scene's middle frame against the preset's safe area without rendering an MP4:
crossings are `safe-area` warnings, or errors under `--strict` (needs Chromium like `recit render`,
not ffmpeg).

## Bridges

A film is the target of most bridges, and the source format owns each of them
([Bridges](/formats/bridges)):

| From → to         | How                                                                        | Owner             |
| ----------------- | -------------------------------------------------------------------------- | ----------------- |
| deck → motion     | `format: motion` in the front matter (or `<StoryEmbed format="motion" />`) | `@recit/motion`   |
| webtoon → motion  | [`webtoonToFilm`](/formats/webtoon/overview#bridges)                       | `@recit/webtoon`  |
| webstory ⇄ motion | [`webstoryToFilm`, `motionToWebstory`](/formats/webstory/overview#bridges) | `@recit/webstory` |
| atlas → motion    | [`atlasToFilm`](/formats/atlas/overview#bridges)                           | `@recit/atlas`    |

A deck written for slides plays as a film when its scenes keep to the
[inference table](#inference-table); a scene with no motion block is refused at its line
([Errors](#errors)). `webtoonToFilm` and `webstoryToFilm` return `{ film?, diagnostics }`, like
`storyToFilm` ([Packages](#packages)); `atlasToFilm` returns the film itself.

## Playing a film in a page

In a Récit site, a motion story published by `publish:` plays in the page with the browser engine of
`@recit/motion-blocks`: no Remotion, no MP4. Its fullscreen page is `/present/<slug>` (the
`routePrefix`).

```mdx
<StoryEmbed slug="hello" />
<StoryEmbed slug="hello" aspect="1:1" time={2.5} />
<StoryEmbed slug="talk" format="motion" />
<StoryEmbed slug="hello" poster="/hello.png" src="/hello.mp4" />
```

| Prop       | Role                                                                          |
| ---------- | ----------------------------------------------------------------------------- |
| `format`   | `motion` plays a deck story as a film when its scenes fit the table above     |
| `aspect`   | `16:9`, `1:1`, `9:16` or `4:5`, instead of the story's                        |
| `time`     | opens paused at this second; `?t=<seconds>` in the URL does the same          |
| `autoplay` | plays once visible (default), never under reduced motion                      |
| `loop`     | starts over at the end (default)                                              |
| `poster`   | a still, shown by the server-rendered page until the player loads             |
| `src`      | a pre-rendered MP4, played by the server-rendered page until the player loads |

The player is frame-accurate: a paused frame is the frame of the MP4. :kbd[Space] plays and pauses,
← and → seek one second.

A `:::scroll{film="./intro.film.json"}` block in a site page plays the film by the reader's scroll
instead of a clock: its `::::step{at=0..1}` children pin the text that shows at each position (see
[Scroll stage in site pages](/documentation/integrations/site-stories#scroll-stage-in-site-pages)).

## Packages

| Package                | Role                                                                                                   |
| ---------------------- | ------------------------------------------------------------------------------------------------------ |
| `@recit/motion`        | film schema (`parseFilm`), blocks, timing, ops, handover                                               |
| `@recit/motion/source` | `parseFilmSource`, `formatOf`, `storyToHandover`, `storyToFilm`, `parseMarkdownFilm`, `filmToMarkdown` |
| `@recit/motion/node`   | `readFilmFile`, `writeFilmFile`: `.json` and `.md` films on disk                                       |
| `@recit/motion-blocks` | the React blocks and themes, played in the browser                                                     |
| `@recit/motion-render` | MP4 and stills: Chromium through Playwright, and ffmpeg                                                |
| `@recit/mcp`           | the MCP server: agents build, edit and render films                                                    |

:::note{title="No Remotion"}

`recit render` draws the film in Chromium through Playwright and assembles the MP4 with the ffmpeg
of the system. The former Remotion engine, and its license, are gone: `--engine remotion` now says
so. The CLI and the MCP server load `@recit/motion-render` on demand, so only who renders an MP4
installs Playwright and ffmpeg.

:::

```ts
import { readFilmFile } from "@recit/motion/node";

const result = await readFilmFile("hello.story.md");
if (!result.ok) console.error(result.message); // ✖ hello.story.md:14 — (stat): label is required
```

A compiled story becomes a film through `storyToFilm`, which returns `{ film?, diagnostics }` like
every `…ToFilm`: the film only when no diagnostic is an `error`, and the `Diagnostic` of
`@recit/core` with the `file`, `sceneId` and `blockType` of each scene. `toFilmSourceResult` turns
it into the `{ ok, … }` of `readFilmFile`.

```ts
import { compileStory, formatDiagnostic } from "@recit/core";
import { storyToFilm } from "@recit/motion/source";

const story = await compileStory(markdown, { file: "hello.story.md" });
const { film, diagnostics } = storyToFilm(story, { file: "hello.story.md" });
for (const diagnostic of diagnostics)
  console.error(formatDiagnostic(diagnostic, diagnostic.file ?? "film"));
```
