
The elastic button
Buttons, Hover, Text
The protection line in the cart of an invented premium audio store, Halden Audio: a graphite glass button 60 pixels tall with a real photo of the headphones in its round end and a small empty shield on the corner. Tapped, the title shimmers while a mint ring winds round the photo and closes; then the shield fills and seals with a check, a sheen crosses the glass, the price leaves the chip and falls into the total, the total rolls up on drums and the Covered to Nov 2028 tag comes out from under the button. On the sealed button the chip turns into Remove: tapped, the ring unwinds, the shield empties, the tag tucks back and the total rolls down.
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>
<!--
"Add protection 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 Add protection button with the seal that closes the shield</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 protection plan line of a premium audio store cart (Halden Audio): one graphite glass button with the
photo of the headphones in its round end. Tapped, a ring closes around the photo, the shield on its corner
fills and seals with a check, the price drops into the total, the total rolls up on drums and the coverage
tag comes out from under the button. Tapped again (Remove), everything goes back. -->
<div class="cover" data-cover>
<button class="add" type="button" data-add aria-pressed="false">
<span class="add__glow" aria-hidden="true"></span>
<span class="add__shine" data-shine aria-hidden="true"></span>
<span class="thumb" data-thumb>
<svg class="thumb__ring" viewBox="0 0 56 56" aria-hidden="true">
<circle class="thumb__track" cx="28" cy="28" r="26"/>
<circle class="thumb__arc" data-ring cx="28" cy="28" r="26" pathLength="1"/>
</svg>
<span class="thumb__photo" data-photo>
<img src="cuffie.webp" alt="Black over-ear headphones" width="240" height="240" decoding="async">
</span>
<span class="badge" data-badge aria-hidden="true">
<svg class="badge__svg" viewBox="0 0 22 24">
<path class="badge__base" d="M11 1.6l7.6 3v5.9c0 5.1-3.2 9.3-7.6 11.3-4.4-2-7.6-6.2-7.6-11.3V4.6z"/>
<path class="badge__fill" data-fill d="M11 1.6l7.6 3v5.9c0 5.1-3.2 9.3-7.6 11.3-4.4-2-7.6-6.2-7.6-11.3V4.6z"/>
<path class="badge__edge" data-edge pathLength="1" d="M11 1.6l7.6 3v5.9c0 5.1-3.2 9.3-7.6 11.3-4.4-2-7.6-6.2-7.6-11.3V4.6z"/>
<path class="badge__plus" data-plus d="M11 8.2v6.4M7.8 11.4h6.4"/>
<path class="badge__check" data-check pathLength="1" d="M7.4 11.8l2.6 2.6 4.6-5.2"/>
</svg>
</span>
</span>
<span class="add__text">
<span class="add__title"><span class="add__words" data-title>Add 2-year protection</span></span>
<span class="add__sub"><span class="add__words" data-sub>Halden Care · drops and spills</span></span>
</span>
<span class="chip" data-chip>
<span class="chip__face"><span class="chip__words" data-chip-words>+$29</span></span>
</span>
</button>
<div class="sum" data-sum>
<span class="sum__left">
<span class="sum__label">Total</span>
<span class="tag-slot">
<span class="tag" data-tag aria-hidden="true">
<svg class="tag__icon" viewBox="0 0 22 24"><path d="M11 1.6l7.6 3v5.9c0 5.1-3.2 9.3-7.6 11.3-4.4-2-7.6-6.2-7.6-11.3V4.6z"/><path class="tag__tick" d="M7.4 11.8l2.6 2.6 4.6-5.2"/></svg>
<span data-tag-words>Covered to Nov 2028</span>
</span>
</span>
</span>
<span class="odo" data-odo></span>
</div>
<span class="ghost" data-ghost aria-hidden="true">+$29</span>
</div>
<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.
23 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 “Add protection button” from Animorio and fit it into my siteThe button uses no backdrop-filter: it is a graphite top to bottom gradient, a 1 px edge and an inner line of light made with inset box-shadows, a faded light line in an ::after and feTurbulence grain in an SVG background, in overlay at 14%. Two CSS variables, --lit and --halo, light a mint glow on the left and the halo underneath while the cover is on, animated by GSAP.
The ring is a circle with pathLength 1: on each update of a single tween (p from 0 to 1) the script writes the stroke-dasharray, with an arc that grows as p to the power of 2.1, and a transform attribute that spins it by 450 degrees. So it starts as a short running arc that slows down as it closes; to remove the cover the same tween goes back to 0 and the ring unwinds backwards.
The shield is the same path three times: the dark base, the mint fill fading in and the light edge with pathLength 1 drawn by animating the stroke-dashoffset attribute (not the CSS property, which would cover it). The plus turns and leaves, the check draws itself the same way, and the shield arrives from a scale of 1.32 on a spring.
Price and total are written with two decimals and aligned to the right; each digit is a drum with two rounds of eleven places (blank and ten digits). Adding, the drum goes to the second round, removing it goes back to the first: so it rolls up and down in two different directions, and digits that stay the same do not move. A blank drum is zero wide, and widens if the total gains a digit.
The press, the shield, the tag and the drums use a hand written ease function: the response of a damped spring (BOUNCE) normalised between 0 and 1, which passes the mark by a pixel and settles. The tweens inside the timelines have immediateRender: false, otherwise the words meant to come in later would vanish at once.
| Name | File | Default | What it changes |
|---|---|---|---|
PRICE | script.js | 349 | The price of the headphones already in the cart, in dollars: the starting total. |
COVER | script.js | 29 | The price of the protection, shown on the chip and added to the total. |
YEARS | script.js | 2 | The years of cover: they change the title and the date on the tag. |
WORK | script.js | 1.1 | The seconds the ring takes to wind round the photo before the seal. |
BOUNCE | script.js | 0.72 | The springs: lower bounces more (0.5), higher settles without passing the mark (1). |
HOLD | script.js | 2.8 | The seconds the pilot waits on the sealed button before tapping Remove. |
LOOP | script.js | true | The pilot adds and removes the cover again and again. |
In the cart or at the checkout of an online store for electronics, audio, phones, bikes or furniture that sells an extended warranty or a protection plan; it fits any optional add-on that changes the total (shipping insurance, assembly, a premium service) and add-on plans in subscription apps.
The same animation with adapted sizes: the button is 92% of the screen wide (at most 372 pixels) and stays 60 tall, the words shrink with clamp, the chip gets shorter under 360 pixels; a second tap removes the cover, so Remove works by touch too.
Nothing moves: the button fades in, the ring closes at once, the shield fills with a fade and no jump, the words change in place, the price does not fly, the total changes without drums and the tag fades in; the shimmering title stays still and grey.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.0 KB; the libraries: GSAP 28 KB.
Tested on 6 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.