
The elastic button
Buttons, Hover, Text
The Pay $128.00 button of a checkout, a graphite pill on white with a thin slot cut into its top edge. On tap a cobalt card from a made-up bank, Moraine, comes down tilted, straightens as the light slides over its brushed face and slips into the slot chip first with a small clunk: the pill dips a pixel and a half and the slot's lip catches the light. While it authorises a band of light sweeps the pill, the word Authorizing shimmers in step and a lilac light leaks out of the slot; then the pill flushes green, the tick draws itself, Paid arrives and the card is pushed out on a spring and lifts away.
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>
<!--
"Card slot pay 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 Pay button with the card that slides into its slot</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">
<!-- the Pay button of a checkout, with a card slot cut into its top edge. On tap a cobalt card comes down,
straightens, and slides chip first into the slot; a band of light sweeps the pill while it authorises, the
tick draws itself, the card is pushed out and lifts away, and the button goes back to rest -->
<div class="pay" data-pay>
<!-- the card lives in a window that ends exactly at the slot, so whatever goes lower disappears inside -->
<div class="win" data-win aria-hidden="true">
<div class="card" data-card>
<div class="card__face">
<span class="card__brush"></span>
<span class="card__glow"></span>
<span class="card__sheen" data-sheen></span>
<span class="card__edge"></span>
<svg class="card__mark" viewBox="0 0 20 20">
<path d="M10 1.5 18.5 10 10 18.5 1.5 10Z"/>
<path d="M10 6 14 10 10 14 6 10Z"/>
</svg>
<span class="card__bank">MORAINE</span>
<svg class="card__chip" viewBox="0 0 40 30">
<defs>
<linearGradient id="gold" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#f4e2ad"/>
<stop offset=".45" stop-color="#c9a95e"/>
<stop offset=".7" stop-color="#ead596"/>
<stop offset="1" stop-color="#a8853e"/>
</linearGradient>
</defs>
<rect x=".5" y=".5" width="39" height="29" rx="5.5" fill="url(#gold)" stroke="rgba(90,66,20,.55)"/>
<path d="M.5 10.5h11.5a3 3 0 0 1 3 3v3a3 3 0 0 1-3 3H.5M39.5 10.5H28a3 3 0 0 0-3 3v3a3 3 0 0 0 3 3h11.5M15 15h10M20 .5v9M20 20.5v9" fill="none" stroke="rgba(90,66,20,.5)" stroke-width="1"/>
</svg>
<span class="card__num">4417</span>
<span class="card__exp">09/29</span>
</div>
</div>
</div>
<button class="pill" type="button" data-pill data-autoclic aria-label="Pay $128.00 with the card ending 4417">
<span class="pill__skin" aria-hidden="true">
<span class="pill__grain"></span>
<span class="pill__wash" data-wash></span>
<span class="pill__band" data-band></span>
<span class="pill__edge"></span>
</span>
<!-- the slot: a groove with a lit lip, and the light that leaks out of it while the card is inside -->
<span class="slot" data-slot aria-hidden="true">
<span class="slot__leak" data-leak></span>
<span class="slot__groove"></span>
<span class="slot__lip" data-lip></span>
</span>
<span class="row" aria-hidden="true">
<span class="tick" data-tickbox>
<svg viewBox="0 0 24 24">
<circle data-tick-ring cx="12" cy="12" r="10" pathLength="1"/>
<path data-tick d="M7.5 12.4l3 3 6-6.4" pathLength="1"/>
</svg>
</span>
<span class="words" data-words>
<span class="word word--pay" data-word="pay">Pay</span>
<span class="word word--auth" data-word="auth">Authorizing</span>
<span class="word word--paid" data-word="paid">Paid</span>
</span>
<span class="sep" data-sep></span>
<span class="amount" data-amount>$128.00</span>
</span>
</button>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
28 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 “Card slot pay button” from Animorio and fit it into my siteThe card is not inside the button: it sits in a window with overflow hidden whose bottom edge is exactly at the slot (bottom computed with calc from --pill-bottom, --pill-h and --slot-y). Whatever goes lower is cut away, so it seems to go into the pill. On the clunk the window dips with the pill, so the cut stays on the slot.
The card comes in with rotationX (TILT), a few degrees of rotation and a little larger, and arrives straight over the slot with back.out, while a slanted highlight crosses its brushed face. Then it goes down far enough to leave only a third outside (measured on the card's real height) in INSERT seconds with power2.in, which speeds up like a pushed card.
On arrival pill and window drop 1.5 pixels in 60 ms and come back with elastic.out, the card gives two pixels and settles, and the slot's lip lights up and fades. This settling is what makes you feel the bottom of the slot.
A slanted strip with a lilac and white gradient, in mix-blend-mode screen, crosses the pill SWEEPS times with xPercent; the word Authorizing has its text clipped to a gradient (background-clip: text) whose background-position moves with the same timing, so the light passes from the pill to the letters. The width of the words animates on a spring, measured word by word.
Tick and ring have pathLength 1: stroke-dashoffset from 1 to 0. The tick's box grows from zero to 22 pixels and pushes the words on a spring. The card pops out with back.out and flies away; after HOLD seconds everything goes back and the pilot starts again, until someone really touches it (e.isTrusted).
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | '#8d9cff' | The colour of the band of light and of the light leaking from the slot. |
AMOUNT | script.js | '$128.00' | The amount on the button. |
TILT | script.js | 28 | How tilted the card comes in, in degrees. |
INSERT | script.js | 0.42 | Seconds the card takes to slide into the slot. |
SWEEPS | script.js | 2 | How many times the band of light sweeps the pill while it authorises. |
SWEEP | script.js | 0.95 | Seconds of one sweep of the band of light. |
SPEED | script.js | 1 | Speed of everything: 2 twice as fast, 0.5 half. |
HOLD | script.js | 2 | Seconds Paid stays before the button is ready again. |
AUTO | script.js | true | The payment plays by itself until someone touches it. |
As the final button of a checkout, in an online shop's cart, an app's till or a subscription payment: wherever the payment should feel real, with the card going in, a visible wait and a clear confirmation.
The same animation at the same sizes: the pill is at most 76% of the screen wide and the box also follows the height, so it fits the phone box. There is no hover: a tap starts the payment.
Nothing moves: the card fades in already in the slot, Authorizing and Paid fade from one to the other with the tick already drawn, and the card fades out without flying away.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.1 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.