Skip to content
animorio
IT
All components

Rider tip button

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

The button to tip the rider in a delivery app, with a single gesture: pressed, the black Tip Tomas pill widens and three amounts come out of it, $2, $3 and $5. Pick one and it turns orange, the others leave and it becomes a coin that flips as it flies to the rider’s avatar; the order total goes up, the line under the name says thanks and the button closes on Tipped $3 with a drawn tick. Then 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>
<!--
  "Rider tip 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 Tip button that opens into amounts for the rider</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 delivered order of a food app: the rider on top, the order total, the Tip pill below.
         Pressed, the pill opens into three amounts; the chosen one becomes a coin that flies to the rider, the total
         rolls up and the pill closes on Tipped with a drawn tick -->
    <section class="order" data-order aria-label="Your delivered order">
      <div class="order__top">
        <span class="status"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.4 6.6 11.3 12.6 4.9"></path></svg>Delivered · 7:42 pm</span>
        <span class="shop">Bottega Nami</span>
      </div>

      <div class="rider">
        <span class="avatar" data-avatar>
          <svg class="ring" viewBox="0 0 60 60" aria-hidden="true">
            <circle class="ring__line" data-ring cx="30" cy="30" r="27"></circle>
          </svg>
          <span class="avatar__face" aria-hidden="true">
            <span class="avatar__shine"></span>
            <svg class="avatar__helmet" viewBox="0 0 40 40"><path d="M9 23c0-7 5-12.5 11-12.5S31 16 31 23v1.5H9Z"></path><path class="visor" d="M20 17.5h10.6c.3 1.3.4 2.6.4 4H20Z"></path></svg>
          </span>
        </span>
        <span class="rider__text">
          <span class="rider__name" data-name>Tomas</span>
          <span class="rider__note" data-notewin><span class="note" data-note>Rode 2.4 km in the rain</span></span>
        </span>
      </div>

      <div class="total">
        <span class="total__label">Order total</span>
        <span class="total__win" data-totalwin><span class="total__value" data-total>$38.40</span></span>
      </div>

      <div class="tip" data-tip>
        <span class="tip__fill" data-fill aria-hidden="true"></span>
        <button class="tip__main" type="button" data-main>
          <span class="coin" data-coinicon aria-hidden="true"><svg viewBox="0 0 20 20"><circle cx="10" cy="10" r="7.2"></circle><path d="M10 6.4v7.2M12.2 8.1c-.4-.8-1.2-1.1-2.2-1.1-1.3 0-2.1.6-2.1 1.5 0 2.1 4.5 1 4.5 3.1 0 .9-.9 1.6-2.4 1.6-1.1 0-2-.5-2.4-1.3"></path></svg></span>
          <svg class="tick" data-tickwrap viewBox="0 0 20 20" aria-hidden="true"><path data-tick d="M4.5 10.4 8.3 14 15.6 6.2"></path></svg>
          <span class="tip__label" data-win><span class="lab" data-lab>Tip Tomas</span></span>
        </button>
        <div class="tip__chips" data-chips role="group" aria-label="Choose a tip">
          <button class="amt" type="button" data-amt="0">$2</button>
          <button class="amt" type="button" data-amt="1">$3</button>
          <button class="amt" type="button" data-amt="2">$5</button>
        </div>
      </div>
    </section>

    <span class="flycoin" data-flycoin aria-hidden="true">$3</span>
    <p class="sr" aria-live="polite" data-live></p>

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

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.

30 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 “Rider tip 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 only the card of an order just delivered: at the top, in green, Delivered · 7:42 pm with a tick and on the right the restaurant’s name, Bottega Nami; below it the rider’s avatar, a peach circle with a drawn helmet, the name Tomas and a grey line, Rode 2.4 km in the rain; then, after a dashed rule, the order total, $38.40, and at the bottom the black Tip Tomas pill with a drawn coin. On hover the pill lifts by a pixel and the coin spins once. Pressed, it squeezes and springs back; the words go up and out, the pill widens with a little bounce and three buttons come out of it, $2, $3 and $5, starting from the middle one. Hovering an amount lifts it slightly. Pick the $3 and it turns orange with a spring, the other two shrink and fade, and the $3 becomes an orange coin flying along a curve to the avatar, flipping like a tossed coin. Meanwhile the pill closes to the width of its new words, fills with orange from the middle, Tipped $3 comes in and a tick draws itself. When the coin arrives the avatar makes a little jump, an orange ring closes around it, the line under the name becomes Got your $3 tip, thank you and the total goes to $41.40, always with the old one leaving before the new one comes in. After a moment everything goes back. A drawn pointer shows the round by itself until you touch the button.

How it works

One pill, two contents

Inside the pill sit the row of words and the row of three amounts, one on top of the other; only one is visible. GSAP animates the pill’s width between the width of the words (measured on the real text) and the width of the row, with back.out, and the second only comes in after the first has gone.

The coin takes the amount’s place

The coin is born on the stage exactly over the chosen button, measured with getBoundingClientRect; the button fades at the same moment. It flies on a Bézier curve computed between the button and the avatar, and flips by squashing its scaleX with the cosine of the progress.

The lines that change

The line under the name, the total and the button’s words sit in one-line windows with overflow hidden: the old one goes up and out, then the new one comes in from below with back.out. Two texts are never seen together in the same place.

The drawn pointer

A looping timeline moves a small SVG pointer: it presses the pill, passes over the first amount, settles on the middle one and presses it, then steps aside. It switches off at the first real touch.

Values to change

NameFileDefaultWhat it changes
TIP_LOWscript.js2The smallest tip, in the first button.
TIP_MIDscript.js3The middle tip, the one the drawn pointer picks.
TIP_HIGHscript.js5The biggest tip, in the last button.
ORDER_TOTALscript.js38.4The order total before the tip.
RIDERscript.js"Tomas"The rider’s name, on the button and on the card.
FLIGHTscript.js0.8How long the coin’s flight to the rider lasts, in seconds.
HOLDscript.js1.8How many seconds Tipped stays before the button goes back.
SQUEEZEscript.js0.95How much the button squeezes when pressed (1 = not at all).
ACCENTscript.js"#ff5a36"The tip colour: the chosen buttons, the coin, the ring and the Tipped button.

Try them in the Playground

When to use it

At the end of a delivery in a food or grocery app, on a taxi or courier receipt, on a creator’s page that takes tips: anywhere you leave something for a person and it helps to pick it with one tap and see it arrive.

On phones

The same card, as wide as the screen up to 340 pixels, with the gaps shortening on low screens; a finger presses like the mouse, the pill opens into the same three amounts and the coin takes the same curve. On a phone there is no hover, so the coin does not spin before the tap.

With reduced motion

No flight, jumps or squeezes: the pill changes size at once, the three amounts and the labels fade in and out, the ring appears already closed. The drawn pointer does not run.

Pitfalls

  • The flying coin belongs on the stage, not inside the pill: the pill has overflow hidden for the orange that fills it and would clip the coin as soon as it leaves.
  • Positions are measured on click, not on load: the demo’s window changes size and the card moves.
  • The closing pill shrinks together with its content: the three amounts go first, so a wide empty pill is never left.
  • Focus goes to the middle amount only when the pill was opened with the keyboard: with the mouse no focus ring should appear.
  • Two labels in the same place never cross-fade: first one leaves, then the other comes in.

Libraries

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.

Testing

Tested on 29 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