
The elastic button
Buttons, Hover, Text
The Listen to this article button of an invented magazine, an ivory pill on warm paper. Pressed, it becomes a small player: play splits and turns into pause, the voice waveform moves with the syllables of the words, the time runs on from 4:12 of 9:30 and the speed rolls from 1x to 1.25x. Under the pill the sentence being read comes in like a caption, with a marker on the word being said.
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>
<!--
"Listen to article button" 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>The Listen to this article button with captions that follow the voice</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage" data-stage>
<!-- the Listen to this article button of an invented magazine, Halyard Review, on warm paper in soft light.
Pressed, the pill opens into a small player: play turns into pause, a waveform moves with the voice, the time
runs on and the speed rolls from 1x to 1.25x. Under the pill, outside it, the sentence being read appears like
a caption, with a marker on the word the voice is saying -->
<div class="la" data-wrap>
<div class="la__pill" data-pill>
<span class="la__skin" aria-hidden="true">
<span class="la__fill"></span>
<span class="la__light" data-light></span>
<span class="la__track"><span class="la__done" data-done></span></span>
<span class="la__edge"></span>
</span>
<button class="la__disc" type="button" data-disc aria-label="Pause" tabindex="-1">
<span class="la__disc-face">
<svg class="la__icon" viewBox="0 0 24 24" aria-hidden="true">
<polygon data-half="a" points="8.5,6 12.4,8.5 12.4,15.5 8.5,18"/>
<polygon data-half="b" points="12.4,8.5 18,12 18,12 12.4,15.5"/>
</svg>
</span>
</button>
<span class="la__rest" data-rest aria-hidden="true">
<span class="la__title" data-r>Listen to this article</span>
<span class="la__sub" data-r>
<svg class="la__phones" viewBox="0 0 16 16"><path d="M2.6 10.4V8.2a5.4 5.4 0 0 1 10.8 0v2.2"/><rect x="2" y="9.4" width="2.8" height="4.4" rx="1.2"/><rect x="11.2" y="9.4" width="2.8" height="4.4" rx="1.2"/></svg>
<span>9 min 30 · Read by Ines Marlow</span>
</span>
</span>
<button class="la__open" type="button" data-open aria-label="Listen to this article, 9 minutes 30" data-autoclic></button>
<span class="la__ctrl" data-ctrl>
<span class="la__wave" data-wave aria-hidden="true"></span>
<span class="la__time" aria-label="Time">
<span class="la__now" data-now></span>
<span class="la__total" data-total></span>
</span>
<button class="la__speed" type="button" data-speed aria-label="Playback speed 1x">
<span class="la__speed-face">
<span class="la__speed-win" data-speed-win><span class="la__speed-col" data-speed-col></span></span>
</span>
</button>
<button class="la__close" type="button" data-close aria-label="Close the player">
<span class="la__close-face">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7"/></svg>
</span>
</button>
</span>
</div>
<div class="la__cap" data-cap aria-hidden="true">
<div class="la__cap-in" data-cap-in>
<p class="la__kicker" data-kicker>Now reading · Halyard Review</p>
<p class="la__line" data-line><span class="la__mark" data-mark></span></p>
</div>
</div>
<div class="la__script" data-script hidden>
<p>Every harbour keeps two clocks, one for the ships and one for the tide.</p>
<p>The second never hurries, and the town slowly learns to wait for it.</p>
<p>By noon the water had come back, quietly, as if it had never left.</p>
</div>
</div>
<svg class="la__pointer" data-pointer viewBox="0 0 28 28" aria-hidden="true">
<path d="M6.2 3.6l15 10.6c.8.6.5 1.8-.5 1.9l-6 .7 3.4 6.4c.3.6.1 1.3-.5 1.6l-1.7.9c-.6.3-1.3.1-1.6-.5l-3.4-6.5-4.3 4.2c-.7.7-1.9.2-1.9-.8V4.4c0-.9 1-1.4 1.6-.8z"/>
</svg>
<p class="sr" aria-live="polite" data-live></p>
</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 “Listen to article button” from Animorio and fit it into my siteThe sentences live in the HTML. Every word becomes a length (0.16 seconds plus 0.072 per letter), a number of syllables (the vowel groups) and a breath after it: 0.3 at commas, 0.62 at full stops. Then everything is multiplied by one number, so the voice reads WORDS_PER_SEC words a second on average. The level at any instant is half a sine for each syllable, the first one louder, short words softer.
Thirty times a second the level, with a quick attack and a slow release, enters a row of values on the right and the oldest one leaves on the left; every bar writes its height in pixels (not scaleY, which would squash the round ends). On a phone the bars that do not fit hide from the left, under the mask’s fade.
One number, settle, goes from 1 to 0: every bar has its own threshold, g = settle × 1.6 − 0.6 × (1 − position), so the oldest bars drop first and the newest last, down to a third of their height; on play it happens the other way round.
Every word is a span; the peach rectangle behind the text takes offsetLeft, offsetTop and the size of the word being said and slides onto it with power3.out in a time that shortens with the speed (from 0.26 to 0.1 seconds). At the end of a sentence the words lift with an 8 millisecond stagger and the next sentence rises from below; the caption opens by animating its measured height, so the pill moves up by itself.
Play is drawn as two four-point shapes that together make the triangle; GSAP moves the points to the two bars of pause. The time has one window per digit and the speed a column of values (with the first one repeated at the end, so after 2x it goes back to 1x always rolling up).
| Name | File | Default | What it changes |
|---|---|---|---|
START | script.js | 4:12 | Where the reading is when the player first opens. |
LENGTH | script.js | 9:30 | How long the whole article lasts. |
SPEEDS | script.js | [1, 1.25, 1.5, 2] | The speeds of the roller, one per tap. |
WORDS_PER_SEC | script.js | 2.6 | How many words a second the voice reads at 1x. |
BARS | script.js | 26 | The most bars the waveform has (on a phone the ones that do not fit hide). |
LIVELY | script.js | 1 | How strongly the bars follow the voice: 0.3 calm, 1.6 loud. |
SQUEEZE | script.js | 0.95 | How much the pill squeezes when pressed (1 = not at all). |
SPRING | script.js | 1 | How springy the moves are: 0.4 calm, 2 very bouncy. |
AUTO | script.js | true | The drawn pointer goes round by itself until someone touches it. |
At the top or the bottom of the articles of a blog, a magazine or a newspaper you can listen to, in newsletters read aloud, in reading apps, on sites with text to speech and wherever captions help people who listen and read at the same time.
The same animations: the pill and the caption take almost the whole width, the waveform keeps only the bars that fit and the caption is sized on the screen height too; a finger presses like the mouse and the player’s buttons are easy to tap.
No squeezes, stretches, scrolling waves or pointer: the pill changes face with a fade, the bars stay still at their height, the marker jumps from word to word, the sentences change with a fade and the time still runs.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.
Tested on 4 November 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.