# 2D Motion Graphics

Flat, fast-cut launch promos and UI animations with an orthographic camera.

Motion SDK started in 3D, and it now does 2D motion graphics too. Build flat scenes with an orthographic camera, unlit materials, gradient fills, vector shapes stacked by layer, dynamic text, text entrances, springs and cuts between shots. In the browser, these 2D features load the authoring bundle automatically.

```json
{
  "camera": { "projection": "orthographic", "ortho_height": 10, "position": [0, 0, 10] },
  "environment": { "background": { "linear_gradient": { "from": "#2b6cff", "to": "#0a1a4a", "angle": 30 } } },
  "materials": { "card": { "color": "#ffffff", "unlit": true } },
  "nodes": {
    "card": { "mesh": { "geometry": { "rounded_box": { "size": [6, 3.5, 0.1], "radius": 0.05 } }, "material": "card" } },
    "title": { "transform": { "position": [0, 0, 0.2] }, "text": { "content": "Split it.", "font": "display_black", "size": 0.8, "animate_in": { "preset": "pop_in" } } }
  }
}
```

## Gradient Fills

Give a texture a CSS-style `linear-gradient(...)` or `radial-gradient(...)` as its `src`, then map it on an unlit material. Keep the material `color` white so the gradient shows as written. See [Textures](/docs/features/textures#gradients) for the syntax.

```json title="apps/docs/examples/gradients.json"
{
  "camera": {
    "projection": "orthographic",
    "ortho_height": 10,
    "position": [0, 0, 10]
  },
  "environment": { "background": { "solid": "#0b0f1a" } },
  "textures": {
    "sunrise": {
      "src": "linear-gradient(135deg, #ff6a3d, #ffb347 45%, #4a3f9a)"
    },
    "glow": {
      "src": "radial-gradient(at 50% 40%, #ffffff, #0a84ff 55%, #001a4a)"
    },
    "fade": {
      "src": "linear-gradient(90deg, #0a84ff00, #0a84ff 50%, #0a84ff00)"
    }
  },
  "materials": {
    "sunrise": {
      "color": "#ffffff",
      "unlit": true,
      "map": { "texture": "sunrise" }
    },
    "glow": { "color": "#ffffff", "unlit": true, "map": { "texture": "glow" } },
    "fade": { "color": "#ffffff", "unlit": true, "map": { "texture": "fade" } }
  },
  "nodes": {
    "card": {
      "transform": { "position": [-4.2, 0.8, 0] },
      "mesh": {
        "geometry": { "rounded_box": { "size": [6, 4, 0.1], "radius": 0.05 } },
        "material": "sunrise"
      }
    },
    "orb": {
      "transform": { "position": [4, 0.8, 0] },
      "mesh": {
        "geometry": { "plane": { "size": [4, 4] } },
        "material": "glow"
      }
    },
    "bar": {
      "transform": { "position": [0, -3, 0] },
      "mesh": {
        "geometry": { "plane": { "size": [14, 1] } },
        "material": "fade"
      }
    }
  }
}
```

![Render of gradients](/renders/gradients.jpg)

## Vector Shapes

A `shape` geometry (`mesh.geometry.shape`) draws a flat rectangle, circle, ellipse, polygon or Bézier path in the node's XY plane, facing +z like a `plane`. In the browser, shapes come with the authoring bundle, which the loader fetches automatically.

```json title="apps/docs/examples/shapes.json"
{
  "camera": {
    "projection": "orthographic",
    "ortho_height": 10,
    "position": [0, 0, 10]
  },
  "environment": { "background": { "solid": "#0b0f1a" } },
  "textures": {
    "sunrise": { "src": "linear-gradient(135deg, #ff6a3d, #4a3f9a)" }
  },
  "materials": {
    "card": {
      "color": "#ffffff",
      "unlit": true,
      "map": { "texture": "sunrise" }
    },
    "blue": { "color": "#0a84ff", "unlit": true },
    "white": { "color": "#ffffff", "unlit": true },
    "lime": { "color": "#b6f23a", "unlit": true }
  },
  "nodes": {
    "card": {
      "transform": { "position": [-4.5, 1.5, 0] },
      "mesh": {
        "geometry": { "shape": { "rect": [5, 3.2], "radius": 0.4 } },
        "material": "card"
      }
    },
    "badge": {
      "parent": "card",
      "layer": 1,
      "transform": { "position": [1.8, 1.1, 0] },
      "mesh": { "geometry": { "shape": { "circle": 0.6 } }, "material": "lime" }
    },
    "ring": {
      "transform": { "position": [1, 1.5, 0] },
      "mesh": {
        "geometry": { "shape": { "circle": 1.4, "stroke": 0.18 } },
        "material": "blue"
      }
    },
    "arc": {
      "transform": { "position": [5, 1.5, 0] },
      "mesh": {
        "geometry": {
          "shape": { "circle": 1.4, "stroke": 0.18, "trim": [0, 0.7] }
        },
        "material": "white"
      }
    },
    "star": {
      "transform": { "position": [-4.5, -3, 0] },
      "mesh": {
        "geometry": {
          "shape": {
            "polygon": [
              [0, 1.4],
              [0.4, 0.4],
              [1.4, 0.4],
              [0.6, -0.2],
              [0.9, -1.2],
              [0, -0.6],
              [-0.9, -1.2],
              [-0.6, -0.2],
              [-1.4, 0.4],
              [-0.4, 0.4]
            ]
          }
        },
        "material": "lime"
      }
    },
    "wave": {
      "transform": { "position": [2, -3, 0] },
      "mesh": {
        "geometry": {
          "shape": {
            "bezier": [
              [-4, 0],
              [-2.5, 2],
              [-1.5, -2],
              [0, 0],
              [1.5, 2],
              [2.5, -2],
              [4, 0]
            ],
            "stroke": 0.15
          }
        },
        "material": "blue"
      }
    }
  }
}
```

![Render of shapes](/renders/shapes.jpg)

- Give exactly one of `rect`, `circle`, `ellipse`, `polygon`, `bezier` and `line`. `radius` rounds the corners of a `rect` or `polygon`.
- `line` is an open polyline that's always stroked, so it needs a `stroke` width. `smooth: true` rounds a `polygon` or `line` into a curve through its points.
- A shape is filled unless you set `stroke`, the outline width in world units. For a fill and a stroke, use two nodes, with the stroke on a higher layer.
- `contours` adds more closed outlines to a fill: holes, islands and multi-part outlines such as letters. They fill by the nonzero winding rule, so a hole runs the other way round, unless `evenodd: true`, where every nested outline toggles between filled and hole. Strokes ignore them: stroke each outline as its own node.
- `round: true` gives strokes round ends and round corners (by default ends are flat and corners sharp, cut off at four times the width). Brush strokes keep their tapered, mitred look.
- `trim: [start, end]` draws only that part of a stroked outline, as fractions of its length. Tracks animate it with the `trim_start` and `trim_end` properties (numbers 0 to 1, overriding the matching end of `trim`). Animate `trim_end` from 0 to 1 to draw a stroke on, or move both together to run a dash around the outline. The stroke is re-tessellated only when the value changes. Authoring builds.

```json
"timeline": { "duration": 2, "tracks": {
  "draw": { "target": "ring", "property": "trim_end",
    "keyframes": [{ "t": 0, "value": 0 }, { "t": 1.5, "value": 1, "easing": "ease_in_out_cubic" }] }
} }
```
- UVs span the shape's bounding box, so gradient and image maps fit it.

### Shape

A 2D vector shape (see the module docs).

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `alpha` | `number (0 to 1)` | — | Contour mesh: drop `grid` cells (keeping a one-cell margin) where the material's image has no pixel with more alpha than this (0..1). |
| `bezier` | `[x, y][]` | — | Cubic Bézier chain `[p0, c0, c1, p1, c2, c3, p2, ...]` (3k+1 points). Filled shapes close back to `p0`; strokes stay open unless `closed`. |
| `circle` | `number` | — | Circle radius, centred on the node. |
| `closed` | `boolean` | — | Close an open `bezier` stroke back to its start. |
| `contours` | `[x, y][][]` | — | More closed outlines filled together with the main one: holes, islands and multi-part outlines (nonzero winding, so a hole runs the other way round, unless `evenodd`). Fills only: strokes ignore them. |
| `ellipse` | `[x, y]` | — | Ellipse `[width, height]`, centred on the node. |
| `evenodd` | `boolean` | — | Fill by the even-odd rule: every nested outline toggles between filled and hole, whichever way it runs. |
| `grid` | `[x, y]` | — | Image mesh: cut the fill (an image layer's `rect`) into a grid of `[columns, rows]` cells over its bounds, so `skin` bones bend it smoothly. Vertices are numbered row by row from the top left, `columns + 1` per row. |
| `line` | `[x, y][]` | — | Open polyline through these `[x, y]` points, drawn as a `stroke` (an ink or brush line; `smooth` rounds it into a curve). |
| `morph` | `[x, y][][]` | — | Alternative outlines for a `polygon`, `line` or `bezier`, each with the same number of points. The node's `morph` track blends between them (mouths, eyes, blobs). On an image mesh (`grid` or `vertices`) each entry is a deform pose instead: an `[dx, dy]` offset per vertex in order (a shorter list leaves the rest still), applied before `skin` bends it. |
| `polygon` | `[x, y][]` | — | Closed polygon through these `[x, y]` points (any simple polygon, convex or not). |
| `pressure` | `number[]` | — | Brush pressure: width multipliers spread evenly from start to end and blended smoothly, e.g. `[0.5, 1.3, 0.8]`. |
| `radius` | `number` | — | Corner radius for `rect` and `polygon` corners. |
| `rect` | `[x, y]` | — | Rectangle `[width, height]`, centred on the node. |
| `round` | `boolean` | — | Round stroke ends and corners (default: flat ends, sharp corners cut off at 4x the width). |
| `seed` | `integer` | — | Seed for `wobble`: the same seed draws the same stroke. |
| `smooth` | `boolean` | — | Round a `polygon` or `line` into a smooth curve through its points (Catmull-Rom), so a few points draw a flowing outline. |
| `stroke` | `number` | — | Draw only the outline, this wide (world units), centred on the edge. |
| `taper` | `[x, y]` | — | Brush taper: narrow the stroke to a point over these fractions of its length at `[start, end]`, e.g. `[0.15, 0.4]`. |
| `triangles` | `number[]` | — | Triangles of the hand-made mesh: indices into `vertices`, three per triangle, e.g. `[0, 1, 2, 0, 2, 3]`. |
| `trim` | `[x, y]` | — | Draw only this part of the outline, as fractions of its length `[start, end]` (stroke draw-on effects; fills ignore it). |
| `vertices` | `[x, y][]` | — | Hand-made image mesh: `[x, y]` points in the shape's space (UVs follow its bounds), used instead of a `grid`. |
| `wobble` | `number` | — | Hand wobble: waver the stroke width by up to this fraction (0..1). |

## Brush Ink and Paper

Hand-inked art needs strokes that swell and taper, and fills that look painted. A stroke becomes a brush stroke with any of these fields:

- `taper: [start, end]` narrows the stroke to a point over those fractions of its length.
- `pressure: [0.5, 1.3, 0.8]` lists width multipliers spread evenly from start to end and blended smoothly.
- `wobble` (0 to 1) wavers the width like a hand-held brush. `seed` picks the waver, and the same seed always draws the same stroke.

Brush strokes, and every `line`, map U along their length and V across them. Three procedural textures go with them. They're near-white greys that multiply the node colour, so one material can serve every colour:

- `paper(0.3)` is fibrous paper grain for backgrounds. It tiles, so `repeat` on the map sets its scale.
- `watercolor(0.4)` gives soft pigment blotches, granulation and pooled edges for washes and fills.
- `bristle(0.6)` streaks along the stroke and opens dry-brush gaps towards its end.

```json
{
  "textures": { "paper": { "src": "paper(0.3)" }, "wash": { "src": "watercolor(0.4)" }, "dry": { "src": "bristle(0.6)" } },
  "materials": {
    "paper": { "color": "#ffffff", "unlit": true, "map": { "texture": "paper", "repeat": [2, 2] } },
    "wash": { "color": "#ffffff", "unlit": true, "map": { "texture": "wash" } },
    "ink": { "color": "#ffffff", "unlit": true, "map": { "texture": "dry" } }
  },
  "nodes": {
    "cheek": { "color": "#d9534f", "mesh": { "geometry": { "shape": { "polygon": [[-2, 0.5], [0, 2], [2, -0.5], [0, -1.2]], "smooth": true } }, "material": "wash" } },
    "brow": {
      "layer": 1,
      "color": "#1a0d08",
      "mesh": {
        "geometry": { "shape": { "line": [[-2, -2], [0, -1.4], [2, -1.8]], "stroke": 0.25, "smooth": true, "taper": [0.15, 0.45], "pressure": [0.6, 1.3, 0.8], "wobble": 0.25 } },
        "material": "ink"
      }
    }
  }
}
```

See [Textures](/docs/features/textures#patterns) for the pattern syntax.

## 2D Bone Rigs

Bend flat art with the same `skin` that bends 3D meshes. Make a chain of empty bone nodes, list it in each shape's `skin.bones`, then keyframe the bones' `rotation` about z. Arms swing at the shoulder and fold at the elbow, legs walk, and tails curl.

```json
{
  "prefabs": {
    "arm": {
      "nodes": {
        "shoulder": {},
        "elbow": { "parent": "shoulder", "transform": { "position": [1.2, 0, 0] } },
        "wrist": { "parent": "elbow", "transform": { "position": [1.1, 0, 0] } },
        "sleeve": {
          "mesh": { "geometry": { "shape": { "bezier": [[0, 0], [0.8, 0], [1.5, 0], [2.3, 0]], "stroke": 0.5 } }, "material": "flat", "skin": { "bones": ["shoulder", "elbow", "wrist"] } }
        },
        "hand": { "parent": "wrist", "layer": 1, "mesh": { "geometry": { "shape": { "circle": 0.25 } }, "material": "flat" } }
      }
    }
  },
  "nodes": { "left": { "use": "arm" }, "right": { "use": "arm", "transform": { "rotation": [0, 0, 180] } } }
}
```

- Inside a prefab, bone names that match the prefab's own nodes bend that copy's bones. Each placed `arm` bends on its own, through tracks like `left.elbow`.
- Stroked shapes and lines bend smoothly, because they're quad strips with points all along them. A filled polygon bends only at its outline points, so a long fill creases. Draw limbs as wide strokes or lines, and fill only the parts that don't bend.
- Parent rigid parts, like hands, feet and props, to a bone node. They then follow it without bending.
- `"property": "bend"` on a bone curls everything after it in the chain: `bend` 40 on the shoulder turns the elbow and wrist 20° each, for a smooth curve from one track.
- For a walk cycle, give the hip, knee and ankle `rotation` tracks with `"curve": "smooth"` and matching first and last keys, so the loop is seamless. Bob the body with a `position` track at twice the step rate.

### Bending Image Layers

Cut-out art (a PNG on a `rect`) normally only turns on its pivot. Give the shape a `grid` and it becomes a mesh of triangles that `skin` bends smoothly, so an arm curves at the elbow and a sleeve flexes.

```json title="apps/docs/examples/image-mesh.json"
{
  "camera": {
    "projection": "orthographic",
    "ortho_height": 8,
    "position": [0, 0, 10]
  },
  "environment": { "background": { "solid": "#f3ead8" } },
  "textures": { "arm": { "src": "assets/ink-arm.png" } },
  "materials": {
    "arm": { "color": "#ffffff", "unlit": true, "map": { "texture": "arm" } },
    "ink": { "color": "#3a2a24", "unlit": true }
  },
  "nodes": {
    "pivot_shoulder": { "transform": { "position": [-3.6, -1.9, 0] } },
    "pivot_arm": {
      "parent": "pivot_shoulder",
      "transform": { "position": [-0.3, 1.84, 0] },
      "mesh": {
        "geometry": { "shape": { "rect": [2.55, 5.92] } },
        "material": "arm"
      }
    },
    "shoulder": { "transform": { "position": [2.6, -1.9, 0] } },
    "elbow": {
      "parent": "shoulder",
      "transform": { "position": [-0.71, 2.33, 0] }
    },
    "wrist": { "parent": "elbow", "transform": { "position": [0.26, 1.27, 0] } },
    "arm": {
      "transform": { "position": [2.3, -0.06, 0] },
      "mesh": {
        "geometry": {
          "shape": {
            "rect": [2.55, 5.92],
            "grid": [3, 10],
            "alpha": 0.05,
            "morph": [
              [
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [0, 0],
                [-0.11, 0],
                [0, 0],
                [0, 0],
                [0.06, 0],
                [-0.18, 0],
                [0, 0],
                [0, 0],
                [0.1, 0],
                [-0.11, 0],
                [0, 0],
                [0, 0],
                [0.06, 0]
              ]
            ]
          }
        },
        "material": "arm",
        "skin": { "bones": ["shoulder", "elbow", "wrist"] }
      }
    },
    "label_pivot": {
      "transform": { "position": [-3.6, -3.4, 0] },
      "text": {
        "content": "pivot only",
        "font": "jetbrains_mono",
        "size": 0.32,
        "align": "center",
        "material": "ink"
      }
    },
    "label_mesh": {
      "transform": { "position": [2.6, -3.4, 0] },
      "text": {
        "content": "image mesh + bones",
        "font": "jetbrains_mono",
        "size": 0.32,
        "align": "center",
        "material": "ink"
      }
    }
  },
  "timeline": {
    "duration": 3,
    "loop": "loop",
    "tracks": {
      "swing_pivot": {
        "target": "pivot_shoulder",
        "property": "rotation",
        "curve": "smooth",
        "keyframes": [
          { "t": 0, "value": [0, 0, 0] },
          { "t": 1.5, "value": [0, 0, 28] },
          { "t": 3, "value": [0, 0, 0] }
        ]
      },
      "swing": {
        "target": "shoulder",
        "property": "rotation",
        "curve": "smooth",
        "keyframes": [
          { "t": 0, "value": [0, 0, 0] },
          { "t": 1.5, "value": [0, 0, -12] },
          { "t": 3, "value": [0, 0, 0] }
        ]
      },
      "bend": {
        "target": "elbow",
        "property": "rotation",
        "curve": "smooth",
        "keyframes": [
          { "t": 0, "value": [0, 0, 0] },
          { "t": 1.5, "value": [0, 0, 80] },
          { "t": 3, "value": [0, 0, 0] }
        ]
      },
      "flex": {
        "target": "arm",
        "property": "morph",
        "curve": "smooth",
        "keyframes": [
          { "t": 0, "value": 0 },
          { "t": 1.5, "value": 1 },
          { "t": 3, "value": 0 }
        ]
      }
    }
  }
}
```

![Render of image-mesh](/renders/image-mesh.gif)

```json
{
  "sleeve": {
    "mesh": {
      "geometry": { "shape": { "rect": [4, 1.2], "grid": [12, 2], "alpha": 0.1 } },
      "material": "arm_art",
      "skin": { "bones": ["shoulder", "elbow", "wrist"], "blend": 0.4, "weights": [[0, 0], [13, 0.5]] }
    }
  }
}
```

- `grid` is `[columns, rows]` of cells over the shape's bounds. Put more columns along the direction it bends. Vertices are numbered row by row from the top left, `columns + 1` per row.
- `alpha` makes a contour mesh. Grid cells where the material's image has no pixel above this alpha are dropped, keeping a one-cell margin, so empty corners cost nothing and never stretch. Until the image loads it draws as the full grid.
- `vertices` and `triangles` give a hand-made mesh instead (as in Spine exports). `vertices` are `[x, y]` points in the shape's space, and `triangles` is a flat list of indices into them, three per triangle. Triangles with an out-of-range index are skipped. UVs follow the shape's bounds, so points line up with the image.
- Weights are automatic, blending across each joint by distance. `skin.blend` sets how far they blend, in world units (default a quarter of the average bone length). `skin.weights` overrides chosen vertices: `[vertex, bone]` pins a vertex to a bone (its index in `bones`), and a fraction blends to the next bone, so `[13, 0.5]` is half shoulder, half elbow.

Deform poses add free-form deformation on top of the bones, like the deform keys in Spine or Live2D: a sleeve billowing, cloth flexing, or a cheek puffing. On an image mesh, each `morph` entry is a pose that lists an `[dx, dy]` offset per vertex, in vertex order. A shorter list leaves the remaining vertices still. Keyframe the node's `morph` property to move through them (0 is the rest pose, 1 the first pose, 2 the second, with blends in between). Poses apply before `skin`, so they bend along with the bones. A mesh with poses and no bones deforms in place.

```json
{
  "geometry": { "shape": { "rect": [4, 1.2], "grid": [4, 1], "morph": [[[0, 0], [0, 0], [0, 0.3], [0, 0.5], [0, 0.6]]] } }
}
```

## Layers

Order 2D art with the node `layer` field rather than z. Each layer sits 0.01 units nearer the camera, and children inherit their parent's layer. Higher layers draw on top, including see-through shapes and text.

```json
{
  "nodes": {
    "card": { "mesh": { "geometry": { "shape": { "rect": [4, 2.4], "radius": 0.3 } }, "material": "card" } },
    "ring": { "layer": 1, "mesh": { "geometry": { "shape": { "circle": 0.6, "stroke": 0.08 } }, "material": "ink" } }
  }
}
```

## Dynamic Text

`text.dynamic` changes a text node's string over time. All times are in scene seconds.

```json title="apps/docs/examples/dynamic-text.json"
{
  "camera": {
    "projection": "orthographic",
    "ortho_height": 10,
    "position": [0, 0, 10]
  },
  "environment": {
    "background": {
      "linear_gradient": { "from": "#0a1a4a", "to": "#05030a", "angle": 0 }
    }
  },
  "materials": {
    "white": { "color": "#ffffff", "unlit": true },
    "lime": { "color": "#b6f23a", "unlit": true }
  },
  "nodes": {
    "price": {
      "transform": { "position": [0, 2.2, 0] },
      "text": {
        "content": "$12,480",
        "font": "display_black",
        "size": 1.4,
        "material": "white",
        "dynamic": {
          "counter": {
            "from": 0,
            "to": 12480,
            "duration": 1.5,
            "prefix": "$",
            "separator": ","
          }
        }
      }
    },
    "code": {
      "transform": { "position": [0, -0.3, 0] },
      "text": {
        "content": "DEPLOYED",
        "font": "jetbrains_mono",
        "size": 0.7,
        "material": "lime",
        "dynamic": { "scramble": { "start": 0.3, "duration": 1.2 } }
      }
    },
    "tag": {
      "transform": { "position": [0, -2.6, 0] },
      "text": {
        "content": "ship faster",
        "font": "inter_bold",
        "size": 0.5,
        "material": "white",
        "dynamic": {
          "swap": {
            "words": ["ship faster", "sleep better", "skip the math"],
            "every": 0.8
          }
        }
      }
    }
  },
  "timeline": { "duration": 3, "loop": "once" }
}
```

![Render of dynamic-text](/renders/dynamic-text.gif)

- `counter` counts between two numbers, with `prefix`, `suffix`, `decimals` and a thousands `separator`.
- `scramble` flickers random characters that settle into `content` from left to right. `glitch` keeps a share of them flickering forever, which suits tickers.
- `swap` cycles whole strings, and the entrance animation replays on each one.

The layout is sized from `content`, so make `content` the longest form.

```json
{
  "nodes": {
    "price": { "text": { "content": "$347", "size": 2, "dynamic": { "counter": { "from": 0, "to": 347, "duration": 0.6, "prefix": "$" } } } },
    "tag": { "transform": { "position": [0, -2, 0] }, "text": { "content": "skip the hassle", "size": 0.6, "dynamic": { "swap": { "words": ["skip the math", "skip the hassle"], "every": 0.7 } } } }
  }
}
```

### TextDynamic

How a text node's content changes over time (overrides `content` while it plays; `content` is still the layout used for sizing).

- `{"counter": Counter}`: Count from `from` to `to`, e.g. a price ticking up.

- `{"scramble": Scramble}`: Random characters that resolve into `content` left to right.

- `{"swap": Swap}`: Cycle through whole strings; the entrance animation replays on each.
### Counter

A number counting from `from` to `to`.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `decimals` | `integer` | — | Digits after the decimal point. |
| `duration` | `number` | `1` | Seconds. |
| `easing` | `Easing` | `"ease_out_cubic"` | How the count speeds up and slows down (ease-out by default). |
| `from` | `number` | `0` | Starting value. |
| `prefix` | `string` | — | Text before the number, e.g. `"$"`. |
| `separator` | `string` | — | Put this between thousands, e.g. `","` for `12,500`. |
| `start` | `number` | `0` | Seconds. |
| `suffix` | `string` | — | Text after the number, e.g. `"%"`. |
| `to` (required) | `number` | — | Final value, held once the count ends. |
### Scramble

Random characters resolving into `content`.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `charset` | `string` | — | Characters to flicker through. |
| `duration` | `number` | `1` | Seconds until the last character settles. |
| `glitch` | `number` | — | Keep flickering this share of characters forever (0 = all settle): a permanent glitch ticker. |
| `rate` | `number` | `24` | Flicker changes per second. |
| `start` | `number` | `0` | Seconds. |
### Swap

Whole strings shown one after another.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `every` | `number` | `1` | Seconds per word. |
| `loop` | `boolean` | — | Start over after the last word (otherwise it stays). |
| `start` | `number` | `0` | Seconds when the second word appears is `start + every`. |
| `words` (required) | `string[]` | — | The strings, in order (the first shows from `start`). |

## Shape Morphs

Give a `polygon`, `line` or `bezier` shape a `morph` list of extra outlines, each with the same number of points in the same order. Then animate the node's `morph` property: 0 draws the shape's own points, 1 the first outline, 2 the second, and fractions blend between neighbours. The shape is re-tessellated only when the value changes. Use it for mouths (shut, open, "oo"), blinking eyes, eyebrows and squash poses. Keep each outline's points in the same winding order, or the blend folds over itself. Authoring builds.

```json
{
  "nodes": {
    "mouth": {
      "mesh": {
        "geometry": {
          "shape": {
            "polygon": [[-0.3, 0], [0, 0.02], [0.3, 0], [0, -0.02]],
            "morph": [[[-0.3, 0], [0, 0.15], [0.3, 0], [0, -0.2]]]
          }
        },
        "material": "ink"
      }
    }
  },
  "timeline": {
    "duration": 2,
    "tracks": {
      "talk": {
        "target": "mouth",
        "property": "morph",
        "keyframes": [
          { "t": 0, "value": 0 },
          { "t": 0.3, "value": 1 },
          { "t": 0.6, "value": 0 }
        ]
      }
    }
  }
}
```

## Masks

`"clip": {"rect": [w, h], "radius": r, "offset": [x, y]}` on a node hides everything outside that rounded rectangle, for the node and all its descendants, including meshes and text. The rectangle moves, rotates and scales with the node. Use it for photo cards, sliding strips, reveal windows and progress bars. When clips are nested, the nearest clipping ancestor wins.

```json
{
  "nodes": {
    "window": { "clip": { "rect": [4, 2.5], "radius": 0.2 } },
    "photo": { "parent": "window", "mesh": { "geometry": { "shape": { "rect": [6, 4] } }, "material": "photo" } }
  }
}
```

### Clip

A rectangular (optionally rounded) 2D clip region.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `offset` | `[x, y]` | `[0,0]` | Centre offset from the node, `[x, y]`. |
| `radius` | `number` | `0` | Corner radius. |
| `rect` (required) | `[x, y]` | — | `[width, height]`, centred on the node (plus `offset`). |

## Shot Transitions

A shot's `transition` covers the cut into it, centred on the cut and drawn over the whole frame.
- `flash` flashes to a colour and fades back.
- `fade` fades through a colour, black by default.
- `wipe` sweeps a solid panel across the frame to cover it by the cut, then sweeps on to reveal the next shot. Its `angle` is 0 for left to right and 90 for top to bottom.
- `whip` is a whip pan. The camera swings away fast towards `angle` (0 pans right and 90 pans down), the cut lands mid-swing, and the new shot swings in from the other side and settles. `distance` is how far each half swings, in frame heights (1.5 by default). There's no overlay, so the picture itself streaks. Exports blur it with 32 subframes over a full-frame shutter, and previews show the pan unblurred.

A shot's `motion_blur` (`{"samples": 12, "shutter": 0.5}`) blurs exported frames inside that shot only, overriding the export's `motion_blur`. Use it on fast pushes and swings without slowing the whole render.

```json
{
  "shots": [
    { "name": "intro", "duration": 2 },
    { "name": "price", "duration": 2, "transition": { "flash": { "color": "#ffffff", "duration": 0.25 } } },
    { "name": "outro", "duration": 2, "transition": { "wipe": { "color": "#1a8cff", "duration": 0.4, "angle": 90 } } },
    { "name": "whip", "duration": 2, "transition": { "whip": { "duration": 0.3, "angle": 0 } }, "motion_blur": { "samples": 12, "shutter": 0.5 } }
  ]
}
```

### ShotTransition

A full-frame transition over a cut.

- `{"flash": { … }}`: The frame flashes to `color` at the cut and quickly fades back.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `Color` | `"#ffffff"` | Flash colour (white by default). |
| `duration` | `number` | `0.25` | Seconds, centred on the cut (0.25 by default). |

- `{"fade": { … }}`: Fade through `color` (black by default).

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `Color` | `"#000000"` | Colour faded through (black by default). |
| `duration` | `number` | `0.5` | Seconds, centred on the cut (0.5 by default). |

- `{"wipe": { … }}`: A solid `color` panel sweeps across to cover the frame by the cut, then sweeps on to uncover the new shot. `angle` is the sweep direction in degrees (0 left to right, 90 top to bottom).

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `angle` | `number` | `0` | Sweep direction in degrees: 0 left to right, 90 top to bottom. |
| `color` | `Color` | `"#ffffff"` | Panel colour (white by default). |
| `duration` | `number` | `0.5` | Seconds, centred on the cut (0.5 by default). |

- `{"whip": { … }}`: A whip pan: the camera swings away fast towards `angle`, the cut lands mid-swing, and the new shot swings in from the other side and settles. Exports streak it with motion blur (32 subframes over a full-frame shutter, or the shot's `motion_blur` if larger).

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `angle` | `number` | `0` | Swing direction in degrees: 0 pans right (the picture streaks left), 90 pans down. |
| `distance` | `number` | `1.5` | How far each half swings, in frame heights (1.5 by default). |
| `duration` | `number` | `0.3` | Seconds, centred on the cut (0.3 by default). |
