vaweGitHub

Video componentsReveal a title

Caption karaoke

a spoken line runs as captions: the word being said lifts to full ink and one soft pill glides word to word on a [[t, wordIndex]] speech table.

Reveal a titleproduct4.4 s

caption-karaoke.md

Caption karaoke: final frame of the text reveal animation
00:00.0000:04.40
Tap the clip to play it.

When to use

Use when a spoken line runs as captions and the eye must follow the voice: the word being said turns solid yellow on its own spoken second, and the rest of the page stays white. The page never re-wraps and no word moves.

The code

js
// pages of captions: [start s, end s, [[word, second it is spoken], ...] per line]: one table, edited in place
const PAGES = [[0.4, 2.3, [[['Captions', 0.4], ['that', 0.95]], [['follow', 1.2], ['the', 1.55], ['voice', 1.7]]]], /* ... */];
show(page, from * 1000, to * 1000);                       // a page appears and goes on one frame
// the active word is yellow from its second to the next word (or 0.45 s): a hard colour step
vawe.onFrame((t) => words.forEach(({ w, at }) => w.classList.toggle('on', t >= at && t < end(at))));

Easing

Each ease is a pair of After Effects handles from core/motion/presets.js. Every curve as CSS.

EaseLeaving a keyArriving at a key
glide33% influence, speed 033% influence, speed 0.1

Notes

css
.caps { font: 900 11.5u Archivo; text-transform: uppercase; text-align: center; color: #fff; }
.w { -webkit-text-stroke: 1.8u #000; paint-order: stroke fill; }
.w.on { color: #ffe500; }

How it looks and moves

  • The clip copies a short-video caption: a heavy uppercase sans, centred in the lower third of the shot, white with a thick black stroke and a soft shadow so it reads on any footage.
  • A page holds 2 lines and 3 to 5 words. The next page replaces it on one frame.
  • The active word is solid yellow (#ffe500). It switches on one frame, with no glide, pill or lift, as these captions do.
  • The footage is a real photograph with a slow 3 percent push on the glide ease (EASE.glide, 4.4 s). The pages run back to back from 0.4 s to 4.1 s with no gap, and the clip ends 0.3 s after the last page. Frame 0 and the last frame show the footage without captions.
  • The caption is 11.5 percent of the frame height, so it reads at once.

The common mistake

Timing each word with a setTimeout, or tweening a highlight per word. Both drift from the speech. Keep one table of spoken seconds and derive the state from t.

Sound

Sound: none; the voice is the sound.

Chain it into a film.

Copy chains of video components from the recipes.