
The elastic button
Buttons, Hover, Text
Topping up a public transport card: the teal card with its low balance and the rides left, three amounts to pick with a white tile sliding under the chosen one, and the Top up button. After a moment of payment, a ring spinning in the button, the balance on the card counts up to the new figure, the card lifts and a light crosses it, the rides roll and the tag goes from Low to Ready.
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>
<!--
"Transit card top-up" 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>Transit card top-up</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">
<!-- topping up a transit card: pick an amount, tap Top up, and the balance on the card rolls up
while the rides left are worked out again -->
<section class="tc" data-tc data-state="low" aria-label="Transit card">
<div class="tc__card" data-card>
<span class="tc__glare" data-glare aria-hidden="true"></span>
<header class="tc__top">
<b>Orbit</b>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8.500 7.500a7 7 0 0 1 0 9M12 5a11 11 0 0 1 0 14M15.500 2.500a15 15 0 0 1 0 19"></path></svg>
</header>
<p class="tc__balance"><small>Balance</small><span><i>€</i><strong data-outbalance>3.40</strong></span></p>
<footer class="tc__foot"><span class="tc__rides"><span data-outrides>2 rides left</span></span><span class="tc__flag" data-flag>Low</span></footer>
</div>
<div class="tc__amounts" role="radiogroup" aria-label="Amount to add" data-amounts>
<span class="tc__thumb" data-thumb aria-hidden="true"></span>
<button type="button" role="radio" aria-checked="false" data-amount="5">+ €5</button>
<button type="button" role="radio" aria-checked="true" data-amount="10">+ €10</button>
<button type="button" role="radio" aria-checked="false" data-amount="20">+ €20</button>
</div>
<button class="tc__btn" type="button" data-btn>
<svg class="tc__spin" data-spin viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="7.500" pathLength="1"></circle></svg>
<span class="tc__btntext"><span data-outbtn>Top up €10</span></span>
</button>
</section>
<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.
21 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 “Transit card top-up” from Animorio and fit it into my siteThree buttons with role radio in a group: the keyboard arrows move from one to the next. The white tile is a third of the bar wide and moves with xPercent, a hundred per step: nothing needs measuring.
The button takes aria-busy, shows a ring spinning around its centre and ignores taps for LOAD seconds. On a real site the payment call goes here, and the rest starts when it answers.
The balance is a number animated by GSAP and written with two decimals on every frame. The rides are the balance divided by FARE, rounded down; under three rides the tag says Low.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #0fa3a3 | The colour of the card. |
START | script.js | 3.4 | The balance on opening, in euro. |
FARE | script.js | 1.7 | What a ride costs: the rides left are worked out from it. |
LOAD | script.js | 0.9 | How many seconds the payment takes before the balance goes up. |
In the app or site of a transport company, a bike sharing scheme, a car park; and wherever a credit is topped up in fixed steps: the canteen, the laundrette, a gym card, a game’s credit.
The piece is at most 288 pixels wide and about 280 tall; the card gets lower on low screens. The amounts are 42 pixels tall and a third of the bar wide, the button is as wide as the card and 46 tall.
The white tile goes under the chosen amount at once, the ring does not spin and, once the payment is over, balance, rides and tag change in place, with no counting, springs or light. 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 5.6 KB; the libraries: GSAP 28 KB.
Tested on 26 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.