
The elastic button
Buttons, Hover, Text
The Add to Wallet button of a travel app, with a single gesture: pressed, its top edge opens like a pocket, the boarding pass comes down from above, lines up with the slot and slides in, disappearing behind the face of the button; the pocket closes with a small bump, the counter on the wallet rolls from 3 to 4 and only then the label says Added, with the tick drawing itself. Pressed again, the pass rises back out and leaves.
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>
<!--
"Wallet pocket 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>The Add to Wallet button with the boarding pass that slides into its pocket</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">
<!-- one gesture: press. The Add to Wallet button of a travel app: pressed, its top edge opens like a pocket, the
boarding pass drops in from above, sinks behind the front of the button and the button closes over it with a
small bump; the pass counter on the wallet rolls on and only then the label says Added. Pressed again, the
pass slides back out and goes away -->
<div class="unit" data-unit>
<div class="pocket" data-pocket aria-hidden="true">
<span class="lip" data-lip></span>
<div class="pass" data-pass>
<div class="pass__band">
<span class="pass__air">Ferrow Air</span>
<span class="pass__kind">Boarding pass</span>
</div>
<div class="pass__route">
<span class="pass__code" data-from>LIS</span>
<svg class="pass__plane" viewBox="0 0 64 12"><path class="pass__dash" d="M2 6h22M40 6h22"></path><path class="pass__jet" d="M27 6h10M34.5 2.6 37 6l-2.5 3.4M29.5 6l-1.6-2.6M29.5 6l-1.6 2.6"></path></svg>
<span class="pass__code" data-to>AMS</span>
</div>
<div class="pass__meta">
<span><em>Flight</em><b data-flight>FR 214</b></span>
<span><em>Gate</em><b data-gate>B12</b></span>
<span><em>Seat</em><b data-seat>14A</b></span>
<span><em>Boards</em><b data-boards>08:40</b></span>
</div>
<div class="pass__perf"></div>
<div class="pass__bars" data-bars></div>
</div>
</div>
<button class="btn" type="button" data-btn aria-live="polite">
<span class="btn__face" data-face>
<span class="btn__shine" aria-hidden="true"></span>
<span class="wallet" aria-hidden="true">
<svg viewBox="0 0 24 24">
<rect class="wallet__card wallet__card--b" x="5.2" y="3.6" width="13" height="8" rx="1.6"></rect>
<rect class="wallet__card wallet__card--a" data-wcard x="4.2" y="5.4" width="14" height="8" rx="1.6"></rect>
<path class="wallet__body" d="M3 9.6h18v9.2a1.6 1.6 0 0 1-1.6 1.6H4.6A1.6 1.6 0 0 1 3 18.8Z"></path>
<path class="wallet__flap" d="M15.4 13.4h5.6v3.6h-5.6a1.8 1.8 0 0 1 0-3.6Z"></path>
</svg>
<span class="wallet__count" data-count><span data-digit>3</span></span>
</span>
<span class="btn__labels">
<span class="btn__label" data-label="add">Add to Wallet</span>
<span class="btn__label" data-label="adding">Adding</span>
<span class="btn__label" data-label="added">
<svg class="tick" viewBox="0 0 16 16"><path data-tick d="M3.4 8.4 6.6 11.4 12.6 4.8"></path></svg>
Added
</span>
</span>
</span>
</button>
<p class="note" data-note><span data-note-a>Your pass works offline</span><span data-note-b>4 passes in Wallet</span></p>
</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="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.
42 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 “Wallet pocket button” from Animorio and fit it into my siteBehind the face of the button there is a darker copy of it, the lip of the pocket: lifting it by eight pixels shows the slot. The pass sits between the two, so on the way down it passes in front of the lip and behind the face, with no mask to animate.
Pass and lip live in a container that ends exactly at the bottom edge of the button and cuts whatever goes beyond: once in, the pass never peeks out underneath.
When the pass is in, the face squashes for 70 thousandths (scaleY 0.94 from the bottom edge) and comes back with elastic.out(1, 0.38): it is the pocket closing.
The three labels (Add to Wallet, Adding, Added) share one cell: the old one rises away before the new one comes up from below with a small overshoot, so two words never show on top of each other.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #2f6bff | The airline colour: the band of the pass, the plane, the counter on the wallet. |
DROP | script.js | 0.5 | How long the pass takes to slide into the pocket, in seconds. |
BUMP | script.js | 0.06 | How much the button gives when the pass reaches the bottom. |
OPEN | script.js | 8 | How far the pocket opens above the button, in pixels. |
PASSES | script.js | 3 | How many passes are already in the wallet. |
FROM | script.js | LIS | The departure airport. |
TO | script.js | AMS | The arrival airport. |
FLIGHT | script.js | FR 214 | The flight number. |
SEAT | script.js | 14A | The seat. |
LABEL | script.js | Add to Wallet | The button label at rest. |
In the app or site of an airline, a train, a concert or a museum, after checkout: anywhere a ticket or a card can be saved to the phone’s wallet.
The same button, as wide as it needs and sized on the screen height too, with the pass scaling along. A finger presses like the mouse; there is no hover.
No drops or hits: the pass appears and fades away, the labels and the counter swap with fades, the tick is already drawn, the drawn pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.5 KB; the libraries: GSAP 28 KB.
Tested on 30 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.