
The layered button
Buttons, Hover, Physics
The delivery step in the checkout of an online grocery shop, dark and premium like a Dribbble shot: five days in a row with a sliding pill, and under them a thin histogram of how busy every hour is, mint for the quiet hours and amber for the peak. A glass lens two hours wide follows the finger on a spring, leans a little with its speed and lands on the hour with a pixel of bounce; the bars under it light up, the delivery fee rolls digit by digit and the tag says how busy the van will be. Another day reshapes the bars one after the other; Reserve books it with a light running round the button and then a check.
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>
<!--
"Delivery window picker" 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 delivery window picker with the fee that follows demand</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 delivery window of a grocery app at checkout. Under the days, a thin histogram says how busy every hour is:
the quiet hours are mint, the peak hours amber. A glass lens two hours wide sits on the bars; drag it and the
bars under it light up, the fee rolls digit by digit and the tag says how busy the van will be -->
<section class="slot" data-wrap aria-label="Delivery window">
<span class="slot__glow" data-glow aria-hidden="true"></span>
<div class="slot__card" data-card>
<header class="slot__head">
<div>
<h2 class="slot__title">Delivery window</h2>
<p class="slot__sub">Larder groceries · 14 items</p>
</div>
<span class="slot__chip">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M1.8 4.6h7.4v6.2H1.8zM9.2 6.6h2.9l2.1 2.2v2H9.2"/><circle cx="4.6" cy="11.6" r="1.3"/><circle cx="11.6" cy="11.6" r="1.3"/></svg>
Van
</span>
</header>
<div class="slot__days" role="radiogroup" aria-label="Day" data-days>
<span class="slot__pill" data-pill aria-hidden="true"></span>
</div>
<div class="slot__chart" data-chart>
<div class="slot__bars" data-bars aria-hidden="true"></div>
<div class="slot__lens" data-lens role="slider" tabindex="0" aria-label="Delivery window" aria-valuemin="0" aria-valuenow="0">
<span class="slot__lens-label" data-label>2 – 4 pm</span>
<span class="slot__lens-glass" aria-hidden="true"><span class="slot__lens-shine"></span></span>
<span class="slot__lens-grip" aria-hidden="true"><i></i><i></i><i></i></span>
</div>
</div>
<div class="slot__ticks" data-ticks aria-hidden="true"></div>
<div class="slot__fee">
<div class="slot__fee-left">
<span class="slot__fee-name">Delivery fee</span>
<span class="slot__tag" data-tag><span class="slot__tag-words" data-tag-words>Quiet hour · shared van</span></span>
</div>
<span class="slot__amount" data-amount aria-hidden="true"></span>
</div>
<button class="slot__btn" type="button" data-btn>
<span class="slot__btn-beam" aria-hidden="true"></span>
<span class="slot__btn-face" data-face>
<span class="slot__btn-words" data-words>Reserve Thu, 2 – 4 pm</span>
<svg class="slot__btn-icon" viewBox="0 0 16 16" aria-hidden="true">
<path class="slot__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
</svg>
</span>
</button>
</div>
</section>
<p class="sr" aria-live="polite" data-live></p>
</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.
37 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 “Delivery window picker” from Animorio and fit it into my siteThe lens position is a number in hours, with its velocity. On every gsap.ticker frame a spring with STIFFNESS and DAMPING (three small steps, the step capped at 1/30 s) pulls it towards the goal; dragging only moves the goal, letting go rounds it to the hour. The velocity gives a rotation of a few degrees, so the glass leans as it runs.
For every bar the script works out how much the lens covers it, from 0 to 1, using the decimal position: opacity and scale grow with the cover, so the bars light up as the glass slides over them. Height and colour come from that hour’s demand, the colour interpolated from --quiet to --peak; only what changed is written again.
The fee is a sign, a digit, the point and two digits: each digit is a reel from 0 to 9 in a window one em tall, moved with yPercent and a back.out, with a delay that grows from left to right. The price is the average demand of the covered hours, mapped between LOW_FEE and HIGH_FEE in steps of FEE_STEP.
The pill moves to the day’s offsetLeft with a back.out while it stretches in proportion to the distance and settles with an elastic; the new day’s bars go to their height one after the other with a 28 millisecond stagger.
The button’s edge is a conic-gradient masked with mask-composite, turning by tweening the --a variable; then the fill turns mint, the icon widens and the check draws itself with strokeDashoffset. Moving the lens halfway cancels the booking.
| Name | File | Default | What it changes |
|---|---|---|---|
DAYS | script.js | Wed 4, Thu 5, Fri 6, Sat 7, Sun 8 | The days in the row: the weekday, a space and the number. |
START_DAY | script.js | 1 | The day chosen at the start, counting from 0. |
FIRST_HOUR | script.js | 8 | The first hour of the histogram, on the 24 hour clock. |
HOURS | script.js | 14 | How many hours the histogram shows. |
WINDOW | script.js | 2 | How many hours the delivery window lasts: it is the width of the lens. |
START_HOUR | script.js | 14 | Where the window starts at the beginning, on the 24 hour clock. |
LOW_FEE | script.js | 0.99 | The fee in the quietest window. |
HIGH_FEE | script.js | 5.99 | The fee in the busiest window. |
FEE_STEP | script.js | 0.5 | How much the fee changes at every step. |
CURRENCY | script.js | $ | The sign in front of the fee. |
STIFFNESS | script.js | 260 | The spring pulling the lens: higher is quicker. |
DAMPING | script.js | 21 | Lower lets the lens pass the hour and come back. |
SPRING | script.js | 1 | How springy the digits, bars and pill are: 0.4 calm, 2 very bouncy. |
BOOKING | script.js | 1.2 | How many seconds the light runs round the button. |
HOLD | script.js | 1.8 | How many seconds Reserved stays before the button goes back to rest. |
AUTO | script.js | true | The card goes round by itself until someone touches it. |
In the checkout of an online grocery shop, a store with same day delivery, a restaurant that delivers or a pickup service: choosing when the courier comes while seeing at once what it costs and how busy that hour is, so whoever can picks the quiet hours.
On the phone the card is 92% of the screen wide and the heights of the bars and gaps also follow the window’s height; the lens is dragged with the finger (the bars area has touch-action: none, so the page does not scroll while you pull it) and a tap on a bar brings the lens there.
Nothing moves: the lens, the pill and the bars go straight to their place with a short fade, the fee digits and the tag change in place, the light round the button fades in and out and the check appears.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 3 November 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.