
The elastic button
Buttons, Hover, Text
The converter of an app for sending money abroad, on near-white grey: two fields, You send and They receive, with the amount set large and the currency in a pill. On every change the digits roll in their columns to the new value and any extra ones come in widening; the round button in the middle turns half a turn and swaps the two rows, the pill opens the currency menu and underneath the rate updates, with a thin arc counting down the thirty seconds the rate stays locked.
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>
<!--
"Currency converter" 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 currency converter with rolling digits</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>
<!-- a money transfer card: two fields, a round swap button between them, digits that roll to every new value,
the live rate underneath and an arc that counts down how long the rate stays locked -->
<section class="card" aria-label="Tidewire currency converter">
<header class="card__head">
<span class="card__title">Send money</span>
<span class="card__brand">Tidewire</span>
</header>
<div class="rows" data-rows>
<div class="row" data-row="send">
<span class="row__label">You send</span>
<div class="row__slot" data-slot>
<div class="amt" data-amt="a">
<label class="sr-only" for="amt-a">Amount</label>
<input class="amt__input" id="amt-a" data-input type="text" inputmode="decimal" autocomplete="off" spellcheck="false">
<div class="amt__num" data-num aria-hidden="true"></div>
<span class="amt__caret" data-caret aria-hidden="true"></span>
<button class="pill" type="button" data-pill aria-haspopup="listbox" aria-expanded="false">
<span class="pill__sym" data-sym></span>
<span class="pill__code" data-code></span>
<svg class="pill__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"></path></svg>
</button>
</div>
</div>
</div>
<button class="swap" type="button" data-swap aria-label="Swap currencies">
<svg class="swap__icon" data-swap-icon viewBox="0 0 20 20" aria-hidden="true">
<path d="M7 3.5v12M3.8 6.7 7 3.5l3.2 3.2"></path>
<path d="M13 16.5v-12M9.8 13.3l3.2 3.2 3.2-3.2"></path>
</svg>
</button>
<div class="row" data-row="receive">
<span class="row__label">They receive</span>
<div class="row__slot" data-slot>
<div class="amt" data-amt="b">
<label class="sr-only" for="amt-b">Converted amount</label>
<input class="amt__input" id="amt-b" data-input type="text" inputmode="decimal" autocomplete="off" spellcheck="false">
<div class="amt__num" data-num aria-hidden="true"></div>
<span class="amt__caret" data-caret aria-hidden="true"></span>
<button class="pill" type="button" data-pill aria-haspopup="listbox" aria-expanded="false">
<span class="pill__sym" data-sym></span>
<span class="pill__code" data-code></span>
<svg class="pill__chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.5 8 10l3.5-3.5"></path></svg>
</button>
</div>
</div>
</div>
</div>
<div class="meta">
<p class="rate" aria-live="polite"><span>1</span> <span data-rate-from></span> <span class="rate__eq">=</span> <span class="rate__num" data-rate-num></span> <span data-rate-to></span></p>
<p class="lock">
<svg class="lock__arc" viewBox="0 0 16 16" aria-hidden="true">
<circle class="lock__track" cx="8" cy="8" r="6"></circle>
<circle class="lock__ring" data-lock-ring cx="8" cy="8" r="6"></circle>
</svg>
<span class="lock__text" data-lock-text>Rate locked for <span class="lock__num" data-lock-num></span>s</span>
</p>
</div>
<button class="cta" type="button" data-cta>Review transfer</button>
</section>
<div class="menu" data-menu role="listbox" aria-label="Currency" hidden>
<span class="menu__hi" data-hi aria-hidden="true"></span>
</div>
<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="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/Flip.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 “Currency converter” from Animorio and fit it into my siteEach digit is a window one line tall holding the column of numbers from 0 to 9: to show a 7 the column rises by 70% of its height (yPercent -70). Digits are aligned from the right, so when the number changes each place knows which digit it had before and only rolls as far as it needs to; commas and the point are fixed places. A gradient mask fades the column at the top and the bottom.
If the number gets longer, the new places come in on the left with their width growing from zero while their column rolls from 0; if it gets shorter, the extra ones shrink to zero and disappear. The curve is back.out(1.15): the digit passes its place by a hair and comes back, and the digits start 25 milliseconds apart from the left.
The two blocks, amount and pill, are the same elements changing rows: Flip.getState records them, appendChild moves them, Flip.from slides them from the old position to the new one. The one arriving at the top becomes the amount to send and the bottom one works itself out again, rolling. The arrows turn a further 180 degrees with every swap.
The menu opens below the pill, or above when there is no room, on a spring with the items arriving staggered; a grey light slides under the item being pointed at and the other field’s currency is greyed out. The arc is a circle with stroke-dasharray: a thirty second linear tween wears it down and rolls the seconds; picking a currency refills it, and when it reaches zero the rate moves very slightly and starts again.
Over the number sits a transparent input with inputmode decimal: you really type, the value is cleaned up (a single point, the right decimals for the currency, none for the yen) and the number follows it, rolling. At the first touch or key press the fake pointer stops.
| Name | File | Default | What it changes |
|---|---|---|---|
START_AMOUNT | script.js | 1000 | The amount the You send field starts from. |
AMOUNTS | script.js | 2450, 1200, 860 | The amounts the autopilot types, one per round. |
ACCENT | script.js | #3b5bfd | The accent colour: caret, arc, symbols and the active field’s border. |
ROLL | script.js | 0.7 | How long a digit takes to roll, in seconds. |
STAGGER | script.js | 0.025 | The delay between one digit and the next, from the left. |
BOUNCE | script.js | 1.15 | How far the digit passes its place before settling (1 = none). |
SWAP_TIME | script.js | 0.6 | How long the two rows take to swap, in seconds. |
LOCK_SECONDS | script.js | 30 | How many seconds the rate stays locked. |
For a payments or international transfer app, the checkout of a shop selling abroad, a calculator on a pricing page, a finance dashboard: anywhere a number changes and you want to show what changed.
The card narrows to the screen width with less padding, the fields get shorter and the amount drops to 26 pixels; the menu opens above the pill when there is no room below. Tapping the field opens the numeric keyboard.
The digits change without rolling, with a short fade; the swap happens in place with a fade, the arrows and the menu do not bounce and the fake pointer is not shown.
GSAP 3.15.0, Flip (plugin di GSAP) 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.7 KB; the libraries: GSAP + Flip 37 KB.
Tested on 25 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.