
The elastic button
Buttons, Hover, Text
The amount step of a bank transfer in an invented banking app, Orrin, on white: every figure you type comes in on a little reel and its column opens from zero, the thousands comma slides into its gap and moves along as the number grows, and underneath the available balance shrinks along a bar, with the part this transfer takes hatched in green. Past the balance the field shakes, turns amber and says «Above your balance»; Review transfer only lights up for an amount you can send.
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>
<!--
"Transfer amount field" 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 transfer amount field with rolling digits and a shrinking balance</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>
<!-- the amount step of a bank transfer in Orrin, an invented banking app: typed figures roll in on reels, the
thousands separator slides into place, the available balance shrinks along a bar, and above the balance the
field shakes and turns amber -->
<section class="send" data-card aria-labelledby="send-title">
<header class="send__head">
<span class="who" aria-hidden="true">
<span class="who__face">MH</span>
<svg class="who__bank" viewBox="0 0 16 16"><path d="M3 6.4 8 3.6l5 2.8M4.4 6.8v4.6M7.1 6.8v4.6M8.9 6.8v4.6M11.6 6.8v4.6M3 12.6h10"/></svg>
</span>
<span class="send__meta">
<span class="send__to" id="send-title">To Maren Holt</span>
<span class="send__acc">Orrin Current · ending 4471</span>
</span>
<button class="send__change" type="button" tabindex="-1">Change</button>
</header>
<div class="field" data-field>
<span class="field__glow" aria-hidden="true"></span>
<span class="field__top">
<label class="field__label" for="amount">You send</label>
<span class="field__cur" aria-hidden="true">EUR</span>
</span>
<span class="amount" data-amount aria-hidden="true">
<span class="amount__sym">€</span><span class="amount__num" data-num><span class="amount__zero" data-zero>0</span></span><span class="caret" data-caret></span><span class="amount__cents" data-cents>.00</span>
</span>
<input class="field__input" id="amount" type="text" inputmode="numeric" autocomplete="off" maxlength="8" aria-describedby="amount-status" data-input>
<span class="field__note">
<span class="note note--ok" data-note-ok>
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 2.5 4.4 9h3.4l-.6 4.5L11.6 7H8.2z"/></svg>
Arrives in seconds · no fee
</span>
<span class="note note--over" data-note-over aria-hidden="true">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 2.6 14 13H2z"/><path d="M8 6.6v3M8 11.3v.01"/></svg>
Above your balance
</span>
</span>
</div>
<div class="bal" data-bal>
<div class="bal__row">
<span class="bal__k">Available <b data-avail>€4,280.50</b></span>
<span class="bal__v" data-left-wrap><span data-left-k>Left after</span> <b data-left>€4,280.50</b></span>
</div>
<div class="bar" aria-hidden="true">
<span class="bar__spend" data-spend></span>
<span class="bar__left" data-leftbar><span class="bar__shine"></span></span>
</div>
</div>
<p class="sr" id="amount-status" aria-live="polite" data-status></p>
<button class="go" type="button" disabled data-go>
<span class="go__fill" data-go-fill></span>
<span class="go__label" data-go-a>Review transfer</span>
<span class="go__label go__label--b" data-go-b>
<svg viewBox="0 0 24 24"><path d="M6 12.4l3.6 3.6L18 7.6" data-go-tick/></svg>
Ready to send
</span>
</button>
</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"/></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.
37 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 “Transfer amount field” from Animorio and fit it into my siteA transparent input with inputmode numeric lies over the field and holds the value: on every input only digits are kept, leading zeros dropped, and the result compared with the previous value. Only the difference is redrawn: extra digits are added, removed ones leave, so typing, deleting and pasting work as in a normal field.
Each digit is a window 0.6 em wide and one line tall over a reel holding 0-9 twice. A new digit starts ROLL places earlier and rises with yPercent to its number with back.out, with a blur filter that clears as it spins; the column opens from zero width to its real size and then hands the width back to CSS (clearProps), so it survives a resize.
Each digit carries a closed gap for a comma. On every change we count from the right: the digit with three or six digits after it opens its gap (width from zero with back.out and the comma dropping in), the one that no longer needs it closes it. Between 9,999 and 99,999 one closes while the other opens, and the comma seems to slide one place.
The remainder is an object GSAP carries to its new value, written every frame with toLocaleString; the green bar is as wide as the remainder over the balance, with back.out(1.15), on top of a hatched band made with repeating-linear-gradient that is the transfer’s share. A glint runs along the bar on every digit.
When the amount passes BALANCE the field gets the is-over class (amber, lit border, glow), shakes with x keyframes SHAKE pixels wide that die down, and the two lines under the number swap by sliding. Every extra digit while above gives a smaller shake; the button switches off.
A drawn pointer taps the field, types 3250, adds a zero, deletes it and presses Review transfer; then the field empties and the story starts again. At the first real tap or key the pilot stops, and starts again after nine seconds with nobody around.
| Name | File | Default | What it changes |
|---|---|---|---|
BALANCE | script.js | 4280.5 | The euros available on the account. |
ROLL | script.js | 4 | How many figures a new digit’s reel rolls through before it lands. |
ROLL_TIME | script.js | 0.55 | Seconds for a digit to roll into place. |
SEP_TIME | script.js | 0.42 | Seconds for the thousands separator to slide into its gap. |
BAR_TIME | script.js | 0.7 | Seconds for the balance bar to settle on its new length. |
SHAKE | script.js | 7 | Pixels the field shakes when you go above the balance. |
TYPE_SPEED | script.js | 5 | Digits per second typed by the pilot. |
PAUSE | script.js | 1.3 | Seconds the pilot waits between its steps. |
LOOP | script.js | true | The pilot starts over. |
In the amount step of a bank transfer, a top-up, a payment to a friend or a withdrawal in a banking or payments app; it also fits a savings pot with a goal, a monthly budget or the store credit field of a checkout, anywhere a typed number has to stay under a limit.
The same animation with adapted sizes: the card is as wide as the screen minus the margins, the digits also follow the height (min of vw and vh) and the number shrinks by itself when it would touch the edge of the field. A tap opens the phone’s number keypad.
Nothing rolls or shakes: digits and comma appear already in place, the remainder and the bar jump to their new value, the amber state arrives without a shake and the field already shows 3,250; the pointer is hidden.
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 9 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.