
Long shadow letters
Text, Scroll, 3D
The video of a made-up podcast, Quiet Hours, in the clean style of today’s apps: under the frame the large captions sit on two lines, and the spoken word lights up, heavier and wider through the axes of the variable typeface, while the others wait in grey. The key words take the orange, a finished line rolls up on a spring, the wave in the player bar follows the voice and the pause button stops everything.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Word-by-word captions" from Animorio · https://animorio.com
License: free on your own sites and your clients’ sites, paid work included.
Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Video captions that light up word by word</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage" data-stage>
<!-- the video of a made-up podcast, Quiet Hours: under the frame the captions light up word by word, the spoken word
grows in weight and width, and when a line is done the captions roll up on a spring -->
<section class="player" data-player aria-label="Quiet Hours, video podcast with captions">
<div class="frame" data-frame-video>
<div class="blob blob--a" data-blob></div>
<div class="blob blob--b" data-blob></div>
<div class="grain" aria-hidden="true"></div>
<p class="show"><svg class="mic" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3"/></svg><span data-show>Quiet Hours</span></p>
<p class="cc" aria-hidden="true">CC</p>
<div class="bar">
<button class="play" type="button" data-play aria-label="Pause" aria-pressed="false">
<span class="play__bg" data-play-bg aria-hidden="true"></span>
<svg class="ico ico--pause" data-ico-pause viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="5.5" width="3.4" height="13" rx="1.2"/><rect x="13.6" y="5.5" width="3.4" height="13" rx="1.2"/></svg>
<svg class="ico ico--play" data-ico-play viewBox="0 0 24 24" aria-hidden="true"><path d="M8.5 5.8v12.4a1 1 0 0 0 1.5.86l10-6.2a1 1 0 0 0 0-1.72l-10-6.2a1 1 0 0 0-1.5.86Z"/></svg>
</button>
<div class="wave" data-wave aria-hidden="true"></div>
<p class="time"><span data-now>12:04</span><span class="time__all"> / <span data-all>48:10</span></span></p>
</div>
<div class="track" aria-hidden="true"><span class="track__fill" data-fill></span><span class="track__head" data-head></span></div>
</div>
<div class="captions" data-captions aria-live="off">
<p class="who" data-who><span class="who__name" data-who-name>Ilse Brandt</span><span class="who__state" data-who-state>Paused</span></p>
<div class="window" data-window>
<div class="lines" data-lines></div>
</div>
</div>
</section>
<svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></svg>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.
25 values to change
With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:
Take “Word-by-word captions” from Animorio and fit it into my siteThe speech is a list of sentences with their speakers; each word gets its moment, worked out by adding a fixed time and a time per letter, plus a pause after commas and a longer one after full stops. A paused GSAP timeline has one call per word at its moment, so pausing the video simply means stopping the timeline.
The words are split into lines in JavaScript: each one is measured in its widest state, with the weight and width of the spoken word, and a line closes when the next word would not fit or when the speaker changes. So when a word grows wider it never pushes the others onto a new line; on resize the lines are rebuilt and every word goes back to its state.
Each word has font-variation-settings with two CSS variables, --g for the weight and --d for the width; GSAP animates them directly together with the colour, with back.out, so the weight goes just past and comes back. A fromTo on y gives the one pixel hop, and the key words also get a brief scale.
The lines sit in a window two lines tall with hidden overflow and a mask fading the bottom; when the spoken word is on a new line the block rises by one line height with back.out, the outgoing line fades and the incoming one goes from half to full.
A single gsap.ticker writes the time from the timeline’s position, stretches the time line with scaleX and raises the bars with a wave of sines multiplied by the voice, which is one at every word and calms down by itself. Pause stops the timeline, takes the timeScale of the video lights to zero and swaps the icons on a spring.
| Name | File | Default | What it changes |
|---|---|---|---|
SHOW | script.js | "Quiet Hours" | The name of the made-up podcast, written at the top of the video. |
PACE | script.js | 0.034 | The seconds per letter of each spoken word. |
BASE | script.js | 0.14 | The seconds every word lasts anyway, even the shortest. |
PEAK | script.js | 680 | The weight of the spoken word, on the wght axis. |
STRETCH | script.js | 112 | The width of the spoken word, on the wdth axis. |
ROLL | script.js | 0.62 | The seconds of the line rolling up when the previous one is done. |
HOLD | script.js | 1.6 | The seconds the last sentence stays before the video starts again. |
For a podcast or an interview on video, for vertical clips to post on social media, for the page of an app that transcribes or translates speech: captions that follow the voice word by word can be read with the sound off.
The same animation with adapted sizes: the video takes the full width, the captions are sized on the width and the height of the screen and the lines are split again, shorter; pause is pressed with a finger.
No hops and no rolling lines: the words only change colour with a fade, without changing weight, the change of line is a fade, the video lights and the wave stay still and the drawn pointer is not there.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.9 KB; the libraries: GSAP 28 KB.
Tested on 26 October 2026
Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.