
The elastic button
Buttons, Hover, Text
The Repeat button of a music player, with its three states: off, repeat all, repeat one. On every tap the two arrows run half a turn around their loop and settle, the circle lights up blue, the label rolls and below three marks say where you are, the lit one longer. For a single track a small “1” pops out in the middle of the arrows.
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>
<!--
"Repeat 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>Repeat 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 repeat button of a music player, with its three states: off, repeat all, repeat one.
On every tap the two arrows run half a turn around their loop, the label rolls and, for one track, a 1 pops out -->
<button class="rp" type="button" data-rp data-state="off" aria-label="Repeat: off">
<span class="rp__ico" aria-hidden="true">
<svg data-loop viewBox="0 0 24 24"><path d="M17 2.500 20.500 6 17 9.500M3.500 11V9.500A3.500 3.500 0 0 1 7 6h13.500M7 21.500 3.500 18 7 14.500M20.500 13v1.500A3.500 3.500 0 0 1 17 18H3.500"></path></svg>
<b data-one>1</b>
</span>
<span class="rp__text">
<span class="rp__label"><span data-label>Repeat off</span></span>
<span class="rp__marks"><i data-m></i><i data-m></i><i data-m></i></span>
</span>
</button>
<span class="live" aria-live="polite" data-live></span>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></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.
12 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 “Repeat button” from Animorio and fit it into my siteAn index from 0 to 2 that moves on at every tap and starts over. The state is written in an attribute of the button: CSS takes the colours from it, the script the label, the screen reader label and which mark is long.
The icon looks the same every half turn: on each tap GSAP adds 180 degrees to the svg’s rotation, around its centre, on an elastic spring. It always ends upright.
The “1” comes in from scale zero with a quarter turn, a moment after the arrows. The three marks change width, from 10 to 22 pixels, each on its own tween.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2a6df4 | The colour of the button when repeat is on. |
START | script.js | off | The state on opening: off, all or one. |
TURN | script.js | 0.9 | How long the arrows’ half turn lasts on every tap. |
In the player of a music site, a radio, a podcast or audiobook app, next to Shuffle; and wherever an option has three values to cycle with a single tap: a list’s order, the light, dark or automatic theme.
The same button, 64 pixels tall and about 200 wide: it fits any screen and is tappable all over. In a narrow control bar just the circle can be kept, 48 pixels wide, with the label for screen readers.
The arrows do not turn: on every tap the colours, the label and the long mark change and the “1” appears or goes at once. The demo’s pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 4.2 KB; the libraries: GSAP 28 KB.
Tested on 25 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.