
The star rating
Ratings, SVG, Hover
Someone searched for “redeem code” and the library had cashback and points, but not the gesture of typing a code. A shop’s Redeem code button, black on white, with a drawn ticket: on click the pill widens on a spring into eight boxes, four and four with a dash in between, where the characters drop in one at a time with a small bounce and the current box lights up in violet. Apply checks it: a wrong code shakes the pill and flashes the boxes red for a moment; the right one gathers the characters towards the centre, the pill tightens into “+$25 credit” as the tick draws itself, and below the store credit rolls digit by digit from $15.00 to $40.00.
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>
<!--
"Redeem code button" 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>Redeem code button</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/jetbrains-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the Redeem code button of a made-up shop: the pill opens into eight boxes, the code goes in one character at a
time, Apply checks it; a wrong code shakes, a good one folds into +$25 credit and the store credit rolls -->
<div class="wrap" data-wrap>
<div class="pill" data-pill>
<div class="pill__lift" data-lift>
<span class="pill__bg" data-bg></span>
<span class="pill__sheen" aria-hidden="true"></span>
<button class="face face--idle" type="button" data-face="idle" aria-label="Redeem code">
<span class="ticket" data-ticket aria-hidden="true">
<svg viewBox="0 0 24 24"><path class="ticket__body" d="M3.5 7.5h17v3a1.6 1.6 0 0 0 0 3.2v3h-17v-3a1.6 1.6 0 0 0 0-3.2z"></path><path class="ticket__cut" d="M14.5 8v8.4"></path></svg>
</span>
<span class="face__label">Redeem code</span>
</button>
<div class="face face--field" data-face="field" aria-hidden="true">
<div class="slots" data-slots>
<input class="slots__input" data-input type="text" inputmode="text" autocomplete="off" autocapitalize="characters" spellcheck="false" maxlength="12" aria-label="Gift card or promo code, 8 characters" tabindex="-1">
</div>
<button class="apply" type="button" data-apply tabindex="-1">Apply</button>
</div>
<button class="face face--done" type="button" data-face="done" aria-hidden="true" tabindex="-1">
<svg class="tick" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.6l4.3 4.2L19 7.2" pathLength="1" data-tick></path></svg>
<span class="face__label" data-done-label>+$25 credit</span>
</button>
</div>
</div>
<p class="note" aria-live="polite"><span class="note__line" data-note>Have a gift card or promo code?</span></p>
<p class="credit"><span class="credit__label">Store credit</span><span class="money" data-money aria-live="polite"></span></p>
</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.
20 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 “Redeem code button” from Animorio and fit it into my siteInside the pill sit three stacked faces: Redeem code, the field with its boxes and Apply, and +$25 credit. The script measures them with getBoundingClientRect and takes the pill’s width to the face on show, with back.out for the spring; the pill stays centred because it is shifted by -50% and grows on both sides. The sizes are measured again once the font has arrived and on resize.
Over the boxes lies a transparent input that takes the keyboard, pasting and the phone: whenever it changes, the text is cleaned (capitals, only letters and digits, eight at most) and the boxes redraw by comparing before and after, so only the new character springs in and only the deleted one leaves.
Apply compares it with the right code. Wrong: the pill shakes with keyframes on x and each box lights its red layer for half a second, staggered by twenty milliseconds. Right: the characters fly to the centre of the field, measured on the spot, the farthest first, then the face changes, the tick draws itself with stroke-dashoffset (autoRound off) and the credit rolls.
The credit is made of columns: each digit is a 0 to 9 strip inside a window one line tall, and GSAP takes it to the new digit with yPercent and a small back.out, one column after the other.
| Name | File | Default | What it changes |
|---|---|---|---|
GOOD_CODE | script.js | LUMA2026 | The right code, eight letters or digits: the one that gives the credit. |
CREDIT | script.js | 25 | How many dollars the right code adds. |
START_BALANCE | script.js | 15 | The credit already there before the code, in dollars. |
SPRING | script.js | 1.6 | How far the pill overshoots when it changes width (0 = no bounce). |
TYPE_SPEED | script.js | 0.11 | The time between characters in the self-running tour, in seconds. |
SHAKE | script.js | 7 | How far a wrong code shakes the pill, in pixels. |
DONE_HOLD | script.js | 2.4 | How long “+$25 credit” stays before the self-running tour starts again, in seconds. |
In an online shop’s cart or checkout, on the gift page, in a subscription app: wherever a promo code or a gift card number gets pasted.
The pill drops to 52 pixels and the boxes are sized on the width (between 22 and 34 pixels), so the whole field with Apply fits; a tap on the boxes opens the keyboard, and there is no hover.
No springs, no shake and no flying characters: the faces crossfade, the width jumps to the new size, the red boxes flash in place and the credit changes without rolling. The self-running tour does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 KB.
Tested on 23 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.