Skip to content
animorio
IT
All components

Round-ups button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 7.4 KBGSAP 28 KBFreeDownload the zip

The Turn on round-ups button of Pennant, a made-up bank, on black, under the week's spending: a coffee, a train ticket, the groceries. Turned on, each purchase is rounded up to the next euro: the cents light up in mint, a small pill with the spare change comes out of the amount and a coin leaves it, flies in an arc into the savings pot drawn inside the button and drops through its slot. The pot squashes and settles, its level rises with a wave, the total rolls up, and below you read how much was put aside this week. Turned off, the pills go back, the pot drains and the label rolls back.

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>
<!--
  "Round-ups 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 Turn on round-ups button with the spare change flying into the savings pot</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" data-stage>
    <!-- the round-ups button of Pennant, a made-up bank: turned on, every purchase of the week is rounded up to the
         next euro and the spare change flies, coin by coin, into the savings pot drawn inside the button -->
    <div class="fit" data-fit>
      <div class="col" data-col>
        <section class="card" aria-label="Recent spending">
          <header class="card__head">
            <span class="card__title">Recent spending</span>
            <span class="card__when">This week</span>
          </header>
          <ul class="rows">
            <li class="row" data-row data-amount="3.40">
              <span class="row__icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 9h11v4.5a5.5 5.5 0 0 1-11 0z"/><path d="M16 10.5h1.6a2.4 2.4 0 0 1 0 4.8H16"/><path d="M8.5 3.8c-.8 1 .8 1.6 0 2.7M12 3.8c-.8 1 .8 1.6 0 2.7"/></svg></span>
              <span class="row__text"><span class="row__name">Brava Roasters</span><span class="row__cat">Coffee</span></span>
              <span class="row__money"><span class="row__chip" data-chip>+0.60</span><span class="row__amount" data-amt>€3<span class="row__cents">.40</span></span></span>
            </li>
            <li class="row" data-row data-amount="12.75">
              <span class="row__icon" aria-hidden="true"><svg viewBox="0 0 24 24"><rect x="5" y="3.5" width="14" height="13" rx="3.2"/><path d="M5 11h14"/><circle cx="8.6" cy="13.8" r=".9"/><circle cx="15.4" cy="13.8" r=".9"/><path d="M8 20.5l1.6-3.2M16 20.5l-1.6-3.2M8.5 6.6h7"/></svg></span>
              <span class="row__text"><span class="row__name">City Rail</span><span class="row__cat">Transport</span></span>
              <span class="row__money"><span class="row__chip" data-chip>+0.25</span><span class="row__amount" data-amt>€12<span class="row__cents">.75</span></span></span>
            </li>
            <li class="row" data-row data-amount="27.15">
              <span class="row__icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M4 9.5h16l-1.7 9a2 2 0 0 1-2 1.6H7.7a2 2 0 0 1-2-1.6z"/><path d="M8.5 9.5 11 4.2M15.5 9.5 13 4.2M9.4 13.4v3.2M14.6 13.4v3.2"/></svg></span>
              <span class="row__text"><span class="row__name">Fenn Market</span><span class="row__cat">Groceries</span></span>
              <span class="row__money"><span class="row__chip" data-chip>+0.85</span><span class="row__amount" data-amt>€27<span class="row__cents">.15</span></span></span>
            </li>
          </ul>
        </section>

        <button class="btn" type="button" data-btn aria-pressed="false">
          <span class="btn__light" aria-hidden="true"></span>
          <span class="pot" data-pot aria-hidden="true">
            <svg viewBox="0 0 40 40">
              <defs><clipPath id="potclip"><circle cx="20" cy="20" r="13.2"/></clipPath></defs>
              <circle class="pot__ring" cx="20" cy="20" r="15"/>
              <g clip-path="url(#potclip)">
                <rect class="pot__level" data-level x="4" y="34" width="32" height="30"/>
                <path class="pot__wave" data-wave d="M2 34 q4.5 -2.4 9 0 t9 0 t9 0 t9 0 t9 0 v30 h-45z"/>
              </g>
              <path class="pot__slot" d="M15.5 11.6h9"/>
            </svg>
            <span class="pot__ripple" data-ripple></span>
          </span>
          <span class="label"><span class="label__win" data-win><span class="label__a">Turn on round-ups</span><span class="label__b">Round-ups on</span></span></span>
          <span class="total" data-total aria-hidden="true"><span class="total__win" data-total-win><span class="total__now" data-total-now>€0.00</span></span></span>
        </button>

        <p class="hint" data-hint><span class="hint__a" data-hint-a>Spare change goes to your Holiday pot</span><span class="hint__b" data-hint-b><b data-saved>€1.70</b> saved this week · Holiday pot</span></p>
        <p class="sr" aria-live="polite" data-live></p>
      </div>
    </div>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2v15.6l4.3-4.1 2.7 6.2 2.6-1.1-2.7-6.1h5.9z"/></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>

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.

40 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 “Round-ups 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

In the middle, on black, a dark card with the week's spending at Pennant, a made-up bank: Brava Roasters, coffee, 3.40 euros; City Rail, train, 12.75; Fenn Market, groceries, 27.15, each with its line-drawn icon. Below, a 60 pixel graphite pill with a thread of light on top: on the left an empty round savings pot with its slot, in the middle Turn on round-ups. On hover the pill rises a pixel and a soft light inside follows the pointer. Tapped, the pill squashes and springs back, the label rolls to Round-ups on in mint, the total comes in at zero on the right and the edge takes a mint thread. Then, one purchase after the other, the cents of the amount light up in mint, the amount gives a little hop, a small pill with the change missing to the next euro comes out of it (+0.60, +0.25, +0.85) and a mint coin with its highlight leaves it, flying in an arc and spinning to the slot of the pot. On arrival the pot squashes and settles, a mint ring spreads, the level rises with the wave running faster for a moment, and the total rolls to the next figure. At the end, under the button, you read 1.70 euros put aside this week in the Holiday pot, the figure pulsing once. Tapped again, the pills go back into the amounts, the pot drains, the total goes and the label is Turn on round-ups again. A drawn pointer does the round by itself.

How it works

The spare change

Each row carries its amount in data-amount; the script rounds it up to ROUND_TO euros, subtracts the amount, multiplies by MULTIPLIER and writes the result in the small pill. The sum goes to the total and to the line under the button.

The coin in an arc

The coin is a disc with a radial gradient. GSAP drives a parameter from 0 to 1 and each frame places it on a quadratic Bézier curve, from the pill to the slot through a high control point, and spins it by squeezing its width with a sine, like a turning coin.

The pot

An SVG circle with a clipPath: inside, a dark rectangle and a light wave rising together to the level of the sum divided by GOAL. The wave drifts sideways on the GSAP ticker, faster for a moment after each coin; the pot squashes and springs back with elastic.out and a ring spreads.

The rolling total

At each coin the new figure comes in from below with back.out and the old one leaves upwards, in a one line window with hidden overflow and tabular figures, so the digits do not wobble.

Turning off

One timeline brings everything back: the label drops, the pills shrink one after the other, the level goes back to zero and the first sentence returns. A click while turning on stops the timeline and removes the coins in flight.

Values to change

NameFileDefaultWhat it changes
ROUND_TOscript.js1How many euros each purchase is rounded up to (1 = the next whole euro).
MULTIPLIERscript.js1How many times the spare change is saved (2 = double round-ups).
GOALscript.js2.5The euros that fill the pot to the brim.
COIN_TIMEscript.js0.75Seconds of each coin's flight.
STAGGERscript.js0.5Seconds between one purchase and the next.
SPRINGscript.js1How springy the pot, the label and the pills are.
IDLEscript.js1.2Seconds before the drawn pointer starts by itself.
LOOPscript.jstrueLeft alone, the pilot does the round again.

Try them in the Playground

When to use it

In a bank or savings app, on the pots page or right under the list of transactions: the button that turns round-ups on and shows straight away how much is put aside. Without the card above it suits any switch that starts automatic saving.

On phones

The same animation: if the card and the button do not fit the screen minus 24 pixels the script scales them down just enough, recalculating on resize, and the coins start and land in the right places even when scaled.

With reduced motion

Nothing flies: the pills and the total fade in, the pot fills without squashing or a drifting wave and the label changes without rolling.

Pitfalls

  • The coins live inside the column scaled by the fit: positions taken with getBoundingClientRect must be divided by the scale, or on the phone the coin lands outside the pot.
  • Turning off halfway through turning on must stop the timeline and remove the coins still in flight, or the total goes up after it was switched off.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 KB.

Testing

Tested on 14 November 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