vidmake v0.2.1
Download

Journal/typography · motion · tutorialEntry 05 / 10

Kinetic typography in JSON

Stagger by character, word and line, typewriters with a real cursor, live counters inside rich text, gradient and outlined type, and words that flip up in 3D. Three complete pieces you can copy.

▸ blog-type-flip1280×720 · 30 fps · 0:05.0Rendered by vidmake

Most programmatic video is text: titles, captions, numbers, lists. Kinetic typography is where a declarative format either holds up or falls apart, because type in motion needs a lot of small controls: how letters arrive, where a cursor goes, how a number is formatted while it counts, what happens to a line when the word before it changes width.

This post builds three typographic pieces with vidmake, each a single JSON file, and points out the details that took us more than one try. All three are set in Schibsted Grotesk, heavy and tightly tracked for display with its lighter italic for emphasis, and the vertical piece adds JetBrains Mono for its typed line and label. Every face is loaded from the project with a fonts entry.

#Arrivals: char, word, line

A stagger on a text layer splits it into units and gives each unit its own entrance, offset by each:

json
"stagger": { "by": "char", "type": "fadeUp", "each": "60ms", "duration": "0.8s", "distance": 120 }

by is char, word or line. type is any preset, not only fades: pop, blur, fadeLeft, scale and the rest all work per unit. distance sets how far the slide presets travel, and delay pushes the whole sequence later. Here are all three granularities in one vertical piece, followed by a typewriter:

00:00.0 · f 000
Stagger by char, by word and by line, then a typewriter with an attached cursorDownload

A few choices in there are deliberate:

  • The big word staggers by character with a long distance (120 px instead of the default 40). With large type, a short slide reads as a twitch; a long one reads as a fall into place.
  • The middle line uses pop. A spring overshoot is too bouncy for single letters at this size, but per word it gives a sentence a sense of rhythm.
  • The paragraph staggers by line with fadeLeft. A line unit is a laid-out line: each \n you write, plus any wrap that maxWidth adds. This layer has no maxWidth, so the units are exactly the three lines in the JSON.

#A cursor that knows where the typing is

The last line uses the typewriter preset, which animates reveal (the fraction of characters shown) from 0 to 1. The underscore cursor isn't positioned by hand at all:

json
{ "id": "cursor", "type": "rect", "width": 18, "height": 4, "attach": "typed", "x": 12, "y": 18,  "opacity": "=fract(t * 1.6) < 0.5 ? 1 : 0", "lint": { "ignore": ["invisible"] } }

"attach": "typed" places it right after the last visible character of the typed layer, on every frame. x and y become small offsets from that point, which here drop it to the baseline. A trace shows it walking right as characters appear, blinking as it goes:

vidmake trace blog-type-stagger.json -l cursor --every 6 --from 2.8s --to 4.4s
$ vidmake trace blog-type-stagger.json -l cursor --every 6 --from 2.8s --to 4.4s
 FRAME    TIME        X        Y       W       H    ROT  SCALE  OPAC  NOTES
    84   2.80s    166.8    939.6    18.0     4.0    0.0   1.00  1.00  
    90   3.00s    210.0    939.6    18.0     4.0    0.0   1.00  1.00  
    96   3.20s    274.8    939.6    18.0     4.0    0.0   1.00  0.00  
   102   3.40s    318.0    939.6    18.0     4.0    0.0   1.00  0.00  
   108   3.60s    404.4    939.6    18.0     4.0    0.0   1.00  1.00  
   114   3.80s    469.2    939.6    18.0     4.0    0.0   1.00  0.00  
   120   4.00s    512.4    939.6    18.0     4.0    0.0   1.00  0.00  
   126   4.20s    577.2    939.6    18.0     4.0    0.0   1.00  1.00  
   132   4.40s    577.2    939.6    18.0     4.0    0.0   1.00  0.00

The lint line is there because the cursor is invisible half the time by design, and we'd rather validate stay quiet about it than train ourselves to ignore its warnings.

#Numbers: counters, spans and outlines

A ${...} in text is an expression evaluated every frame. Combined with fmt() for thousands separators and an easing function, that is a counter:

json
"text": "${fmt(round(12480 * easeOutCubic(clamp(t / 2.4, 0, 1))))}"

Read it inside out: t / 2.4 is the progress through a 2.4-second count, clamp holds it at 1 afterwards, easeOutCubic makes it decelerate into the final value, and fmt(round(...)) prints 12,480. Pick an ease that doesn't overshoot. easeOutBack on a counter briefly shows a number larger than the final one, a mistake we walk through in How an agent sees a video.

00:00.0 · f 000
A gradient counter inside outlined echoes of itself, and a sentence whose numbers are live, colored spansDownload
blog-type-counter.jsonjson
{  "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }],  "compositions": [{    "id": "counter", "description": "A gradient counter inside outlined echoes of itself, and a sentence whose numbers are live, colored spans",    "width": 1280, "height": 720, "fps": 30, "duration": "4.5s",    "background": { "type": "radial", "center": [0.5, 0.42], "radius": 0.9, "stops": ["#f4f1ea", "#e9e4d8"] },    "layers": [      { "id": "echo", "type": "text", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 240, "letterSpacing": -6, "repeat": 3,        "y": "=h * 0.4 - 30 * (i + 1) * easeOutCubic(clamp(t / 1.2, 0, 1))", "opacity": "=0.5 - 0.15 * i",        "text": "${fmt(round(12480 * easeOutCubic(clamp(t / 2.4, 0, 1))))}",        "fill": null, "stroke": "#8a857a", "strokeWidth": 1.5, "enter": "fade" },      { "id": "big", "type": "text", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 240, "letterSpacing": -6, "y": "40%",        "text": "${fmt(round(12480 * easeOutCubic(clamp(t / 2.4, 0, 1))))}",        "fill": { "type": "linear", "angle": 180, "stops": ["#161412", "#c92a26"] }, "enter": "fade" },      { "id": "line", "type": "text", "font": "Schibsted Grotesk", "fontSize": 32, "fill": "#4a4640", "y": "76%", "start": "0.4s",        "enter": "fadeUp",        "text": [          "rendered ", { "text": "${fmt(round(12480 * easeOutCubic(clamp(t / 2, 0, 1))))}", "fill": "#161412", "fontWeight": 700 },          " frames in ", { "text": "${41.2 * easeOutCubic(clamp(t / 2, 0, 1)):1}s", "fill": "#1f5fb0", "fontWeight": 700 },          " at ", { "text": "${round(303 * easeOutCubic(clamp(t / 2, 0, 1)))} fps", "fill": "#c92a26", "fontWeight": 700 }        ] }    ]  }]}

Three techniques are layered in this piece.

Gradient type. fill takes any paint, so { "type": "linear", "angle": 180, "stops": ["#161412", "#c92a26"] } shades the numerals from ink at the top to red at the bottom. Gradient coordinates are relative to the text box, so the gradient follows the text as its width changes.

Outlined echoes. The three ghost copies behind the number are one layer with "repeat": 3, "fill": null and a stroke. A text stroke is drawn behind the fill, so with no fill you get an outline. Each copy's y moves it up by 30 * (i + 1) pixels and its opacity drops with i, so the stack fans out as the count starts.

Live numbers inside a sentence. The line at the bottom is rich text: an array of spans, each with its own fill and weight, and each allowed its own ${...}:

json
"text": [  "rendered ", { "text": "${fmt(round(12480 * easeOutCubic(clamp(t / 2, 0, 1))))}", "fill": "#161412", "fontWeight": 700 },  " frames in ", { "text": "${41.2 * easeOutCubic(clamp(t / 2, 0, 1)):1}s", "fill": "#1f5fb0", "fontWeight": 700 },  " at ", { "text": "${round(303 * easeOutCubic(clamp(t / 2, 0, 1)))} fps", "fill": "#c92a26", "fontWeight": 700 }]

The :1 in ${41.2 * ...:1} formats the value with one decimal. Because all spans are laid out as one block, the sentence stays centered as the numbers grow. If you need the opposite, a number that doesn't nudge its neighbors, give it its own layer with a left or right anchor.

#Flips: 3D, springs and a row layout

The last piece is three words that flip up into place one after another, and a line of outlined capitals whose tracking tightens as it fades in:

00:00.0 · f 000
Repeated words flip up in 3D on a spring inside a row layout; an outlined line tightens its trackingDownload
blog-type-flip.jsonjson
{  "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }],  "compositions": [{    "id": "flip", "description": "Repeated words flip up in 3D on a spring inside a row layout; an outlined line tightens its tracking",    "width": 1280, "height": 720, "fps": 30, "duration": "5s",    "background": "#f4f1ea",    "layers": [      { "id": "row", "type": "group", "height": 200, "y": "44%", "layout": { "direction": "row", "gap": 30 },        "children": [          { "id": "word", "type": "text", "repeat": 3, "anchor": "bottom",            "text": "${pick(i, ['Write.', 'Look.', 'Render.'])}", "font": "Schibsted Grotesk", "fontWeight": 860,            "fontSize": 112, "letterSpacing": -5, "fill": "=pick(i, ['#161412', '#161412', '#c92a26'])", "perspective": 600,            "rotateX": "=95 * (1 - spring(f - i * 12, 11, 120))", "opacity": "=clamp((f - i * 12) / 6, 0, 1)" }        ] },      { "id": "outline", "type": "text", "text": "JSON in · video out", "font": "Schibsted Grotesk", "fontWeight": 600, "fontSize": 52,        "uppercase": true, "fill": null, "stroke": "#161412", "strokeWidth": 2, "y": "72%", "start": "1.4s",        "letterSpacing": { "from": 40, "to": 8, "duration": "1.6s", "ease": "easeOutCubic" }, "enter": "fade" }    ]  }]}

The words are one layer, repeated three times inside a row layout, so their positions come from their measured widths:

vidmake inspect blog-type-flip.json -t 2s
$ vidmake inspect blog-type-flip.json -t 2s
Frame 60 (2.00s) of `flip` (1280x720), 5 visible layer(s), drawn bottom→top:

ID                       TYPE            X        Y       W       H    ROT  SCALE  OPAC  BBOX [x0,y0,x1,y1]          NOTES
row                      group       640.0    316.8  1280.0   200.0    0.0   1.00  1.00  [0,217,1280,417]            
  word.0                 text        251.1    167.2   332.9   134.4    0.0   1.00  1.00  [85,250,418,384]            "Write."
  word.1                 text        594.5    167.2   293.9   134.4    0.0   1.00  1.00  [448,250,741,384]           "Look."
  word.2                 text        983.4    167.2   423.9   134.4    0.0   1.00  1.00  [771,250,1195,384]          "Render."
outline                  text        640.0    518.4   762.3    62.4    0.0   1.00  0.99  [259,487,1021,550]          enter:fade "JSON IN · VIDEO OUT"

The flip is rotateX (3D rotation around the anchor's horizontal axis) with "perspective": 600, a fairly close camera, so the near edge visibly grows as it comes up. With "anchor": "bottom", each word hinges on its baseline like a card being stood up.

#The detail that took two tries

Our first version staggered the words the obvious way, with "repeat": { "count": 3, "delay": "0.35s" } and a spring tween on rotateX. It looked wrong: "Write." appeared centered, then slid left when "Look." arrived, then again for "Render.". In a layout, a child outside its time window takes no space, so a delayed copy re-flows the row when it starts.

The fix is to keep all three copies on screen from frame 0 and delay their animation instead. The spring becomes an expression, with the copy index shifting its start:

json
"rotateX": "=95 * (1 - spring(f - i * 12, 11, 120))","opacity": "=clamp((f - i * 12) / 6, 0, 1)"

spring(frame, damping, stiffness) returns the same Remotion-compatible spring progress that "spring": {...} uses in a tween, 0 before frame 0 and settling at 1. f - i * 12 starts copy i twelve frames after the previous one. The layout measures the invisible words too, so the row is centered on the final line from the start and nothing moves sideways.

#Tracking as motion

The outlined line uses fill: null and a 2 px ink stroke, like the counter's echoes, plus an animated letterSpacing:

json
"letterSpacing": { "from": 40, "to": 8, "duration": "1.6s", "ease": "easeOutCubic" }

Letter spacing is animatable like any number. Wide tracking that closes up is a classic title move, and with uppercase: true and a semibold weight it works even at small sizes.

#A short checklist for type in motion

  • Decide the unit. Characters for single words, words for sentences, lines for paragraphs. Staggering a paragraph by character takes several seconds and reads as noise.
  • Use \n for line breaks you care about, and maxWidth for text whose length you don't control (titles from props, for example).
  • Counters: fmt, round, and an ease that doesn't overshoot. Check the result with trace, which prints the text at every sample.
  • Cursors and markers: use attach, never a hand-computed x. It keeps working when the font, size or text changes.
  • Layouts and delayed children don't mix unless you want the re-flow. Delay the animation, not the layer.
  • Check legibility on a storyboard. vidmake storyboard project.json -n 8 before every render shows whether the smallest text survives at the size the video will be watched at.

The text reference lists every field, and presets lists every entrance you can use in a stagger.

View .md Ask Claude Ask ChatGPT

Keep reading

showcasemotion

Four reels, thirty seconds each

A Swiss poster, a piece of generative op-art, a data poem and a risograph collage. Each is a single vidmake JSON file, written, checked and rendered by an agent, using nothing but the four stock assets.

Read

releasemotion

What's new in vidmake 0.5

Markers name the beats of a video, decoration draws underlines, strike-throughs and highlights from the glyphs, design tokens and named easings bring a brand's system into a project, and WOFF2 fonts, synthetic italics, skewX, themed SVG icons, repeat origins and wipe edges close the gaps an agent hit making a 20-second ad.

Read

releaseaudio

What's new in vidmake 0.2.1

vidmake analyze shows the beats and loudness curves that audio-reactive expressions will see, rich-text spans take fontWeight, italic and font, drawMode: "total" draws many strokes with one pen, and source builds report the right version.

Read