
The elastic button
Buttons, Hover, Text
The radio buttons of the shipping choice in a made-up shop’s checkout, on black: Standard, Express, Pick up in store and Same day, which cannot be chosen. The filled dot does not jump from circle to circle: it slides between the rows like a drop that stretches and closes up, the circle it reaches tightens and takes it in, the chosen card’s edge lights up and the total rolls digit by digit.
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>
<!--
"Shipping radio buttons" 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>Shipping radio buttons with the dot that slides between the options</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 shipping step of a made-up shop's checkout: native radio buttons, one dot that flows from circle to circle
like a drop that stretches and closes up, the chosen card lights its edge and the total rolls -->
<form class="ship" data-wrap onsubmit="return false">
<fieldset class="ship__set">
<legend class="ship__head">
<span class="ship__title">Shipping method</span>
<span class="ship__shop">Tallis Supply</span>
</legend>
<div class="list" data-list>
<label class="opt" data-opt>
<input type="radio" name="ship" value="standard" data-price="0" checked>
<span class="opt__ring" data-ring aria-hidden="true"></span>
<span class="opt__text"><b class="opt__name">Standard</b><span class="opt__meta">3–5 days</span></span>
<svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.5 8 12 4l7.5 4v8L12 20l-7.5-4Z"></path><path d="M4.5 8 12 12l7.5-4M12 12v8M8.2 6 15.8 10"></path></svg>
<span class="opt__price">Free</span>
<span class="opt__edge" aria-hidden="true"></span>
</label>
<label class="opt" data-opt>
<input type="radio" name="ship" value="express" data-price="9">
<span class="opt__ring" data-ring aria-hidden="true"></span>
<span class="opt__text"><b class="opt__name">Express</b><span class="opt__meta">Tomorrow</span></span>
<svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7.5h10.5v8.5H3ZM13.5 10.5h4l3 3v2.5h-7"></path><circle cx="7" cy="17" r="1.7"></circle><circle cx="17" cy="17" r="1.7"></circle></svg>
<span class="opt__price">$9</span>
<span class="opt__edge" aria-hidden="true"></span>
</label>
<label class="opt" data-opt>
<input type="radio" name="ship" value="pickup" data-price="0">
<span class="opt__ring" data-ring aria-hidden="true"></span>
<span class="opt__text"><b class="opt__name">Pick up in store</b><span class="opt__meta">Today</span></span>
<svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9.5 5.5 5h13L20 9.5M4 9.5v10h16v-10M4 9.5c0 1.4 1.1 2.3 2.7 2.3S9.3 10.9 9.3 9.5c0 1.4 1.1 2.3 2.7 2.3s2.7-.9 2.7-2.3c0 1.4 1 2.3 2.6 2.3S20 10.9 20 9.5"></path><path d="M10 19.5v-4.5h4v4.5"></path></svg>
<span class="opt__price">Free</span>
<span class="opt__edge" aria-hidden="true"></span>
</label>
<label class="opt is-off" data-opt>
<input type="radio" name="ship" value="sameday" data-price="15" disabled>
<span class="opt__ring" data-ring aria-hidden="true"></span>
<span class="opt__text"><b class="opt__name"><s>Same day</s></b><span class="opt__meta">Unavailable</span></span>
<svg class="opt__ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"></circle><path d="M12 7.5V12l3 2"></path></svg>
<span class="opt__price"><s>$15</s></span>
</label>
<svg class="drop" data-drop aria-hidden="true">
<defs>
<radialGradient id="dropShine" cx="38%" cy="30%" r="75%">
<stop offset="0" stop-color="#ffffff" stop-opacity="0.55"></stop>
<stop offset="0.45" stop-color="#ffffff" stop-opacity="0"></stop>
</radialGradient>
</defs>
<path class="drop__body" data-dropbody></path>
<path class="drop__shine" data-dropshine fill="url(#dropShine)"></path>
</svg>
</div>
</fieldset>
<div class="sum">
<div class="sum__row">
<span>Subtotal</span><span class="sum__val">$84.00</span>
</div>
<div class="sum__row">
<span>Shipping</span><span class="sum__val sum__flip"><span class="sum__flipin" data-shipline>Free</span></span>
</div>
<div class="sum__row sum__total">
<span>Total</span><span class="odo" data-odo aria-hidden="true"></span>
<span class="sr" data-live aria-live="polite"></span>
</div>
</div>
</form>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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.
38 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 “Shipping radio buttons” from Animorio and fit it into my siteEach card is a label holding a native radio input, transparent and as big as the card: click, touch, keyboard arrows and screen readers work by themselves, and the change event says which option is chosen. The Same day option is disabled, so the arrows skip it. The keyboard focus adds a class to the card, which draws the ring with outline.
The dot does not live inside the circles: it is an SVG path over the list. The circles’ positions are measured with offsetTop and offsetLeft, which ignore the cards’ squeeze, and measured again by a ResizeObserver, even mid-travel.
The dot’s state is an object with a head, a tail and their radii. GSAP moves the head towards the new circle with power3.inOut and the tail later (STRETCH), and on every frame the path is redrawn: two arcs for the ends and four Bézier curves with vertical tangents that narrow into a neck, thinner the longer the drop. When head and tail meet, it is a circle again.
Before leaving the head draws back a pixel, it arrives a pixel past the centre and comes back with elastic.out; the circle it leaves loosens in scale and the one it reaches tightens to 0.82 and bounces back, right as the head gets there.
Each digit of the total is a column from zero to nine inside a window one line tall: only yPercent changes, with back.out and a stagger from the right. The Shipping line leaves upwards and comes back from below with the new price.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #9db4ff | The colour of the dot, the lit edge and the focus. |
DOT | script.js | 5 | The radius of the filled dot, in pixels. |
TRAVEL | script.js | 0.62 | How many seconds the dot takes to go from one row to the next. |
STRETCH | script.js | 0.26 | How long the tail waits before leaving: higher means a longer drop. |
ROLL | script.js | 0.7 | How many seconds the total’s digits roll for. |
SUBTOTAL | script.js | 84 | The order subtotal, before shipping. |
CURRENCY | script.js | $ | The currency symbol. |
In the shipping step of a checkout, in the pickup or delivery choice of a restaurant, in a subscription’s options, in any form where you pick one thing out of a few and want the choice to be felt.
The panel narrows to the screen width minus thirty-two pixels, under 380 pixels the icons go to leave room for the names, and the cards get shorter with the screen height. A finger chooses like the mouse; without hover the dot does not lean.
The dot does not slide: it fades out on the old circle and in on the new one. No springs, bounces or squeezes; the edge lights up with a fade and the total changes with a fade, without rolling.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.8 KB; the libraries: GSAP 28 KB.
Tested on 13 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.