vidmake v0.2.1
Download

Docs/LayersPage 14 / 45

Text

Text layers — fonts and project fonts (including WOFF2), sizing and wrapping, alignment, spacing, backgrounds, outlines and gradients, underline/strike/highlight decorations, live ${...} values, rich text spans with their own color, weight, italic and font, typewriter reveals, and per-character, word or line stagger with blur-in and rise.

View .md Ask Claude Ask ChatGPT

A text layer draws one block of text: a word, a title, a paragraph or a page of code. Glyphs are turned into vector outlines, so text takes gradients, outlines, shadows and every effect, and stays sharp at any scale.

json
{ "id": "title", "type": "text", "text": "Launch day", "font": "Schibsted Grotesk", "fontSize": 120, "fontWeight": 860,  "fill": "#161412", "enter": "fadeUp" }
00:00.0 · f 000
Gradient fill, an outline with no fill, and a text background tagDownload
text-styles.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }  ],  "compositions": [{    "id": "styles", "description": "Gradient fill, an outline with no fill, and a text background tag",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "tag", "type": "text", "text": "New in 0.2", "y": 150, "font": "JetBrains Mono", "fontSize": 18, "fontWeight": 600,        "uppercase": true, "letterSpacing": 3, "fill": "#f4f1ea", "background": "#c92a26", "padding": [10, 16], "cornerRadius": 2,        "enter": "pop" },      { "id": "gradient", "type": "text", "text": "Ink to pencil", "y": 300, "font": "Schibsted Grotesk", "fontWeight": 860,        "fontSize": 140, "letterSpacing": -6, "start": "0.2s", "enter": "fadeUp",        "fill": { "type": "linear", "angle": "=90 + t * 45", "stops": ["#161412", "#4a4640", "#c92a26"] } },      { "id": "outline", "type": "text", "text": "OUTLINE", "y": 480, "font": "Schibsted Grotesk", "fontSize": 128,        "letterSpacing": 4, "fill": null, "stroke": "#161412", "strokeWidth": 2.5, "start": "0.4s", "enter": "fadeUp" },      { "id": "shadowed", "type": "text", "text": "fill + stroke + shadow", "y": 610, "font": "Schibsted Grotesk", "fontSize": 44,        "fontWeight": 800, "fill": "#fbf9f4", "stroke": "#161412", "strokeWidth": 5,        "shadow": { "color": "#16141244", "blur": 10, "y": 6 }, "start": "0.6s", "enter": "fadeUp" }    ]  }]}

#Fields

fielddefaultnotes
textrequiredThe string. \n breaks lines. ${expr} is evaluated every frame. Or an array of spans.
fontsans-serifA family name, a generic (sans-serif, serif, monospace), or a project font.
fontSize64px, animatable. "10%" is 10% of the parent height.
fontWeight400100..900, or thin extralight light normal/regular medium semibold bold extrabold black/heavy.
italicfalsePicks the italic face of the family; a family without one is slanted instead.
fillwhiteAny paint, including gradients. null for outline-only text.
stroke, strokeWidthnone, 2An outline drawn behind the fill.
aligncenterleft, center or right: how lines line up inside the text box.
lineHeight1.2Multiple of fontSize. A plain number (not animatable).
letterSpacing0Extra px between characters, animatable. Negative tightens.
maxWidthnoneWrap width in px or "80%" of the parent width. Animatable.
uppercasefalseUppercases the text after ${...} values are filled in.
whiteSpacenormalpre keeps every space and turns tabs into 4 spaces.
backgroundnonePaint for a box behind the text, e.g. a pill or a caption plate.
padding16 with a background, else 0Space between the text and the edge of its box, px, animatable. [vertical, horizontal] or {x, y} for different sides.
cornerRadius0Rounds the background box. "50%" makes a pill.
reveal10..1 fraction of characters shown, animatable: a typewriter.
staggerPlay the layer's enter per character, word or line. See Stagger.
styleA theme type style ("$type.display"): font, size, weight, leading, tracking. The layer's own fields win.
decorationUnderline, strike-through or highlight, drawn on with progress. See Decoration.

Every common field applies too: position, anchor, rotation, scale, opacity, shadow, blur, presets and so on.

#The text box

A text layer has no fixed size: its box is measured from the content every frame. The width is the widest line, the height is lines × lineHeight × fontSize, and padding is added on every side. The anchor (center by default) refers to that box, so a centered title stays centered whatever it says.

inspect prints the measured size of every text layer, which is the quickest way to check that a title fits or to line other layers up with it:

vidmake inspect text-styles.json -t 2s
$ vidmake inspect text-styles.json -t 2s
Frame 60 (2.00s) of `styles` (1280x720), 4 visible layer(s), drawn bottom→top:

ID                       TYPE            X        Y       W       H    ROT  SCALE  OPAC  BBOX [x0,y0,x1,y1]          NOTES
tag                      text        640.0    150.0   161.0    41.6    0.0   1.00  1.00  [560,129,720,171]           "NEW IN 0.2"
gradient                 text        640.0    300.0   819.8   168.0    0.0   1.00  1.00  [230,216,1050,384]          "Ink to pencil"
outline                  text        640.0    480.0   574.2   153.6    0.0   1.00  1.00  [353,403,927,557]           "OUTLINE"
shadowed                 text        640.0    610.0   466.0    52.8    0.0   1.00  1.00  [407,584,873,636]           "fill + stroke + shadow"

Setting width or height on a text layer overrides the measured size for placement and anchoring, but does not scale the glyphs or wrap the text. Use fontSize to resize and maxWidth to wrap.

#Fonts

font takes a family name. To see what is installed on the machine that renders, run vidmake fonts with an optional filter:

vidmake fonts inter
$ vidmake fonts inter
Inter  weights 400,700  no italic (italic: true is slanted)
SignPainter  weights 400  no italic (italic: true is slanted)

The generic names sans-serif, serif and monospace (also sans, mono) pick the system's default for that style, with a fallback to common fonts on minimal machines. A named family that is not installed is an error at validate time, with a hint, rather than a silent substitution.

Characters missing from the chosen font (accents, symbols, CJK) fall back glyph by glyph to other installed fonts, so mixed scripts render without extra setup.

#Project fonts

For a specific typeface, and for renders that look the same on every machine, ship the font file with the project and declare it in the top-level fonts list:

project.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" },    { "family": "Brand", "path": "fonts/Brand-Variable.ttf" }  ],  "compositions": [ ... ]}
  • path is relative to the project file. TTF, OTF, WOFF and WOFF2 files work, including collections and variable fonts (a variable font's weight axis follows fontWeight). Web design systems usually ship WOFF2; point at it directly, no conversion needed.
  • family is the name you use in font. Several files can share one family name; vidmake then picks the file closest to the requested fontWeight and italic, so the declaration above makes "italic": true use the italic file.
  • Without family, the font is still loaded and is available under the family name stored in the file.
  • vidmake fonts --project project.json lists installed fonts plus the project's. With a filter (or --faces) it lists each family's weights, its variable wght range and whether it has italics, so you know before rendering that fontWeight: 300 on a static Regular/Bold family will snap to 400.

#Italic without an italic font

Many display faces (pixel, mono and geometric fonts especially) ship no italic. "italic": true on such a family slants the regular glyphs instead, the way browsers draw a faux oblique, so a design system's "italic accent line" still works. For a stronger or animated lean, any layer takes skewX.

00:00.0 · f 000
A WOFF2 web font, a synthetic italic for a family without one, and an animated skewXDownload
text-woff-oblique.jsonjson
{  "fonts": [{ "family": "Geist Pixel", "path": "fonts/GeistPixel-Square.woff2" }],  "compositions": [{    "id": "woff", "description": "A WOFF2 web font, a synthetic italic for a family without one, and an animated skewX",    "width": 1280, "height": 720, "fps": 30, "duration": "3s", "background": "#f4f1ea",    "layers": [      { "id": "upright", "type": "text", "text": "Geist Pixel.woff2", "font": "Geist Pixel", "fontSize": 92, "fill": "#161412", "y": 200,        "enter": "fadeUp" },      { "id": "slanted", "type": "text", "text": "italic: true", "font": "Geist Pixel", "italic": true, "fontSize": 92, "fill": "#c92a26",        "y": 360, "start": "0.3s", "enter": "fadeUp" },      { "id": "skewed", "type": "text", "text": "skewX", "font": "Geist Pixel", "fontSize": 92, "fill": "#4a4640", "y": 520,        "skewX": { "keys": [[0, -25], ["0.8s", 25, "easeInOutCubic"], ["1.6s", -25, "easeInOutCubic"]], "repeat": "loop" } }    ]  }]}

Tip

Project fonts are the reliable choice for agents rendering on servers and in CI: system fonts differ between machines, and text that wraps differently changes the whole layout.

#Wrapping and alignment

Without maxWidth, text only breaks at \n. With it, words wrap onto new lines whenever a line would get wider than maxWidth. A single word longer than maxWidth is not broken and overflows.

00:00.0 · f 000
maxWidth wraps text; it is animatable, so the paragraph reflows as the box growsDownload
text-wrap.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }  ],  "compositions": [{    "id": "wrap", "description": "maxWidth wraps text; it is animatable, so the paragraph reflows as the box grows",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "box", "type": "rect", "y": "45%", "height": 400, "fill": null, "stroke": "#c92a26", "strokeWidth": 1.5,        "dash": [10, 8], "width": [[0, 400], ["2s", 1040, "easeInOutCubic"], ["4s", 400, "easeInOutCubic"]] },      { "id": "para", "type": "text", "y": "45%", "font": "Schibsted Grotesk", "fontWeight": 500, "fontSize": 38, "lineHeight": 1.3,        "letterSpacing": -0.5, "fill": "#161412",        "maxWidth": [[0, 360], ["2s", 1000, "easeInOutCubic"], ["4s", 360, "easeInOutCubic"]],        "text": "Every frame is a pure function of time, so any frame can be checked in isolation before you render." },      { "id": "label", "type": "text", "y": "88%", "font": "JetBrains Mono", "fontSize": 20, "letterSpacing": 1, "fill": "#4a4640",        "text": "maxWidth: ${round(360 + 640 * easeInOutCubic(pingpong(t / 2, 1)))}" }    ]  }]}

align positions each line inside the box. With maxWidth set and align center or right, the box is maxWidth wide (lines center or right-align within it); with align: "left" the box shrinks to the longest line. For a left-aligned paragraph, anchor its left edge so it grows to the right:

json
{ "id": "body", "type": "text", "text": "...", "align": "left", "anchor": "top-left", "x": 120, "y": 200,  "maxWidth": 640, "fontSize": 32, "lineHeight": 1.4 }

validate warns with textOverflow when a text layer sticks out of the canvas, which usually means a missing maxWidth or a too-large fontSize.

#Spacing and case

  • lineHeight is relative to fontSize: 1.2 is a comfortable default, 0.95–1.05 suits big display titles, 1.4–1.6 long paragraphs.
  • letterSpacing is absolute px. Wide tracking on small uppercase labels ("letterSpacing": 4, "uppercase": true) is a classic subtitle style; animating it from 20 to 0 makes an elegant entrance.
  • uppercase changes the text, not the font, so ${...} values and spans are uppercased too.
  • In the default whiteSpace: "normal", runs of spaces collapse into one and leading spaces disappear. "whiteSpace": "pre" keeps them, which is what code, tables and ASCII art need.

#Background, padding and outlines

background draws a box behind the text, the size of the text box (including padding), rounded by cornerRadius. It is the simplest way to make tags, chips, buttons and caption plates:

json
{ "id": "tag", "type": "text", "text": "New in 0.2", "font": "JetBrains Mono", "fontSize": 18, "fontWeight": 600,  "uppercase": true, "letterSpacing": 3, "fill": "#f4f1ea", "background": "#c92a26", "padding": [10, 16],  "cornerRadius": 2 }

stroke outlines each glyph. The outline is drawn behind the fill, so a thick dark stroke under light text gives the bold, readable "meme caption" look without eating into the letters, and "fill": null with a thin stroke gives hollow outline type. A shadow on top of that lifts the text off busy video.

Padding can differ per side pair: buttons usually want more room left and right than above and below. "padding": [18, 36] is 18 px top and bottom, 36 px left and right (CSS order), and { "x": 36, "y": 18 } says the same thing by name.

#Decoration

decoration draws a line under (underline), through (strike) or a band behind (highlight) the text. It is measured from the glyphs every frame, so it follows wrapping, alignment, letterSpacing, ${...} values and reveal; there are no widths to look up or keep in sync.

00:00.0 · f 000
Underline, strike-through and highlight, measured from the glyphs and drawn on with progressDownload
text-decoration.jsonjson
{  "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }],  "compositions": [{    "id": "decoration", "description": "Underline, strike-through and highlight, measured from the glyphs and drawn on with progress",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "under", "type": "text", "text": "underline", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 96,        "letterSpacing": -4, "fill": "#161412", "align": "left", "anchor": "left", "x": 140, "y": 150,        "decoration": { "type": "underline", "color": "#161412", "thickness": 6, "offset": 10,          "progress": { "from": 0, "to": 1, "start": "0.3s", "duration": "0.6s", "ease": "easeOutCubic" } } },      { "id": "strike", "type": "text", "text": "strike it off", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 96,        "letterSpacing": -4, "fill": "#161412", "align": "left", "anchor": "left", "x": 140, "y": 300,        "opacity": "=map(t, 1.3, 1.6, 1, 0.4)",        "decoration": { "type": "strike", "color": "#c92a26", "thickness": 7, "extend": 10,          "progress": { "from": 0, "to": 1, "start": "1s", "duration": "0.4s", "ease": "easeOutQuint" } } },      { "id": "mark", "type": "text", "text": "or highlight a phrase that wraps onto a second line",        "font": "Schibsted Grotesk", "fontWeight": 500, "fontSize": 64, "letterSpacing": -1.5, "fill": "#161412",        "align": "left", "anchor": "top-left", "x": 140, "y": 400, "maxWidth": 900, "lineHeight": 1.15,        "decoration": { "type": "highlight", "color": "#c92a2626",          "progress": { "from": 0, "to": 1, "start": "1.8s", "duration": "1.2s", "ease": "easeInOutCubic" } } }    ]  }]}
json
"decoration": { "type": "strike", "color": "#c92a26", "thickness": 7, "extend": 10,                "progress": { "from": 0, "to": 1, "start": "1s", "duration": "0.4s", "ease": "easeOutQuint" } }
fielddefaultnotes
typerequiredunderline, strike or highlight. A bare string ("decoration": "underline") is the static form.
progress10..1, animatable: draws the line on from the left, one line after another.
bytotalline draws every line at once.
colorthe text fillAny paint. Give highlight a translucent color (#c92a2626).
thickness7% of fontSize (80% for highlight)px, animatable.
offset0px, moves the line down (negative moves it up).
extend0 (12% of fontSize for highlight)px the line runs past each end of a line of text.

Strike-throughs and highlights are drawn per line of text, so a wrapped paragraph gets one band per line. Pair progress with a marker ("start": "@strike") to strike several items on the same beat.

#Gradient text

fill takes any paint. Gradient coordinates are relative to the text box, so "angle": 90 runs from the first letter to the last, whatever the text says. The angle is animatable, which makes a slow sheen:

json
"fill": { "type": "linear", "angle": "=90 + t * 45", "stops": ["#161412", "#4a4640", "#c92a26"] }

#Live text with ${...}

Anything inside ${...} in text is an expression, evaluated every frame. It has the layer's time variables (t, f, p, dur...), props and the formatting helpers:

templateprints
"${round(t * 10)}"an integer counter
"${t:2}"t with exactly 2 decimals (:N fixes the decimal places)
"${fmt(round(map(t, 0, 2, 0, 1500000)))} users"1,500,000 users with thousands separators
"${pad(f, 3)}"the frame number padded to 3 digits
"${pick(i, ['Mon', 'Tue', 'Wed'])}"a different word per repeat copy

Values that are not whole numbers print with up to two decimals. The expression ends at the first }, so it cannot contain braces. Text values are evaluated at the whole frame, so counters stay crisp even under motion blur.

00:00.0 · f 000
${...} templates are evaluated every frame: a counter and a clockDownload
text-live.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }  ],  "compositions": [{    "id": "live", "description": "${...} templates are evaluated every frame: a counter and a clock",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "count", "type": "text", "y": "40%", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 190,        "letterSpacing": -8, "fill": "#161412", "text": "${fmt(round(1250000 * easeOutCubic(clamp(t / 2.5, 0, 1))))}" },      { "id": "unit", "type": "text", "y": "58%", "font": "JetBrains Mono", "fontSize": 18, "letterSpacing": 4, "uppercase": true,        "fill": "#8a857a", "text": "frames rendered" },      { "id": "clock", "type": "text", "y": "82%", "font": "JetBrains Mono", "fontSize": 26, "fill": "#4a4640",        "text": "t = ${t:2}s  ·  f = ${pad(f, 3)}  ·  p = ${round(p * 100)}%" }    ]  }]}

To make a count-up match an eased animation elsewhere, use the same easing function in the template: "${round(84 * easeInOutCubic(clamp(t / 2, 0, 1)))}%" follows a tween with "ease": "easeInOutCubic" and "duration": "2s" exactly.

#Rich text

text can be an array. Each item is a string or a span object; all of them are laid out as one block, wrapped and aligned together:

json
{ "id": "headline", "type": "text", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 92, "fill": "#161412",  "text": ["Made with ", { "text": "care,", "italic": true, "fontWeight": 400, "fill": "#c92a26" }, " in JSON."] }
span fielddefaultnotes
textrequiredThe span's text. May contain \n and ${...}.
fillthe layer's fillAny paint, including gradients.
fontWeightthe layer's fontWeightSame values as the layer field: 700, "bold", "light"...
italicthe layer's italictrue or false, so a span can also turn italics off inside an italic layer.
fontthe layer's fontAnother family: a code word in a sentence, a serif word in a sans line.

Plain strings use the layer's own settings. Every field of a span is optional except text, so { "text": "bold", "fontWeight": "bold" } changes only the weight:

00:00.0 · f 000
Rich-text spans with their own italic, fontWeight and font, each laid out in one blockDownload
text-spans.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono-Italic.ttf" }  ],  "compositions": [{    "id": "spans", "description": "Rich-text spans with their own italic, fontWeight and font, each laid out in one block",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "headline", "type": "text", "y": 215, "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 92,        "letterSpacing": -4, "fill": "#161412", "enter": "fadeUp",        "text": ["Made with ", { "text": "care,", "italic": true, "fontWeight": 400, "fill": "#c92a26" }, " in JSON."] },      { "id": "body", "type": "text", "y": 375, "font": "Schibsted Grotesk", "fontSize": 36, "fill": "#4a4640",        "start": "0.4s", "enter": "fadeUp",        "text": ["Spans can be ", { "text": "bold", "fontWeight": "bold", "fill": "#161412" }, ", ",          { "text": "italic", "italic": true, "fill": "#161412" }, " or set in ",          { "text": "another font", "font": "JetBrains Mono", "fill": "#161412" }, "."] },      { "id": "code", "type": "text", "y": 525, "font": "JetBrains Mono", "fontSize": 30, "fill": "#161412",        "background": "#e9e4d8", "padding": [22, 30], "cornerRadius": 4, "start": "0.8s", "enter": "fadeUp",        "text": [{ "text": "let", "fontWeight": "bold", "fill": "#4a4640" }, " frames = ", { "text": "90", "italic": true },          ";  ", { "text": "// three seconds", "italic": true, "fill": "#4a4640" }] }    ]  }]}

A few rules follow from "one block":

  • Size, line height and spacing belong to the layer. There is no per-span fontSize (unknown text span field `fontSize` (allowed: text, fill, font, fontWeight, italic)). Line height and the width of spaces between words come from the layer's font, so a mono word inside a Schibsted Grotesk line sits on the same baseline and line grid as its neighbors. For a different size, use a second text layer (a row layout lines them up without arithmetic).
  • Spaces use the layer's font too. Padding a monospace span with spaces won't line up columns inside a proportional layer; make the layer itself monospace, or put each column in its own layer.
  • A span picks a face of its family. italic and fontWeight choose the matching file of the family; when there is none (a project font declared without its italic file, say), the nearest face is used as is. vidmake doesn't fake bold or slant, so declare every face you use. A family that doesn't exist fails validation like a layer font does.
  • Everything per-character still works. reveal, stagger, attach to the last visible character, uppercase and ${...} treat the spans as one string.

With "font": "monospace" (or a code font), "align": "left" and "whiteSpace": "pre", spans make syntax-colored code in a single layer, with bold keywords and italic comments if you like ({ "text": "let", "fontWeight": "bold", "fill": "#4a4640" }):

00:00.0 · f 000
Syntax-colored code from rich text spans, typed out with reveal and a blinking cursorDownload
text-code.jsonjson
{  "fonts": [    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono-Italic.ttf" }  ],  "compositions": [{    "id": "code", "description": "Syntax-colored code from rich text spans, typed out with reveal and a blinking cursor",    "width": 1280, "height": 720, "fps": 30, "duration": "5s", "background": "#f4f1ea",    "layers": [      { "id": "panel", "type": "rect", "width": 920, "height": 340, "cornerRadius": 4, "fill": "#fbf9f4",        "stroke": "#161412", "strokeWidth": 2 },      { "id": "code", "type": "text", "anchor": "top-left", "x": 251, "y": 252, "font": "JetBrains Mono", "fontSize": 36,        "align": "left", "whiteSpace": "pre", "lineHeight": 1.5, "fill": "#161412",        "reveal": { "from": 0, "to": 1, "start": "0.3s", "duration": "3s", "ease": "linear" },        "text": [          { "text": "fn", "fill": "#4a4640", "fontWeight": 700 }, " ", { "text": "render", "fontWeight": 700 }, "(frame: ",          { "text": "u32", "fill": "#4a4640" }, ") {\n",          "    ", { "text": "let", "fill": "#4a4640", "fontWeight": 700 }, " t = frame ", { "text": "as", "fill": "#4a4640", "fontWeight": 700 }, " ",          { "text": "f64", "fill": "#4a4640" }, " / ", { "text": "30.0", "italic": true }, ";\n",          "    draw(t) ", { "text": "// pure function of time", "fill": "#8a857a", "italic": true }, "\n}"        ] },      { "id": "cursor", "type": "rect", "attach": "code", "x": 4, "width": 14, "height": 40, "fill": "#c92a26",        "opacity": "=t < 3.3 ? 1 : floor(t * 2.5) % 2", "lint": { "ignore": ["invisible"] } }    ]  }]}

#Typewriter: reveal

reveal is the fraction of characters shown, from 0 (none) to 1 (all, the default). Animate it with a linear tween for a typewriter; spaces are skipped, so the speed is per visible character.

json
"reveal": { "from": 0, "to": 1, "start": "0.3s", "duration": "3s", "ease": "linear" }

The typewriter preset does the same thing as an enter: "enter": { "type": "typewriter", "duration": "2s" }. A blinking cursor that follows the last revealed character is a small rect with "attach": "<text id>", as in the code demo above.

#Stagger

stagger plays the layer's own enter once per character, word or line, each at its turn. The whole layer doesn't also enter:

json
{ "id": "title", "type": "text", "text": "Design that moves", "stagger": "char",  "enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" } } }

Without an enter, each unit plays fadeUp. Any entrance works per unit: a preset, a state with opacity, x/y, scale, rotate and blur, and rise. blur is real per-unit blur, so letters come into focus one by one. In a unit's state, % is of the line height.

00:00.0 · f 000
One text layer each: letters blur in, words rise from behind their line, letters spread from the centerDownload
text-stagger.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" }  ],  "compositions": [{    "id": "stagger", "description": "One text layer each: letters blur in, words rise from behind their line, letters spread from the center",    "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea",    "layers": [      { "id": "by-char", "type": "text", "text": "Letter by letter", "y": 170, "font": "Schibsted Grotesk", "fontWeight": 860,        "fontSize": 116, "letterSpacing": -5, "fill": "#161412", "stagger": "char",        "enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" } }, "exit": "fade" },      { "id": "by-word", "type": "text", "text": "then word by word", "y": 340, "font": "Schibsted Grotesk", "italic": true,        "fontSize": 104, "letterSpacing": -3, "fill": "#161412", "start": "0.7s", "stagger": "word", "enter": "rise", "exit": "fade" },      { "id": "from-center", "type": "text", "text": "and from the center out", "y": 530, "font": "Schibsted Grotesk", "fontWeight": 800,        "fontSize": 64, "letterSpacing": -2.5, "fill": "#c92a26", "start": "1.4s", "stagger": { "by": "char", "from": "center", "over": "0.5s" },        "enter": { "from": { "opacity": 0, "scale": 0.3 }, "motion": "bouncy" }, "exit": "fade" }    ]  }]}
fielddefaultnotes
bywordchar (alias letter), word or line. "stagger": "char" is short for { "by": "char" }
overchar 0.4s, word 0.6s, line 0.5stotal spread: from the first unit's start to the last one's, whatever the count
maxchar 40ms, word 100ms, line 150msthe longest gap between two units, so a short word doesn't crawl
eacha fixed gap per unit instead of over and max
fromfirstwhich unit starts first: first, last, center, edges, random (a fixed shuffle) or an index
spreadlinearan easing for the start times: easeOut bunches the late units together

#Budget, not gap

A stagger spreads its start times over a total time. With the defaults, a 4-letter word gets a 40 ms gap (capped by max) and a 30-letter title gets 14 ms, so both are fully started within 0.4 s. A long title doesn't take longer than a short one. The entrance itself (the enter motion, smooth by default) runs on top: the last unit settles at over plus the motion's duration.

Use each when the rhythm matters more than the total, for example a slow, deliberate typewriter beat: { "by": "word", "each": "200ms" }.

#Order

from changes who goes first. center starts in the middle and spreads out, edges closes in from both ends, and random shuffles the units in a fixed order (the same in every render):

json
"stagger": { "by": "char", "from": "center", "over": "0.5s" },"enter": { "from": { "opacity": 0, "scale": 0.3 }, "motion": "bouncy" }

#Rising lines

With "enter": "rise" (or any entrance with "clip": "line"), each line's glyphs are clipped to their own line box, so words or lines slide up from behind an invisible edge:

json
{ "type": "text", "text": "Ship faster.\nSleep better.", "stagger": "word", "enter": "rise" }

#Why a budget

Until 0.5 a stagger gave every unit a fixed gap (each, default 50 ms) and played a preset that started at full speed (easeOutCubic) and travelled 40 to 120 px. Long titles dragged, letters arrived with a jolt, and the motion read as choppy. Now units move a short distance in em, start from rest on a spring, can blur into focus, and share a total time. The two lines below run the same text both ways:

00:00.0 · f 000
The same title twice: a fixed 45 ms gap, 40 px and easeOutCubic (top) against a 0.4 s budget, 0.3em, a spring and blurDownload
text-stagger-compare.jsonjson
{  "fonts": [    { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" },    { "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }  ],  "compositions": [{    "id": "compare", "description": "The same title twice: a fixed 45 ms gap, 40 px and easeOutCubic (top) against a 0.4 s budget, 0.3em, a spring and blur",    "width": 1280, "height": 720, "fps": 30, "duration": "3s", "background": "#f4f1ea",    "layers": [      { "id": "label", "type": "text", "text": "${pick(i, ['each 45ms · 40px · easeOutCubic', 'stagger: \"char\" · 0.3em · spring · blur'])}",        "font": "JetBrains Mono", "fontSize": 18, "letterSpacing": 1, "fill": "#8a857a", "y": 150,        "repeat": { "count": 2, "layout": "column", "spacing": 260, "origin": "start" } },      { "id": "fixed", "type": "text", "text": "Design that moves with you", "y": 245, "font": "Schibsted Grotesk",        "fontWeight": 860, "fontSize": 84, "letterSpacing": -3.5, "fill": "#8a857a",        "stagger": { "by": "char", "type": "fadeUp", "each": "45ms", "duration": "0.5s", "distance": 40, "ease": "easeOutCubic" } },      { "id": "budget", "type": "text", "text": "Design that moves with you", "y": 505, "font": "Schibsted Grotesk",        "fontWeight": 860, "fontSize": 84, "letterSpacing": -3.5, "fill": "#161412", "stagger": "char",        "enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" } } }    ]  }]}

The 0.5 form, { "by", "type", "each", "duration", "delay", "distance", "ease" }, still works: when the stagger names a type (or any of those entrance fields) it describes the unit entrance itself, and the layer's enter plays as a whole.

How the pieces fit together:

  • Units are counted across the whole layer, so the first word of the second line follows right after the last word of the first line. Spaces are not characters.
  • The layout is computed once for the final text, so letters land exactly where they would be without stagger and nothing reflows.
  • exit still applies to the layer as a whole, so "exit": "fade" fades the finished line out together.
  • A wipe* or typewriter enter works on the whole text even with a stagger: the layer wipes or types in while its units fade up. Inside the stagger's own fields (the 0.5 form) they're errors; use rise or a state.
  • To delay the whole stagger, give the layer a start (or the enter a delay).

Tip

by: "line" on a text with \n separators is the quickest staggered bullet list. For lists whose items need different styles, use a column layout with one text per item and a group stagger.

#Checklist for agents

For agents

  • Use a project font (fonts + font) for anything that must look the same everywhere; check installed names with vidmake fonts <filter>.
  • After writing text, run vidmake inspect project.json -t <time> -l <id> and read W/H to see the measured box; vidmake validate reports textOverflow when it leaves the canvas.
  • Long sentences need maxWidth; a title usually does not.
  • A bold word, an italic word or a code word inside a sentence is a span (fontWeight, italic, font) in the same layer; only a different size needs a separate layer.
  • lineHeight cannot animate; fontSize, letterSpacing, maxWidth, padding and reveal can.
  • Never hand-measure text to draw a line under or through it: use decoration.