Skip to content
animorio
IT
All components

Processing pay button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.9 KBGSAP 28 KBFreeDownload the zip

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.

The code

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>

Playground

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

Or ask your AI assistant for it

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 site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white background there is the end of a checkout: a very light grey card with Order summary, the yearly Studio plan at 40 dollars, tax at 8, a total of 48 and below it the card ending in 4821 with its expiry date; further down a dark button as wide as the card, Pay $48.00, and a grey line saying the payment is secured. With the pointer over it the button lifts by a pixel and a soft light at the top follows the pointer; pressed it squeezes slightly and comes back with a small bounce. Then the label rolls letter by letter, the old letters rising and vanishing while the new ones arrive from below, until it reads Processing, and the button tightens round the word on a short spring. A single arc of pale blue light with a blurred halo runs along the edge, starting slowly and speeding up, growing a little longer. After almost two seconds the light goes out, the background turns dark green, the check draws itself with a small snap, the label becomes Paid and the emailed receipt appears below; a moment later everything goes back to Pay $48.00, as wide as before. A drawn pointer runs the whole loop on its own.

How it works

A label made of letters

The 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.

Width on a spring

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.

One arc of light on the edge

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.

Paid

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.

The autopilot

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.

Values to change

NameFileDefaultWhat it changes
AMOUNTscript.js"$48.00"The amount written on the button and in the total.
CARD_ENDscript.js"4821"The last four digits of the card.
PROCESS_TIMEscript.js1.9The seconds the payment takes to process.
PAID_HOLDscript.js1.8The seconds it stays green with Paid before going back.
LIGHT_SPEEDscript.js1How fast the light runs along the edge.
LIGHT_LENGTHscript.js0.22How long the arc of light is, as a share of the edge.
SPRINGscript.js1How much the width bounces when it changes (0 = none).
LETTER_STAGGERscript.js0.018The seconds between one letter and the next as the label rolls.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The light’s outline has to be rebuilt on every frame: the button’s width changes exactly while the light is running, and a path drawn once would stay as wide as before.
  • With pathLength 1 the dash and the gap of stroke-dasharray are written as fractions of the edge, whatever its size: without it the arc would grow and shrink with the button.
  • The width is measured on a hidden span in the same type and weight, after document.fonts.ready: measured earlier, with the fallback font, the word overflowed the button.
  • The old letters become absolute before leaving: if they stayed in the flow the new label would arrive beside the old one.

Libraries

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.

Testing

Tested on 25 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All components