---
name: videobana-motion-graphics
description: "Complete reference for Videobana's motion graphics: the `motion` scene and the `drawing` component of a composition, which draw shapes that move like a motion-graphics video. Covers the canvases and their units, every shape type and field, colours, the enter, loop and exit presets with their timings, timing shapes to the narration with `line1`, `line2` ..., repeat layouts (rows, grids, circles), the optional GSAP script (its calls, targets, positions, labels and every property it may set), the checks a motion scene must pass, and complete examples. Use it when writing or editing a `motion` scene or a `drawing`, animating an idea with shapes, writing a GSAP script for Videobana, or fixing a validation error about shapes or a script."
---

# Motion graphics

Videobana draws with shapes, like a motion-graphics video: stars that pop in, arrows that draw themselves, planets in orbit, a rocket on a route. A `motion` scene is a list of `shapes`. Each shape says what it is, where it sits, what colour it has, and how it comes in, keeps moving and leaves. The narration drives the timing: `lines` are the passages that are spoken, and a shape appears when its line starts. Everything is written as data, so it can be written without knowing GSAP; an optional `script` (a GSAP timeline written as text) adds choreography the presets cannot give.

The same shapes draw the `drawing` component of a composition (see the skill `videobana-compositions`); there its `line1`, `line2` ... moments are those of the whole compose scene. The guide with playable previews is at https://www.bana.video/docs/motion, and the scene itself is in the scene reference at https://www.bana.video/docs/scenes#motion (skill `videobana-scenes`).

## A complete motion scene

A drawing made of shapes (rectangles, circles, stars, hearts, arrows, lines, text, paths ...) that move like in a motion-graphics video: they pop in, draw themselves, bounce, orbit, follow a route. Each shape is plain JSON with a position, a size and colours, and says how it comes in (`enter`), keeps moving (`loop`) and leaves (`exit`). `repeat` makes rows, grids and rings of copies. For choreography beyond that, `script` is a GSAP timeline written as text (`tl.to("ball", { x: 40, duration: 1 }, "line2")`), placed on the narration with the labels `line1`, `line2` ... Use it for ideas that words and cards cannot show: growth, flow, balance, orbit, a countdown, a diagram that builds itself.

**Narration.** Optional `lead`, then one passage per entry of `lines`. The shapes and the script can be timed to each passage: the moment line 2 is spoken is `at: "line2"` on a shape and `"line2"` as the position in the script.

```json
{
  "kind": "motion",
  "heading": "Launch day",
  "shapes": [
    {
      "id": "star",
      "type": "star",
      "size": 3,
      "x": 80,
      "y": 7,
      "fill": "amber",
      "repeat": {
        "count": 9,
        "gap": 16
      },
      "enter": "pop",
      "loop": "blink",
      "at": 0.3
    },
    {
      "id": "trail",
      "type": "path",
      "d": "M 14 50 C 50 54, 80 6, 146 12",
      "stroke": "sky",
      "strokeWidth": 0.8,
      "enter": "draw",
      "at": "line1",
      "duration": 1.6
    },
    {
      "id": "rocket",
      "type": "triangle",
      "width": 7,
      "height": 10,
      "x": 14,
      "y": 50,
      "fill": "rose",
      "glow": true,
      "enter": "pop",
      "at": "line2"
    },
    {
      "id": "label",
      "type": "text",
      "text": "Lift-off!",
      "size": 7,
      "x": 118,
      "y": 42,
      "fill": "text",
      "enter": "type",
      "at": "line3"
    }
  ],
  "script": "tl.to(\"rocket\", { motionPath: { path: \"trail\", autoRotate: 90 }, duration: 2.6, ease: \"power1.inOut\" }, \"line2+=0.4\");",
  "lines": [
    {
      "say": "Every launch starts with a plan, drawn out on the board."
    },
    {
      "say": "Then the rocket takes its place at the start of the route."
    },
    {
      "say": "And off it goes, all the way to lift-off."
    }
  ]
}
```

## The fields of the scene

Besides `"kind": "motion"` and the fields every scene has (listed in `videobana-scenes`). The fields of each shape are under **Every field of a shape**.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `heading` | `string` | no | Scene heading shown at the top. Limits: 1–60 characters. |
| `canvas` | `enum` | no | The drawing board, in canvas units: `wide` is 160 wide and 60 tall, `square` is 100 wide and 100 tall, `tall` is 60 wide and 100 tall. Default `wide`. Shapes are placed with x from 0 to the width and y from 0 (top) to the height. Allowed: `wide`, `square`, `tall`. |
| `shapes` | `object[]` | yes | What to draw, from the back to the front. Limits: 1–40 items. |
| `script` | `string` | no | A GSAP timeline as text, for movements `enter`, `loop` and `exit` cannot make: `tl.to("ball", { x: 40, rotation: 90, duration: 1, ease: "power2.out" }, "line2")`. Calls: `tl.to`, `tl.from`, `tl.fromTo`, `tl.set`, `tl.addLabel`. Names are shape ids, group names or "all". Limits: up to 4000 characters. |
| `lines` | `object[]` | yes | The narration, one passage at a time. Their moments are the labels `line1`, `line2` ... Limits: 1–8 items. |
| `lines[].say` | `string` | yes | The narration for this item. It is spoken, and shown as the caption. With the premium voice, a tag such as `<sigh>`, `<laugh>` or `<short pause>` is performed at that spot and is not shown. Limits: 1–500 characters. |
| `lead` | `string` | no | Narration before the first item appears. Limits: 1–500 characters. |
| `outro` | `string` | no | Narration after the last item. Limits: 1–500 characters. |

## The canvas

Shapes are placed on a drawing board that is scaled to the video, so a drawing looks the same at every size. One unit is one percent of the video's width. `x` goes to the right and `y` goes down, both from the top left corner, and a shape's `x`,`y` is its centre. `canvas` picks the board (default `wide`):

| canvas | Width × height (units) | Use it for |
| --- | --- | --- |
| `wide` | 160 × 60 | A landscape video (the default). |
| `square` | 100 × 100 | A square video, or a drawing in the middle of a scene. |
| `tall` | 60 × 100 | A portrait video. |

A shape may sit a little off the canvas (coordinates from -400 to 400), so it can slide in from the edge; sizes go up to 400 units.

## Shapes

Only `id` and `type` are required; a shape with nothing else sits in the middle of the canvas, 16 units wide (a `text` has a font size of 6), in the accent colour. Shapes are drawn from the back to the front, in the order of the list (up to 40).

```json
{
  "id": "badge",
  "type": "star",
  "x": 40,
  "y": 30,
  "size": 14,
  "points": 6,
  "fill": "amber",
  "fill2": "orange",
  "glow": true,
  "enter": "pop",
  "loop": "pulse",
  "at": "line2"
}
```

- `id` names the shape so that `at` and the script can refer to it: it starts with a letter, then letters, digits, `-` or `_`, at most 24 characters, and it is unique in the scene. `group` gives several shapes one shared name, so the script can move them together.
- `size` is the width and height (the font size of a `text`); `width` and `height` override it for the shapes that have two sides.
- A `line` or `arrow` runs from `x`,`y` to `x2`,`y2` (default: `size` to the right, level with the start). A `path` is drawn from `x`,`y` (default 0,0) with `d` in canvas units.
- A `text` holds at most 60 characters of plain words (no `<`); `d` holds at most 600 characters of SVG path commands and numbers.

| type | What it draws |
| --- | --- |
| `rect` | A rectangle. `width` and `height` set its sides, `radius` rounds the corners. |
| `square` | A square of `size`. `radius` rounds the corners. |
| `circle` | A circle across `size`. |
| `ellipse` | An oval: `width` by `height`. |
| `triangle` | A triangle pointing up. Turn it with `rotation`. |
| `diamond` | A rhombus: a square standing on its corner. |
| `polygon` | A regular polygon. `sides` from 3 to 12 (default 6). |
| `star` | A star. `points` from 3 to 16 (default 5), `inner` sets how deep it is cut. |
| `heart` | A heart. |
| `arrow` | A line from `x`,`y` to `x2`,`y2` with an arrow head at its end. `fill` is its colour, `strokeWidth` its thickness. |
| `line` | A plain line from `x`,`y` to `x2`,`y2`. |
| `ring` | A circle drawn as an outline only, `strokeWidth` thick. |
| `cross` | A plus sign. `inner` sets how thin its arms are. |
| `text` | Words, centred on `x`,`y`. `size` is the font size, `weight` the boldness. Plain words only. |
| `path` | Any SVG path in `d`, in canvas units, drawn from `x`,`y`. Use it for curves, routes and orbits; a script can move other shapes along it. |

### Colours

`fill`, `fill2`, `stroke` and the colours of `repeat.palette` take a colour in any of these forms:

- a hex colour: `#ff6b6b` or `#f66`;
- a colour of the theme, which follows the look of the video: `violet`, `emerald`, `amber`, `rose`, `sky`, `fuchsia`, `teal`, `orange`, each also as `-light` and `-deep` (`sky-deep`);
- `accent` and `accent2` (the two main colours of the theme), `text` (the colour of the text), `white`, `black`;
- `none` for no colour at all (an outline without an inside).

`fill2` turns the fill into a gradient from `fill` (top left) to `fill2` (bottom right), `glow: true` adds a soft glow in the colour of the shape, and `opacity` makes it see-through. Without a `fill` a shape is `accent`, or `none` when only a `stroke` is given; a `line`, `arrow` or `ring` takes `fill` as the colour of its line.

## Movement

A shape moves with three words, all optional: `enter` (how it arrives), `loop` (what it keeps doing while it is there) and `exit` (how it leaves, at `exitAt`). `duration` sets how long the arrival and the exit take and `delay` adds a wait. A shape with no `enter` is simply there from the start. A loop runs on a layer of its own, so it never fights the way the shape comes in or what the script does to it.

### enter

| enter | What it does | Seconds (default) |
| --- | --- | --- |
| `fade` | Fades in. | 0.6 |
| `pop` | Grows from nothing with a small overshoot. | 0.55 |
| `rise` | Floats up a little while fading in. | 0.6 |
| `drop` | Falls from above and bounces. | 0.8 |
| `slide-left` | Slides in from the left. | 0.6 |
| `slide-right` | Slides in from the right. | 0.6 |
| `zoom` | Shrinks into place from a large size. | 0.7 |
| `spin` | Turns half a circle while growing. | 0.8 |
| `grow` | Grows upward from its bottom edge: bars and columns. | 0.7 |
| `draw` | A line, arrow or path draws itself; a filled shape fills in once its outline is drawn. | 1 |
| `type` | A `text` is typed out letter by letter. | 0.05 per letter, from 0.4 to 3 |

`slide-left` and `slide-right` travel 30 units, `rise` 8, `drop` falls 24. `draw` works on every shape but a `text`, and `type` only on a `text`: `draw` on a text, or `type` on anything else, fades in instead (a warning).

### loop

| loop | What it does |
| --- | --- |
| `float` | Drifts up and down, slowly. |
| `pulse` | Swells and shrinks, like a heartbeat. |
| `spin` | Turns round and round. |
| `sway` | Rocks from side to side. |
| `bounce` | Hops up and down. |
| `blink` | Fades down and up. |
| `wiggle` | Shakes a little. |

### exit

| exit | What it does | Seconds (default) |
| --- | --- | --- |
| `fade` | Fades out. | 0.5 |
| `shrink` | Shrinks to nothing. | 0.5 |
| `slide-left` | Slides out to the left. | 0.5 |
| `slide-right` | Slides out to the right. | 0.5 |
| `slide-up` | Floats up and away. | 0.5 |
| `slide-down` | Sinks down and away. | 0.5 |

`exit` needs `exitAt`: without it the shape never leaves (a warning). `slide-up` and `slide-down` travel 16 units, the side slides 30.

## Timing

`at` says when a shape comes in. It is either a number of seconds from the start of the scene (up to 600), or a narration moment: `line1` is when the first entry of `lines` starts to be spoken, `line2` the second, and so on. Tying shapes to lines keeps the picture in step with the voice, whatever the speed of the narrator. `exitAt` takes the same values.

- Shapes with an `enter` and without `at` come in one after another, a quarter of a second apart; the copies of a `repeat` come in together, spread by their `stagger`.
- `delay` adds seconds on top of `at`.
- A `lineN` the scene does not have (`"line5"` with four lines) is an error. There are at most 8 lines; the optional `lead` is spoken before `line1`.
- When the scene plays without narration timing, `lineN` falls 2 seconds after the one before.

## Many copies

`repeat` draws a shape many times, in a row, a column, a grid, a circle or along a diagonal, around its own `x`,`y`. The copies are named `dot1`, `dot2` ... and all belong to the group `dot`, so a script can move them together. `stagger` is the delay between one copy and the next, and `palette` gives them colours in turn.

```json
{
  "id": "dot",
  "type": "circle",
  "size": 4,
  "x": 80,
  "y": 30,
  "repeat": {
    "count": 12,
    "layout": "circle",
    "radius": 18,
    "palette": [
      "rose",
      "amber",
      "emerald",
      "sky"
    ]
  },
  "enter": "pop",
  "stagger": 0.1
}
```

| layout | Where the copies go |
| --- | --- |
| `row` | Copies side by side, `gap` apart. |
| `column` | Copies one under the other. |
| `grid` | Rows and columns; `columns` sets how many per row. |
| `circle` | Copies round a ring of `radius` (`startAngle` sets where it starts, `rotate` turns them outwards). |
| `diagonal` | Copies along a slanting line. |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `shapes[].repeat` | `object` | no | Draw many copies of this shape in a row, grid or circle. |
| `shapes[].repeat.count` | `integer` | yes | How many copies. They are named `<id>1`, `<id>2` ... and all belong to the group `<id>`. Limits: 2–60. |
| `shapes[].repeat.layout` | `enum` | no | Where the copies go, around the shape's own position. Default `row`. Allowed: `row`, `column`, `grid`, `circle`, `diagonal`. |
| `shapes[].repeat.gap` | `number` | no | Distance between the centres of neighbouring copies. Default: 1.5 times the size. Limits: 0–400. |
| `shapes[].repeat.columns` | `integer` | no | Copies per row in a `grid`. Default: the square root of the count, rounded up. Limits: 1–20. |
| `shapes[].repeat.radius` | `number` | no | Radius of a `circle`. Default: wide enough for the copies not to touch. Limits: 0–400. |
| `shapes[].repeat.startAngle` | `number` | no | Where a `circle` starts, in degrees. Default -90 (the top). Limits: -360–360. |
| `shapes[].repeat.palette` | `string[]` | no | Colours the copies take in turn, instead of `fill`. Limits: 1–8 items. |
| `shapes[].repeat.rotate` | `boolean` | no | Turn each copy of a `circle` to face outwards. |

A `repeat` makes 2 to 60 copies, and a scene can hold up to 120 shapes once the copies are counted (more is an error). A `repeat` that is given an `id` of `dot` makes names `dot1` ... so no other shape may be called that.

The layers of neurons below are three shapes with `repeat`, one column of copies each; the script sends a signal through them (from the ready-made video "How a neural network learns"):

```json
{
  "kind": "motion",
  "heading": "Inside a neural network",
  "lead": "Let us open the box.",
  "canvas": "wide",
  "header": false,
  "shapes": [
    {
      "id": "links1",
      "type": "path",
      "d": "M 28 14 L 80 12 M 28 14 L 80 24 M 28 14 L 80 36 M 28 14 L 80 48 M 28 30 L 80 12 M 28 30 L 80 24 M 28 30 L 80 36 M 28 30 L 80 48 M 28 46 L 80 12 M 28 46 L 80 24 M 28 46 L 80 36 M 28 46 L 80 48",
      "stroke": "text",
      "strokeWidth": 0.25,
      "opacity": 0.4,
      "enter": "draw",
      "at": "line1",
      "delay": 1.1,
      "duration": 1.4
    },
    {
      "id": "links2",
      "type": "path",
      "d": "M 80 12 L 132 20 M 80 12 L 132 40 M 80 24 L 132 20 M 80 24 L 132 40 M 80 36 L 132 20 M 80 36 L 132 40 M 80 48 L 132 20 M 80 48 L 132 40",
      "stroke": "text",
      "strokeWidth": 0.25,
      "opacity": 0.4,
      "enter": "draw",
      "at": "line1",
      "delay": 1.5,
      "duration": 1.4
    },
    {
      "id": "in",
      "type": "circle",
      "x": 28,
      "y": 30,
      "size": 7,
      "fill": "sky",
      "fill2": "violet",
      "glow": true,
      "repeat": {
        "count": 3,
        "layout": "column",
        "gap": 16
      },
      "enter": "pop",
      "stagger": 0.15,
      "at": "line1"
    },
    {
      "id": "hid",
      "type": "circle",
      "x": 80,
      "y": 30,
      "size": 7,
      "fill": "violet",
      "fill2": "fuchsia",
      "glow": true,
      "repeat": {
        "count": 4,
        "layout": "column",
        "gap": 12
      },
      "enter": "pop",
      "stagger": 0.12,
      "at": "line1",
      "delay": 0.5
    },
    {
      "id": "out",
      "type": "circle",
      "x": 132,
      "y": 30,
      "size": 8,
      "fill": "emerald",
      "fill2": "teal",
      "glow": true,
      "repeat": {
        "count": 2,
        "layout": "column",
        "gap": 20
      },
      "enter": "pop",
      "stagger": 0.15,
      "at": "line1",
      "delay": 1
    },
    {
      "id": "tagIn",
      "type": "text",
      "text": "Photo goes in",
      "x": 28,
      "y": 57,
      "size": 3.6,
      "fill": "sky",
      "enter": "fade",
      "at": "line1",
      "delay": 1.6
    },
    {
      "id": "tagHid",
      "type": "text",
      "text": "Neurons mix the signals",
      "x": 80,
      "y": 57,
      "size": 3.6,
      "fill": "violet",
      "enter": "fade",
      "at": "line1",
      "delay": 1.8
    },
    {
      "id": "tagOut",
      "type": "text",
      "text": "Answer comes out",
      "x": 132,
      "y": 57,
      "size": 3.6,
      "fill": "emerald",
      "enter": "fade",
      "at": "line1",
      "delay": 2
    },
    {
      "id": "signal",
      "type": "circle",
      "x": 28,
      "y": 30,
      "size": 3.4,
      "fill": "amber",
      "glow": true,
      "enter": "pop",
      "at": "line2"
    },
    {
      "id": "verdict",
      "type": "text",
      "text": "Dog?",
      "x": 132,
      "y": 4,
      "size": 6,
      "fill": "rose",
      "enter": "pop",
      "at": "line3"
    }
  ],
  "script": "tl.to(\"signal\", { x: 104, duration: 2.6, ease: \"power1.inOut\", repeat: -1, repeatDelay: 0.5 }, \"line2\"); tl.to(\"links1\", { strokeWidth: 0.9, stroke: \"emerald\", opacity: 0.9, duration: 1.4, ease: \"power2.inOut\", yoyo: true, repeat: -1 }, \"line4\"); tl.to(\"verdict\", { text: \"Cat!\", fill: \"emerald\", duration: 1, ease: \"none\" }, \"line4+=2\");",
  "lines": [
    {
      "say": "A neural network is a stack of layers, made of tiny calculators called neurons."
    },
    {
      "say": "A photo goes in on the left. Each neuron mixes what it receives, and passes a signal to the next layer."
    },
    {
      "say": "At the far end comes an answer. The first time, it is mostly a guess, and it is usually wrong."
    },
    {
      "say": "So the network checks its mistake, and strengthens the connections that helped. Then it tries again, thousands of times."
    }
  ]
}
```

## The GSAP script

For choreography the presets cannot give, a scene can carry a `script`: a GSAP timeline written as text (up to 4000 characters). Only calls of the timeline `tl` are understood, never other JavaScript, so a script can move shapes and nothing else. Every call has the same shape: `tl.to(target, { properties }, position)`.

```js
tl.from("bar", { scaleY: 0, duration: 0.8, stagger: 0.15, ease: "back.out(1.7)" }, "line2");
tl.to("rocket", { motionPath: { path: "route", autoRotate: true }, duration: 3 }, "line3+=0.5");
tl.to("sun", { rotation: 360, duration: 8, ease: "none", repeat: -1 }, 0);
tl.to("label", { fill: "rose", scale: 1.4, yoyo: true, repeat: 3 }, "<");
```

- Calls: `tl.to`, `tl.from`, `tl.fromTo`, `tl.set`, `tl.addLabel`. `tl.fromTo(target, from, to, position)` takes the starting values, then the final ones. `tl.addLabel("drop", 2)` names a moment (a new name: a letter, then letters, digits, `-` or `_`; not `start` or a `lineN`).
- Targets: the `id` of a shape (one copy of a `repeat` is `"dot3"`), the name of a group (the copies of a `repeat`, or a `group`), `"all"` (or `"*"`) for every shape, or a list of names (`["sun", "earth"]` or `"sun, earth"`).
- Position (the last argument): seconds (0 to 600), a label such as `"line2"`, `"line2+=0.5"` for half a second after it, `"<"` to start with the previous animation, `">"` after it, or `"<0.3"`. The labels are `start` (0), `line1` ... (when each line of narration starts) and those made with `addLabel`. Without a position a call starts when the one before it ends.
- `motionPath` moves a shape along another shape (a `path` is the usual choice); `autoRotate` turns it to face the way it goes.
- `repeat: -1` repeats until the scene ends. `yoyo: true` plays it back and forth.
- The properties that say how an animation runs (`duration`, `delay`, `ease`, `stagger`, `repeat`, `repeatDelay`, `yoyo`, `immediateRender`) go in the last object, never among the starting values of a `fromTo`.

### What a script may set

Properties a script may set; anything else is reported with the line it is on and what is allowed, and the rest of the script still runs.

| Property | Accepts |
| --- | --- |
| `x` | Moves across, in canvas units counted from where the shape is: a number from -1000 to 1000, or relative text such as "+=10". |
| `y` | Moves down, in the same terms as `x`. |
| `xPercent` | Moves across by a percentage of the shape's own width: -1000 to 1000, or relative text such as "+=10". |
| `yPercent` | Moves down by a percentage of the shape's own height, like `xPercent`. |
| `rotation` | Turns, in degrees: -7200 to 7200, relative text such as "+=90", or a direction such as "180_cw", "90_ccw" or "45_short". |
| `scale` | Size: 0 to 50 (1 is its own size), or relative text such as "+=0.5". |
| `scaleX` | Width only, like `scale`. |
| `scaleY` | Height only, like `scale` (bars that grow). |
| `skewX` | Slants across: -180 to 180 degrees, or relative text. |
| `skewY` | Slants down: -180 to 180 degrees, or relative text. |
| `opacity` | 0 (invisible) to 1 (solid). |
| `autoAlpha` | Like `opacity`, from 0 to 1. |
| `motionPath` | Moves the shape along another shape (any shape but a `text`; a `path` is the usual one): its name, `"route"`, or `{ path: "route", autoRotate: true }`. `autoRotate` is `true`, `false` or an angle from -360 to 360 degrees to add; `start` and `end` (0 to 1) travel part of the route. |
| `fill` | Colour inside: any colour a shape takes (see **Colours**). |
| `stroke` | Colour of the outline: any colour a shape takes. |
| `strokeWidth` | Thickness of the outline: 0 to 40. |
| `fillOpacity` | How solid the inside is: 0 to 1. |
| `strokeOpacity` | How solid the outline is: 0 to 1. |
| `drawSVG` | How much of the outline is drawn: "0%", "100%", a part such as "20% 80%", or a number from 0 to 100 (percent). |
| `text` | New words for a `text` shape: plain text of at most 60 characters, without the "<" sign (`""` empties it). |
| `duration` | Seconds the animation takes: 0 to 30. |
| `delay` | Seconds to wait before it starts: 0 to 60. |
| `ease` | The name of an ease: "power2.out", "back.out(1.7)", "sine.inOut", "bounce.out", "none" ... |
| `stagger` | Seconds between the shapes of a group or list (0 to 10), or `{ each, amount, from, ease, axis, grid }`: `each`/`amount` 0 to 10 seconds, `from` "start", "center", "end", "edges", "random" or an index, `axis` "x" or "y", `grid` "auto" or [rows, columns] (1 to 60). |
| `repeat` | How many more times to play: a whole number up to 100, or -1 for ever (until the scene ends). |
| `repeatDelay` | Seconds between repeats: 0 to 30. |
| `yoyo` | `true` plays every other repeat backwards. |
| `immediateRender` | `true` or `false`, as in GSAP. |

### What a script is made of

- The script is never run as JavaScript: a small reader takes in names, numbers, quoted text (`"..."`, `'...'` or backticks without `${...}`), `[lists]`, `{ objects }`, `true`, `false` and `null`. Functions, variables, calculations and `Infinity` are errors: write the number itself (for ever is `repeat: -1`).
- `const tl = gsap.timeline()` (or `let`/`var`, with any name) may come first; its options are ignored, because the scene makes the timeline. `gsap.to`, `gsap.from`, `gsap.fromTo` and `gsap.set` are taken as calls on the timeline (at 0 when they have no position).
- Calls may be chained (`tl.to(...).from(...)`), end with `;` or not, and comments (`// ...` and `/* ... */`) are allowed. A `#` or `.` in front of a name is ignored.
- At most 200 calls, and objects or lists nested at most 6 deep. Use `stagger` or `repeat` to move many shapes with one call.
- A call with an unknown method, an unknown target or a wrong position is reported (with its line) and left out; a property that is not allowed, or a value out of range, is reported and dropped while the rest of that call plays. The rest of the script still plays. After a mistake in the writing itself (an unclosed quote, say), the calls before it are kept.

The earth below travels round the sun with one line of script (from the ready-made video "Why we have seasons"):

```json
{
  "kind": "motion",
  "heading": "One trip around the Sun",
  "lead": "Let us start with the Earth's long journey.",
  "canvas": "wide",
  "shapes": [
    {
      "id": "orbit",
      "type": "path",
      "d": "M 34 30 A 46 22 0 1 1 126 30 A 46 22 0 1 1 34 30 Z",
      "stroke": "text",
      "strokeWidth": 0.35,
      "opacity": 0.5,
      "enter": "draw",
      "at": 0.2,
      "duration": 1.4
    },
    {
      "id": "sun",
      "type": "circle",
      "x": 80,
      "y": 30,
      "size": 14,
      "fill": "amber",
      "fill2": "orange",
      "glow": true,
      "loop": "pulse",
      "enter": "pop",
      "at": 0.5
    },
    {
      "id": "earth",
      "type": "circle",
      "x": 34,
      "y": 30,
      "size": 5,
      "fill": "sky",
      "fill2": "emerald",
      "glow": true,
      "enter": "pop",
      "at": "line1"
    },
    {
      "id": "axis",
      "type": "line",
      "x": 30,
      "y": 36,
      "x2": 38,
      "y2": 24,
      "stroke": "white",
      "strokeWidth": 0.5,
      "enter": "grow",
      "at": "line2"
    },
    {
      "id": "tilt",
      "type": "text",
      "text": "23.5°",
      "x": 22,
      "y": 18,
      "size": 5,
      "fill": "amber",
      "enter": "pop",
      "at": "line2"
    },
    {
      "id": "summer",
      "type": "text",
      "text": "Summer",
      "x": 80,
      "y": 5,
      "size": 5,
      "fill": "amber",
      "enter": "rise",
      "at": "line3"
    },
    {
      "id": "winter",
      "type": "text",
      "text": "Winter",
      "x": 80,
      "y": 56,
      "size": 5,
      "fill": "sky",
      "enter": "rise",
      "at": "line3",
      "delay": 0.4
    }
  ],
  "script": "tl.to(\"earth\", { motionPath: { path: \"orbit\" }, duration: 14, ease: \"none\", repeat: -1 }, \"line1\");",
  "lines": [
    {
      "say": "The Earth circles the Sun once a year, along a path that is almost round."
    },
    {
      "say": "But the Earth does not spin upright. It is tilted by about twenty-three degrees."
    },
    {
      "say": "So, during the year, each half of the planet leans towards the Sun for a while, and then away from it."
    }
  ]
}
```

## Every field of a shape

`shapes` is a list of 1 to 40 of these:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `shapes[].id` | `string` | yes | Name of the shape. The script refers to it by this name. |
| `shapes[].type` | `enum` | yes | What to draw. Allowed: `rect`, `square`, `circle`, `ellipse`, `triangle`, `diamond`, `polygon`, `star`, `heart`, `arrow`, `line`, `ring`, `cross`, `text`, `path`. |
| `shapes[].group` | `string` | no | A name shared by several shapes, so the script can move them together. |
| `shapes[].x` | `number` | no | Centre of the shape across the canvas. Default: the middle. A `line` or `arrow` starts here; a `path` is drawn from here (default 0). Limits: -400–400. |
| `shapes[].y` | `number` | no | Centre of the shape down the canvas. Default: the middle. Limits: -400–400. |
| `shapes[].size` | `number` | no | Width and height of the shape (font size for `text`). Default 16 (6 for `text`). Limits: 0–400. |
| `shapes[].width` | `number` | no | Overrides the width of `rect`, `ellipse`, `triangle`, `diamond`, `polygon`, `star`, `heart`, `cross`, `ring`. Limits: 0–400. |
| `shapes[].height` | `number` | no | Overrides the height, like `width`. Limits: 0–400. |
| `shapes[].x2` | `number` | no | Where a `line` or `arrow` ends, across. Default: `size` to the right of the start. Limits: -400–400. |
| `shapes[].y2` | `number` | no | Where a `line` or `arrow` ends, down. Default: level with the start. Limits: -400–400. |
| `shapes[].fill` | `string` | no | Colour inside the shape. Default `accent` (or `none` if only `stroke` is given). A `line`, `arrow` or `ring` takes it as its stroke colour. |
| `shapes[].fill2` | `string` | no | A second colour: the fill becomes a gradient from `fill` (top left) to `fill2` (bottom right). |
| `shapes[].stroke` | `string` | no | Colour of the outline. |
| `shapes[].strokeWidth` | `number` | no | Thickness of the outline or line. Default 1 for lines, 2 for a `ring`. Limits: 0–40. |
| `shapes[].opacity` | `number` | no | 0 is invisible, 1 solid (default). Limits: 0–1. |
| `shapes[].rotation` | `number` | no | Degrees, clockwise. Limits: -3600–3600. |
| `shapes[].radius` | `number` | no | Rounded corners of a `rect` or `square`. Limits: 0–400. |
| `shapes[].sides` | `integer` | no | Corners of a `polygon`. Default 6. Limits: 3–12. |
| `shapes[].points` | `integer` | no | Points of a `star`. Default 5. Limits: 3–16. |
| `shapes[].inner` | `number` | no | How deep a `star` is cut, or how thin the arms of a `cross` are, from 0.1 to 0.9. Default 0.5 (0.34 for a cross). Limits: 0.1–0.9. |
| `shapes[].text` | `string` | no | The words of a `text` shape. Limits: 1–60 characters. |
| `shapes[].weight` | `integer` | no | Boldness of `text`. Default 800. Limits: 100–900. |
| `shapes[].d` | `string` | no | SVG path data in canvas units, for a `path`, e.g. `M 10 40 C 40 5, 80 5, 110 40`. Limits: up to 600 characters. |
| `shapes[].glow` | `boolean` | no | A soft glow in the colour of the shape. |
| `shapes[].repeat` | `object` | no | Draw many copies of this shape in a row, grid or circle. |
| `shapes[].repeat.count` | `integer` | yes | How many copies. They are named `<id>1`, `<id>2` ... and all belong to the group `<id>`. Limits: 2–60. |
| `shapes[].repeat.layout` | `enum` | no | Where the copies go, around the shape's own position. Default `row`. Allowed: `row`, `column`, `grid`, `circle`, `diagonal`. |
| `shapes[].repeat.gap` | `number` | no | Distance between the centres of neighbouring copies. Default: 1.5 times the size. Limits: 0–400. |
| `shapes[].repeat.columns` | `integer` | no | Copies per row in a `grid`. Default: the square root of the count, rounded up. Limits: 1–20. |
| `shapes[].repeat.radius` | `number` | no | Radius of a `circle`. Default: wide enough for the copies not to touch. Limits: 0–400. |
| `shapes[].repeat.startAngle` | `number` | no | Where a `circle` starts, in degrees. Default -90 (the top). Limits: -360–360. |
| `shapes[].repeat.palette` | `string[]` | no | Colours the copies take in turn, instead of `fill`. Limits: 1–8 items. |
| `shapes[].repeat.rotate` | `boolean` | no | Turn each copy of a `circle` to face outwards. |
| `shapes[].enter` | `enum` | no | How the shape comes in. Without it the shape is simply there from the start. Allowed: `fade`, `pop`, `rise`, `drop`, `slide-left`, `slide-right`, `zoom`, `spin`, `grow`, `draw`, `type`. |
| `shapes[].loop` | `enum` | no | A movement that repeats while the shape is on screen. Allowed: `float`, `pulse`, `spin`, `sway`, `bounce`, `blink`, `wiggle`. |
| `shapes[].exit` | `enum` | no | How the shape leaves, at `exitAt`. Allowed: `fade`, `shrink`, `slide-left`, `slide-right`, `slide-up`, `slide-down`. |
| `shapes[].at` | `number \| string` | no | When the shape comes in: seconds, or `line2` for when the second line is spoken. Default: one after another, a quarter of a second apart. Limits: 0–600. |
| `shapes[].delay` | `number` | no | Extra seconds before `enter`. Limits: 0–600. |
| `shapes[].duration` | `number` | no | Seconds `enter` and `exit` take. Default depends on the animation. Limits: 0.05–30. |
| `shapes[].stagger` | `number` | no | Seconds between the copies of a `repeat`. Default 0.08. Limits: 0–5. |
| `shapes[].exitAt` | `number \| string` | no | When the shape leaves, in the same terms as `at`. Limits: 0–600. |

## Checks

A motion scene is checked as it would play. Errors stop the video from being saved; warnings do not.

- Error: a `text` shape without `text`, or a `path` without `d`.
- Error: two shapes with the same name (the copies of a `repeat` are named `<id>1`, `<id>2` ...).
- Error: more than 120 shapes once the copies are counted.
- Error: an `at` or `exitAt` of `lineN` where the scene has fewer lines.
- Error: every problem of the script, with its line: an unknown call, a name that is no shape or group, a label that does not exist, a property that is not allowed or a value out of range.
- Warning: `exit` without `exitAt`; `draw` on a `text`; `type` on anything but a `text`.

## Making drawings that say something

- Make drawings that say something: a growing bar, a flow of arrows, planets in orbit, a countdown, a balance, a process that builds itself. Do not fill the canvas with random shapes, and keep text short.
- Tie what matters to the narration with `at`: the moment line 2 is spoken is `at: "line2"` on a shape and `"line2"` as the position in the script.
- Use `enter`, `loop` and `exit` first; most scenes need no script. Reach for the script for paths, orbits and moves the presets cannot make.
- Pick the canvas of the video's shape: `wide` for landscape, `square` for square, `tall` for portrait.
- Set `"header": false` on a motion scene so the drawing fills the frame.
- Maps, journeys and timelines have scenes of their own (`worldmap`, `journey`, `timetravel`); a dashboard, a diagram or a layout of many parts is a `compose` scene.
