
The elastic button
Buttons, Hover, Text
The playback speed button of an audiobook and podcast app’s player: a white “1×” pill with three orange bars moving like sound. Each tap steps it to 1.25×, 1.5×, 1.75×, 2× and back to 1×: the digits roll vertically, the pill widens or narrows on a spring and the × stays still, while the bars speed up and draw closer. Held down, the pill stretches into a fine slider from 0.5× to 3× with ticks and a two-decimal value following the finger; let go, it becomes a pill again with the chosen value. Minimal style.
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>
<!--
"Playback speed 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>Playback speed button</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">
<!-- the playback speed button of a audiobook player: tap to step 1x, 1.25x, 1.5x, 1.75x, 2x and back;
press and hold to stretch it into a fine slider from 0.5x to 3x, let go and it becomes a pill again -->
<div class="frame" data-frame>
<div class="press" data-press>
<button class="pill" type="button" data-pill aria-label="Playback speed, 1 times" aria-describedby="speed-hint">
<span class="pill__shine" aria-hidden="true"></span>
<span class="bars" data-bars aria-hidden="true"><i></i><i></i><i></i></span>
<span class="num" data-num aria-hidden="true">
<span class="slot slot--int" data-slot="int"><span class="col" data-col></span></span>
<span class="slot slot--dot" data-slot="dot"><span class="dot">.</span></span>
<span class="slot slot--d1" data-slot="d1"><span class="col" data-col></span></span>
<span class="slot slot--d2" data-slot="d2"><span class="col" data-col></span></span>
</span>
<svg class="times" viewBox="0 0 10 10" aria-hidden="true"><path d="M2.2 2.2l5.6 5.6M7.8 2.2l-5.6 5.6"></path></svg>
<span class="track" data-track aria-hidden="true">
<span class="track__rail"><span class="track__fill" data-fill></span></span>
<span class="track__ticks" data-ticks></span>
<span class="track__thumb" data-thumb></span>
</span>
</button>
</div>
</div>
<p class="sr" id="speed-hint">Tap to change speed, hold to choose it precisely, or use the arrow keys.</p>
<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.
18 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Playback speed button” from Animorio and fit it into my siteThe number is made of four fixed slots: the unit, the dot, the tenths and the hundredths. The three digit slots hold a 0 to 9 column moving vertically by 30 pixels a digit; a faded mask above and below lets them come and go softly.
When a decimal is needed or no longer needed, GSAP brings its slot width to one digit (with back.out) or to zero. The pill has automatic width, so it widens and narrows by itself on that spring, and the × stays attached to the number.
On press a 0.38 second delayedCall starts: if the finger lifts first it is a tap and the speed steps to the next one, otherwise the pill fixes its current width and GSAP takes it to the slider’s. With the pointer captured, every move becomes a value between 0.5 and 3 rounded to 0.05.
On release the width the pill will have with the short number is worked out (padding, bars, visible slots, ×) and reached on a spring; at the end the width goes back to automatic.
On the GSAP ticker a phase advances at the shown speed, which chases the chosen one through a soft filter: each bar gets its height from two offset sines, and the space between the bars tightens from 3.6 to 1.1 pixels on the way to 3×.
| Name | File | Default | What it changes |
|---|---|---|---|
STEPS | script.js | 1, 1.25, 1.5, 1.75, 2 | The speeds a tap steps through, in order. |
MIN_SPEED | script.js | 0.5 | The lowest speed on the fine slider. |
MAX_SPEED | script.js | 3 | The highest speed on the fine slider. |
HOLD_TIME | script.js | 0.38 | How long to hold before the pill becomes a slider. |
ROLL_TIME | script.js | 0.55 | How long the digits take to roll. |
SPRING | script.js | 1.6 | How far the pill overshoots and comes back when its width changes. |
WAVE_RATE | script.js | 1.4 | How quickly the bars move at 1×. |
In the player of a podcast or audiobook app, in the video player of an online course, in the voice messages of a chat, in the read-aloud article of a blog.
The pill stays 60 pixels tall and the open slider takes the screen width minus a margin, so it always fits the preview box; press and hold works with a finger and the page does not scroll while dragging.
The digits change at once without rolling, the pill changes width without a spring, the slider fades in, the bars stand still and the self-running preview does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 KB.
Tested on 21 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.
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.