# Text

3D text from bundled fonts, with depth, wrapping and entrance animations.

A node with `text` draws a string from one of the bundled OFL fonts. Text is lit like any mesh, so give it a material, or leave it out for plain white.

```json title="apps/docs/examples/text.json"
{
  "camera": { "position": [0, 0, 6], "target": [0, 0, 0], "fov": 40 },
  "lighting": { "rig": "neon_rim" },
  "environment": {
    "background": {
      "linear_gradient": { "from": "#140a2a", "to": "#05030a", "angle": 0 }
    }
  },
  "post": { "bloom": 0.8 },
  "materials": {
    "title": {
      "preset": "glossy_plastic",
      "color": "#ffffff",
      "emissive": "#ff2ec4",
      "emissive_intensity": 0.6
    }
  },
  "nodes": {
    "title": {
      "text": {
        "content": "Made by\nan agent",
        "font": "display_black",
        "size": 0.9,
        "depth": 0.15,
        "material": "title",
        "animate_in": { "preset": "pop_in" }
      }
    },
    "sub": {
      "transform": { "position": [0, -1.6, 0] },
      "text": {
        "content": "motion-sdk render scene.json",
        "font": "jetbrains_mono",
        "size": 0.22
      }
    }
  },
  "timeline": { "duration": 3, "loop": "once" }
}
```

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

## Fonts

`inter`, `inter_bold`, `space_grotesk`, `jetbrains_mono`, `playfair_display` and `display_black`. In the browser, fonts load on demand from `fontBase`.

## Layout

- `size` is the cap height in world units.
- `max_width` wraps lines to a width. `\n` breaks a line.
- `align` is `left`, `center` or `right`.
- `depth` extrudes the glyphs into solid 3D letters (world units, e.g. `0.2` for a 1-unit title). They take the material's lighting, cast shadows and keep `animate_in`. In the browser this loads the authoring bundle; `0` stays flat text on the lean player. Dynamic text (counters, scrambles, swaps) always draws flat.
- `letter_spacing` adds space between letters, in ems.

## Entrances

`animate_in` plays `typewriter`, `fade_up`, `pop_in`, `blur_in` or `split_flip` from `start` seconds. Four more are made for extruded text: `flip_in` (letters tip up from lying flat), `drop_in` (they fall and bounce), `spin_in` (half a turn as they grow) and `tumble_in` (a seeded scatter that settles). On flat text they fall back to a squash or a drop. They need the authoring bundle in the browser, which the loader fetches for you. In a seamless loop, keep the hook on screen from frame 0 with no `animate_in`, or it will pop in again every loop. The validator warns about this.

## Strokes

`stroke` draws a solid outline behind flat text, which is the classic look for short-form captions. `width` is in world units, around 0.05 to 0.15 of `size`, and `color` defaults to black. The letters always sit on top of their own stroke. It needs the authoring bundle in the browser, which the loader fetches for you. Extruded text ignores it.

```json
{ "text": { "content": "One mistake", "font": "display_black", "size": 0.8, "material": "caption", "stroke": { "color": "#170b08", "width": 0.07 } } }
```

> **Coming soon:** Text along paths and per-letter tracks are on the roadmap. See [2D Motion Graphics](/docs/features/motion-graphics).

## API Reference

### Text

Extrudable 3D (or flat) text using bundled fonts.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `TextAlign` | `"center"` | Line alignment. |
| `animate_in` | `TextAnimation` | — | Built-in entrance animation. |
| `content` (required) | `string` | — | The text. `\n` breaks lines. |
| `depth` | `number` | `0` | Extrusion depth in world units: the letters become solid, lit glyphs that cast shadows and keep their entrance animation. 0 renders flat text. In the browser this needs the authoring bundle (the lean player draws it flat). |
| `dynamic` | `TextDynamic` | — | Content that changes over time: a counter, a scramble reveal or word swaps (authoring builds). |
| `font` | `Font` | `"inter_bold"` | One of the bundled fonts. |
| `letter_spacing` | `number` | `0` | Extra letter spacing in em. |
| `material` | `string` | — | Material id, or `preset:<name>`. |
| `max_width` | `number` | `0` | Wrap width in world units (0 = no wrapping). |
| `size` | `number` | `1` | Cap height in world units. |
| `stroke` | `TextStroke` | — | A solid stroke drawn behind flat text, e.g. dark-edged captions (authoring builds; extruded text ignores it). |
### Font

Bundled, license-clean fonts (deterministic glyph output).

| Value | Description |
| --- | --- |
| `"inter"` |  |
| `"inter_bold"` |  |
| `"space_grotesk"` |  |
| `"jetbrains_mono"` |  |
| `"playfair_display"` |  |
| `"display_black"` | Heavy display face for hooks and titles. |
### TextAlign

| Value | Description |
| --- | --- |
| `"left"` |  |
| `"center"` |  |
| `"right"` |  |
### TextAnimation

Per-glyph entrance animations.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `preset` (required) | `TextAnimationPreset` | — | The entrance animation. |
| `stagger` | `number` | `0.04` | Seconds between consecutive glyphs. |
| `start` | `number` | `0` | Seconds when the entrance starts. |
### TextAnimationPreset

| Value | Description |
| --- | --- |
| `"typewriter"` |  |
| `"fade_up"` |  |
| `"pop_in"` |  |
| `"blur_in"` |  |
| `"split_flip"` |  |
| `"flip_in"` | Each letter tips up from lying flat, overshooting a little (best on extruded text). |
| `"drop_in"` | Each letter drops in from above and bounces to rest. |
| `"spin_in"` | Each letter spins half a turn about its upright axis as it grows in. |
| `"tumble_in"` | Each letter tumbles in from a scattered, tilted start towards the camera (seeded, so every render matches). |
### TextStroke

A solid stroke around flat text.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `Color` | `"#000000"` | Stroke colour (black by default). |
| `width` (required) | `number` | — | Thickness in world units, about 0.05-0.15 of the text `size`. |
