
The elastic button
Buttons, Hover, Text
The end of a checkout, on white: a small order summary and under it a dark Pay $48.00 button. Pressed, the label rolls letter by letter to Processing, the button tightens round the word on a short spring and a soft arc of light runs along its edge, faster and faster; then it turns dark green, the check draws itself, Paid and the receipt appear, and a moment later it goes back to how it was.
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>
<!--
"Processing 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 that processes the payment</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 end of a checkout, on white: a small summary and a dark Pay button. Pressed, it narrows to Processing while a
soft arc of light runs round its edge and speeds up, then it turns green with a check that draws itself -->
<section class="pay" data-pay aria-label="Checkout">
<div class="sum">
<p class="sum__head">Order summary</p>
<div class="sum__row"><span>Studio plan, yearly</span><span class="num">$40.00</span></div>
<div class="sum__row"><span>Tax</span><span class="num">$8.00</span></div>
<div class="sum__line"></div>
<div class="sum__row sum__row--tot"><span>Total</span><span class="num" data-total>$48.00</span></div>
<div class="sum__card">
<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="2.5" y="5.5" width="19" height="13" rx="2.5"></rect><path d="M2.5 9.5h19M6 15h4"></path></svg>
<span>Card ending <span class="num" data-card>4821</span></span>
<span class="sum__exp num">09/29</span>
</div>
</div>
<div class="btnwrap" data-wrap>
<button class="btn" type="button" data-btn aria-live="polite">
<span class="btn__shine" data-shine aria-hidden="true"></span>
<svg class="btn__light" data-light aria-hidden="true">
<defs><filter id="soft" x="-20%" y="-50%" width="140%" height="200%"><feGaussianBlur stdDeviation="2.2"></feGaussianBlur></filter></defs>
<path class="btn__glow" data-glow pathLength="1"></path>
<path class="btn__arc" data-arc pathLength="1"></path>
<path class="btn__head" data-head pathLength="1"></path>
</svg>
<span class="btn__in">
<svg class="btn__check" data-check viewBox="0 0 20 20" aria-hidden="true"><path d="M4.6 10.4 8.3 14l7.1-8" pathLength="1"></path></svg>
<span class="btn__label" data-label></span>
</span>
</button>
</div>
<p class="pay__note" data-note>Secured payment. You can cancel any time.</p>
</section>
<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>
<span class="measure" data-measure aria-hidden="true"></span>
</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.
29 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 “Processing pay button” from Animorio and fit it into my siteThe button’s label is a group of spans, one per letter. When it changes, the old one becomes absolute and its letters rise and fade 18 milliseconds apart, while the new ones arrive from below with power3.out: the button never jumps from one word to the next.
For each state the width is measured on a hidden span in the same type: at rest it is the card’s width, while working it hugs the word. GSAP takes the button to the new size with back.out, a short spring that overshoots by a few pixels and settles.
The light is an SVG path with the button’s outline, rebuilt on every frame because the width is changing meanwhile. It has pathLength 1, so the arc is a single stroke-dasharray dash covering part of the edge; the stroke-dashoffset moves on with a speed that grows with the square, and a second blurred stroke underneath makes the halo.
When the wait ends the light goes out, the background turns green with a colour tween, the check is a path with pathLength 1 drawing itself in almost half a second with a small scale snap, and the line below changes with a fade. Everything sits on one timeline, so GSAP owns every pause.
A drawn pointer walks in, rests on the button (the light at the top follows it), presses and waits for the whole loop before starting again. As soon as the real pointer moves over the button the autopilot stops and the button answers only the viewer.
| Name | File | Default | What it changes |
|---|---|---|---|
AMOUNT | script.js | "$48.00" | The amount written on the button and in the total. |
CARD_END | script.js | "4821" | The last four digits of the card. |
PROCESS_TIME | script.js | 1.9 | The seconds the payment takes to process. |
PAID_HOLD | script.js | 1.8 | The seconds it stays green with Paid before going back. |
LIGHT_SPEED | script.js | 1 | How fast the light runs along the edge. |
LIGHT_LENGTH | script.js | 0.22 | How long the arc of light is, as a share of the edge. |
SPRING | script.js | 1 | How much the width bounces when it changes (0 = none). |
LETTER_STAGGER | script.js | 0.018 | The seconds between one letter and the next as the label rolls. |
For the final button of a checkout, a subscription or a donation: it says the payment has started, that the bank is being waited on and that it went through, without opening another page.
The same animation: the card and the button narrow to the screen width and the gaps are measured on the height too; a tap does the hover, the press and the payment.
No rolling letters and no spring: the labels change with a fade, the width changes at once, the light stays still and faint on the edge while waiting and the check appears already drawn.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.9 KB; the libraries: GSAP 28 KB.
Tested on 25 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.