
The elastic button
Buttons, Hover, Text
The gift card step in the checkout of Larkwell, a made-up homeware shop, on a soft warm page with a grain. Above sits the dark glass card with an apricot and lilac aurora drifting slowly inside; below, the field with the sixteen characters of the code in four groups. Every character lands in the field and on the card at the same moment, rising out of a blur, a caret slides on a spring and, once a group is complete, its four short lines fuse into one. A code already used makes the field shake and turn red; a good one lifts the card, sweeps the light across it, unblurs the value while it rolls up to 75 dollars, stamps Redeemed and grows the store credit underneath.
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>
<!--
"Gift card balance 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 gift card field that reveals the balance</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the gift card step of a checkout for Larkwell, a made-up homeware shop: above, the card in dark glass with
its aurora inside; below, the field where the sixteen characters of its code are typed. Every character
lands in the field and, at the same time, on the card; the value on the card stays blurred until the code
is checked, then it rolls up and the store credit underneath grows by the same amount -->
<div class="redeem" data-wrap>
<div class="gift" data-gift>
<div class="gift__body" data-gift-body>
<span class="gift__aurora" aria-hidden="true">
<span class="gift__blob gift__blob--a" data-blob-a></span>
<span class="gift__blob gift__blob--b" data-blob-b></span>
<span class="gift__blob gift__blob--c" data-blob-c></span>
</span>
<span class="gift__grain" aria-hidden="true"></span>
<span class="gift__sheen" data-sheen aria-hidden="true"></span>
<span class="gift__edge" data-edge aria-hidden="true"></span>
<div class="gift__head">
<span class="gift__brand" data-brand>Larkwell</span>
<span class="gift__kind">Gift card</span>
</div>
<div class="gift__code" data-card-code aria-hidden="true"></div>
<div class="gift__foot">
<span class="gift__value">
<span class="gift__label">Value</span>
<span class="gift__amount" data-amount>$00.00</span>
</span>
<span class="gift__stamp" data-stamp aria-hidden="true">
<svg viewBox="0 0 16 16"><path data-stamp-check pathLength="1" d="M3.6 8.4l2.9 2.9 5.9-6.4"/></svg>
<span>Redeemed</span>
</span>
</div>
</div>
</div>
<form class="panel" data-form novalidate>
<label class="panel__label" for="gift-code">Gift card code</label>
<div class="box" data-box>
<span class="box__ring" data-ring aria-hidden="true"></span>
<span class="box__scan" data-scan aria-hidden="true"></span>
<div class="box__slots" data-slots aria-hidden="true"></div>
<span class="box__caret" data-caret aria-hidden="true"><span class="box__caret-bar"></span></span>
<input class="box__input" id="gift-code" data-input type="text" maxlength="24" autocomplete="off" autocapitalize="characters" autocorrect="off" spellcheck="false" aria-describedby="gift-msg">
<button class="box__btn" type="submit" data-btn disabled>
<span class="box__btn-face" data-btn-face>
<span class="box__btn-words" data-btn-words>Redeem</span>
<svg class="box__btn-spin" data-btn-spin viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="7" pathLength="1"/></svg>
<svg class="box__btn-check" viewBox="0 0 16 16" aria-hidden="true"><path data-btn-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/></svg>
</span>
</button>
</div>
<p class="msg" id="gift-msg" data-msg aria-live="polite">
<span class="msg__icon" aria-hidden="true">
<svg class="msg__i msg__i--help" viewBox="0 0 16 16"><rect x="2.5" y="4" width="11" height="8" rx="1.6"/><path d="M2.5 6.6h11"/></svg>
<svg class="msg__i msg__i--err" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M8 4.9v3.6M8 10.9v.1"/></svg>
<svg class="msg__i msg__i--ok" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6"/><path d="M5.3 8.2l1.9 1.9 3.6-3.9"/></svg>
</span>
<span class="msg__text" data-msg-text>16 characters, on the back of your card</span>
</p>
<div class="credit">
<span class="credit__label">Store credit</span>
<span class="credit__right">
<span class="credit__plus" data-plus>+$75.00</span>
<span class="credit__amount" data-credit>$12.40</span>
</span>
</div>
</form>
</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.
35 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 “Gift card balance field” from Animorio and fit it into my siteThe sixteen slots are drawn, but over them lies a real input, transparent and at 16 pixels (so the iPhone does not zoom): it takes the keyboard, backspace, paste and the phone’s keyboard. On every input event the value is cleaned (upper case, only letters and digits, sixteen at most), compared with the previous code slot by slot, and only the slots that changed animate: new ones come in, removed ones go out.
Every new character starts at once in the field and on the card: in the field with a fromTo from 7 pixels below, scale 0.7 and blur(3px) with back.out(2.6), on the card out of a wider blur with expo.out and forty milliseconds of delay, so the two arrivals read as one reflected. After four characters the group’s four short lines fade and a single line grows from scaleX 0.55 with back.out(3).
The caret is a gsap.quickTo on x with back.out: the position is read from the slot’s getBoundingClientRect, and on resize it snaps back to its place. The band of light on the card is an oblique gradient moved by the --sx variable, which follows how much of the code is written; the same value, scaled, moves the bright spot of the edge, a one pixel ring cut out with mask-composite, so the edge and the glass light up together.
Redeem swaps the word for an SVG arc spinning with svgOrigin, runs a light through the field with the --scan variable and moves the band back and forth. With a code already used the field shakes with keyframes from -8 to 0 pixels, smaller and smaller, like a damped spring; the letters turn red and the message changes dropping and rising again, with the icon swapping on a small bounce.
On success a single object carries the number, the blur and the opacity of the value: the number rolls from 0 to 75 with power3.out while --blur drops from 6 to 0 pixels, with tabular digits that never change width. The card rises with back.out and settles, the stamp comes in with its check drawn by stroke-dashoffset, and the store credit grows by the same amount, starting green and going back to the colour of the text.
| Name | File | Default | What it changes |
|---|---|---|---|
BRAND | script.js | 'Larkwell' | The shop written on the card and in the message. |
USED_CODE | script.js | 'K7Q2MX4D8RLP2HVA' | The code already used, which gives the error. |
GOOD_CODE | script.js | 'H4NB9TQE2WRX7LMC' | The good code it redeems by itself. |
CARD_VALUE | script.js | 75 | The value of the good card, in dollars. |
START_CREDIT | script.js | 12.4 | The store credit before redeeming. |
TYPE_SPEED | script.js | 0.085 | The seconds between one character and the next when it types by itself. |
CHECK_TIME | script.js | 1.25 | The seconds the code takes to be checked. |
LIFT | script.js | 6 | The pixels the redeemed card rises. |
AUTO | script.js | true | Whether it goes round by itself until someone touches it. |
In the checkout or account page of an online shop, a delivery app, a subscription or a hotel that sells vouchers: wherever a gift card or a prepaid code is redeemed and the person typing should see on the card what they are writing, understand the error without reading and watch the credit grow.
On the phone the card and the panel are 88% of the screen wide, the characters shrink with the width and the card never grows past the height that is left; the field opens the phone’s keyboard already in capitals, the input is at 16 pixels and the iPhone does not zoom. Without a mouse the light on the card follows only the code.
Nothing moves: the characters fade in without rising, the field does not shake but turns red, the card does not rise and the light does not cross it, the aurora stays still; the value reveals itself and the digits roll, the stamp and the check draw themselves.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.
Tested on 3 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.