
The elastic button
Buttons, Hover, Text
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.
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>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
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 siteInside 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 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 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.
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.
| Name | File | Default | What it changes |
|---|---|---|---|
TIP_LOW | script.js | 2 | The smallest tip, in the first button. |
TIP_MID | script.js | 3 | The middle tip, the one the drawn pointer picks. |
TIP_HIGH | script.js | 5 | The biggest tip, in the last button. |
ORDER_TOTAL | script.js | 38.4 | The order total before the tip. |
RIDER | script.js | "Tomas" | The rider’s name, on the button and on the card. |
FLIGHT | script.js | 0.8 | How long the coin’s flight to the rider lasts, in seconds. |
HOLD | script.js | 1.8 | How many seconds Tipped stays before the button goes back. |
SQUEEZE | script.js | 0.95 | How much the button squeezes when pressed (1 = not at all). |
ACCENT | script.js | "#ff5a36" | The tip colour: the chosen buttons, the coin, the ring and the Tipped button. |
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.
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.
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.
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 29 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.