
The elastic button
Buttons, Hover, Text
The card for splitting a dinner bill in a payments app between friends, on the palest grey: the total, a bar of coloured segments and four people with their share on rolling digits. Leave someone out with their checkbox or switch to Custom and drag one person’s share: all the others recalculate, the segments settle on a spring and the Request button shows what you’re owed, then turns green with «Sent to 2 friends».
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>
<!--
"Split the bill card" 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 split the bill card with shares that recalculate</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" data-stage>
<!-- split the bill in a payments app: the dinner total, four people with their shares on rolling wheels and a bar of
coloured segments; leave someone out or switch to Custom and drag one share, every amount recalculates and the
bar settles on a spring; Request sends the rest to your friends -->
<section class="card" data-card aria-label="Split the bill">
<header class="head">
<span class="head__logo" aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M12 4v16"></path><path d="M6.5 8.5a5.5 5.5 0 0 1 11 0"></path><path d="M17.5 15.5a5.5 5.5 0 0 1-11 0"></path></svg>
</span>
<span class="head__txt">
<span class="head__app" data-app>Halvy</span>
<span class="head__title">Split the bill</span>
</span>
<span class="head__place" data-place>Dinner at Brasa</span>
</header>
<div class="total">
<span class="total__label">Total</span>
<span class="total__amt money" data-total></span>
</div>
<div class="bar" data-bar aria-hidden="true"></div>
<div class="modes" role="tablist" aria-label="How to split">
<span class="modes__pill" data-modes-pill aria-hidden="true"></span>
<button class="modes__btn is-on" type="button" role="tab" aria-selected="true" data-mode="equal">Equally</button>
<button class="modes__btn" type="button" role="tab" aria-selected="false" data-mode="custom">Custom</button>
</div>
<ul class="people" data-people></ul>
<button class="request" type="button" data-request>
<span class="request__face" data-req-face>
<span class="request__label">Request</span>
<span class="request__amt money" data-req-amt></span>
</span>
<span class="request__busy" data-req-busy aria-hidden="true">
<svg class="request__spin" viewBox="0 0 24 24" data-req-spin><circle cx="12" cy="12" r="8"></circle><path d="M12 4a8 8 0 0 1 8 8"></path></svg>
</span>
<span class="request__done" data-req-done aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M6 12.5l4 4 8-9" data-req-tick></path></svg>
<span data-req-done-txt>Sent to 3 friends</span>
</span>
</button>
<p class="sr" aria-live="polite" data-status></p>
</section>
<svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer><path d="M5 3l14 8.2-6.2 1.4 3.6 6.8-2.6 1.4-3.6-6.8L5 18.6z"></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.
27 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 “Split the bill card” from Animorio and fit it into my siteThe bill is split in whole cents: with a custom share that comes off first, the rest is split equally among the others and the leftover cents go one by one to the first people in the list, so the sum always comes back to the total.
Each amount is made of windows always the same width, one per digit, each holding a column of ten numbers: to change a share every column moves by the yPercent of its new digit, from right to left, with a small overshoot.
The segments are absolute inside the bar and their position and width are worked out in pixels from the shares, with two pixels between them; GSAP takes them there on a back.out spring, shorter and without bounce while dragging.
The dragged slider fixes that person’s percentage; the others aren’t touched but are worked out again from their new share and glide into place by themselves, so you can see what a bigger share takes away.
| Name | File | Default | What it changes |
|---|---|---|---|
APP | script.js | Halvy | The name of the invented payments app, at the top of the card. |
PLACE | script.js | Dinner at Brasa | The label of the expense being split. |
TOTAL | script.js | 186.4 | The total of the bill, in dollars. |
ACCENT | script.js | #4f46e5 | The colour of your share, the logo and the first person. |
ROLL | script.js | 0.75 | The seconds the digits take to roll when the shares change. |
SPRING | script.js | 1.4 | How much the bar’s segments bounce as they settle. |
CUSTOM | script.js | 45 | The percentage the autopilot gives Kai in the custom split. |
PAUSE | script.js | 1.2 | The seconds the autopilot waits between one gesture and the next. |
For a payments app between friends, an online bank, an app for group or travel expenses, a restaurant bill paid at the table: anywhere an amount is split between several people and it pays to show right away who owes what.
The card takes the full width minus the margins and its spacing tightens with vmin; the sliders are dragged with a finger (touch-action none on the track) and the checkboxes are big enough to tap.
No rolling digits, springs or pointer: the bill is already split four ways, with the bar, the shares and the request in place; checkboxes, switch and sliders work and change the numbers without animation.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.1 KB; the libraries: GSAP 28 KB.
Tested on 28 October 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.