
The inchworm menu
Menus, Hover, Transitions
The Apply store credit button in the cart of a homeware shop, a graphite pill with grain, an edge that catches the light and a €24.00 balance sunk into a notch, like a Dribbble shot. Under it sits the order total, €86.00. Pressed, a mint ring runs round the credit tag while it checks the balance; then the balance lifts out of the pill as a mint token, drops in an arc onto the total and becomes its discount, the total rolls down on its wheels to €62.00, the balance left rolls to €0.00 and emerald spreads over the pill from where the credit was. Another tap takes the credit back: the token flies up into the pill and the total rolls up again.
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>
<!--
"Store credit 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 Apply store credit button with the balance that drops into the total</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">
<!-- one gesture: spend the credit. Pressed, a ring draws round the credit tag while it checks; then the balance
lifts out of the pill as a small mint token, falls in an arc onto the order total and becomes its discount,
the total rolls down on its wheels and the emerald spreads over the pill from where the balance was.
Another press takes the credit back: the token flies up into the pill and the total rolls up again -->
<div class="frame" data-wrap>
<button class="s" type="button" data-btn data-autoclic aria-pressed="false" aria-describedby="s-note">
<span class="s__shell" data-shell aria-hidden="true">
<span class="s__skin"></span>
<span class="s__fill" data-fill></span>
<span class="s__glow" data-glow></span>
<span class="s__sheen" data-sheen></span>
<span class="s__grain"></span>
</span>
<span class="s__icon" aria-hidden="true">
<svg class="s__ring" viewBox="0 0 36 36"><circle class="ring__track" cx="18" cy="18" r="16.5"></circle><circle class="ring__run" data-ring cx="18" cy="18" r="16.5"></circle></svg>
<span class="s__tag" data-tag>
<svg viewBox="0 0 24 24"><path class="tag__body" d="M4.5 8.2c0-1.1.9-2 2-2h7.6c.5 0 1 .2 1.4.6l4.2 4.2c.8.8.8 2 0 2.8l-4.2 4.2c-.4.4-.9.6-1.4.6H6.5c-1.1 0-2-.9-2-2Z"></path><circle class="tag__hole" cx="15.4" cy="12" r="1.25"></circle><path class="tag__line" d="M7.6 10.2h4.2M7.6 13.8h2.6"></path></svg>
</span>
<span class="s__check" data-check>
<svg viewBox="0 0 24 24"><path data-tick d="M6.6 12.4l3.6 3.5 7.2-7.6"></path></svg>
</span>
</span>
<span class="s__labels" data-labels>
<span class="s__label" data-l="idle">Apply store credit</span>
<span class="s__label" data-l="wait">Checking balance</span>
<span class="s__label" data-l="done">Credit applied</span>
</span>
<span class="s__chip" data-chip aria-hidden="true">
<span class="chip__skin" data-chipskin></span>
<span class="odo" data-odo="balance"></span>
<span class="chip__left" data-left> left</span>
</span>
</button>
<p class="note" id="s-note" data-note aria-live="polite">
<span class="note__k">Order total</span>
<span class="note__total odo" data-odo="total"></span>
<span class="note__badge" data-badge>
<span class="badge__skin"></span>
<span class="badge__txt">−€<span data-credit-txt>24.00</span></span>
</span>
</p>
<span class="token" data-token aria-hidden="true">
<span class="token__skin"></span>
<span class="token__txt">−€<span data-token-txt>24.00</span></span>
</span>
<span class="sr" data-sr></span>
</div>
</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.
22 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 “Store credit button” from Animorio and fit it into my siteEvery digit is a column holding the ten digits and a blank, eleven rows tall, which GSAP moves with yPercent one eleventh at a time: the columns turn from the right, cents first, with a back.out that passes the digit by a hair and returns. The blank hides a leading zero while the column narrows to nothing, so €24.00 becomes €0.00 with no gap.
The token lives outside the button, in the component’s frame. When it flies the script measures the middle of the notch and the discount’s final place beside the total (opening the badge to its true size for a moment), then a 0 to 1 tween carries it along a quadratic Bézier curve with its control point above both ends; the lean follows the sine of the path, so it leaves tilted and lands straight.
The emerald layer has a circle clip-path in pixels centred on the notch: the radius runs from zero to the distance of the farthest corner, worked out again on every resize. Both states use the same circle form, so GSAP blends them without jumps.
Like the site’s pill: on hover the shell holding the layers grows six pixels each side with an elastic.out and the label goes from wdth 100 to 114, both widths measured first, so nothing around it jumps. Each label’s width is measured again after document.fonts.ready.
| Name | File | Default | What it changes |
|---|---|---|---|
CREDIT | script.js | 24 | The store credit to use, in euros: the balance in the pill and the discount on the total. |
TOTAL | script.js | 86 | The order total before the credit, in euros. |
WAIT | script.js | 1.0 | The seconds the ring runs round the tag. |
FLIGHT | script.js | 0.8 | The seconds the token flies to the total. |
ARC | script.js | 34 | How high the token’s arc rises before it drops, in pixels. |
BOUNCE | script.js | 1.5 | How much the pill, the digits and the token bounce. |
MIN_HOLD | script.js | 2.4 | The least seconds the autopilot leaves the applied credit in view. |
--smeraldo | style.css | #16402f | The emerald that fills the pill once the credit is applied. |
--menta | style.css | #b8ebcd | The mint of the ring, the tick and the token. |
In the cart or checkout of an online shop, to spend the credit left from a return or a refund: the shopper sees the money move from the balance to the total and knows at once what they pay.
The pill drops to 56 pixels, the label by a point and the notch to 38; the finger taps like the mouse. Without hover the pill does not swell and the light stays off; the rest is the same.
No flight and no rolling: the ring appears already closed, the labels and digits change with a fade, the emerald and the discount beside the total fade in where they belong; on the way back they fade out.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.7 KB; the libraries: GSAP 28 KB.
Tested on 16 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.