
The slide-to-confirm button
Buttons, Physics, Transitions
One stepper, one gesture, in the simple style of product interface pieces: how many nights in a hotel, with a minus, a plus and a big number. Underneath, a thin line runs from the check-in to the check-out: every night more stretches it by one notch on a spring, its end lands a pixel past and settles, leaning slightly as it runs, and the check-out date at the far end rolls to the new day, only in the parts that change.
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>
<!--
"Nights stepper" 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 nights stepper with the sliding check-out</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">
<!-- how many nights in a hotel: minus, the number, plus. Under it a thin line runs from the check-in to the
check-out; every night more stretches it by one notch on a spring, and the check-out date at the far end rolls
to the new day. The ticks, the line and the dates are drawn by the script -->
<div class="stay" data-stay>
<p class="stay__label" id="stay-label" data-label><span>Nights</span></p>
<div class="stay__row">
<button class="stay__btn" type="button" aria-label="One night less" data-less>
<span class="stay__btn-in" aria-hidden="true">
<svg viewBox="0 0 44 44"><path d="M15.5 22h13"/></svg>
</span>
</button>
<div class="stay__value" role="spinbutton" tabindex="0" aria-labelledby="stay-label" aria-valuemin="1" aria-valuemax="10" aria-valuenow="3" aria-valuetext="3 nights" data-value>
<span class="stay__slot stay__slot--num" aria-hidden="true" data-num></span>
</div>
<button class="stay__btn" type="button" aria-label="One night more" data-more data-autoclic>
<span class="stay__btn-in" aria-hidden="true">
<svg viewBox="0 0 44 44"><path d="M15.5 22h13M22 15.5v13"/></svg>
</span>
</button>
</div>
<svg class="stay__track" data-track aria-hidden="true">
<path class="stay__rest" data-rest/>
<g data-ticks></g>
<path class="stay__fill" data-fill/>
<path class="stay__start" data-start/>
<path class="stay__end" data-end/>
</svg>
<div class="stay__dates" aria-hidden="true">
<p class="stay__date">
<span class="stay__small">Check-in</span>
<span class="stay__day" data-in></span>
</p>
<p class="stay__date stay__date--out">
<span class="stay__small">Check-out</span>
<span class="stay__day" data-out></span>
</p>
</div>
<p class="stay__said" aria-live="polite" data-said></p>
</div>
</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.
22 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 “Nights stepper” from Animorio and fit it into my siteThe end of the stroke is not a tween: it is a damped spring measured in nights, integrated in small steps inside GSAP’s ticker. Plus only moves the target; the spring gets there by itself, a pixel past with SPRING’s damping, and a new press halfway restarts from the speed it has, with no jumps.
The end stroke is a two-point path: its top trails behind by the spring’s speed, so while it runs it leans back and straightens as it lands. When the spring is still the loop switches off and nothing is redrawn.
Every frame checks which notches the end has passed: the one just passed takes the colour and grows with elastic.out, the one left behind shrinks with power2. The notches follow the spring, not the number, so they stand up exactly when the end runs over them.
The check-out date is three slots, weekday, day and month, each a grid with its texts in the same cell. Only the slot that changes rolls: the old text leaves on the side the count goes, the new one lands a pixel past and settles, and the slot takes the new width with back.out. The day first, then the weekday, then the month, like a carry.
| Name | File | Default | What it changes |
|---|---|---|---|
MIN | script.js | 1 | The fewest nights. |
MAX | script.js | 10 | The most nights, and the notches on the line. |
START | script.js | 3 | The nights when the page opens. |
CHECK_IN | script.js | 2026-11-26 | The arrival day, year-month-day. |
SPRING | script.js | 1 | How springy the end of the line is: 0.5 stops dead, 2 runs past and swings back. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
HOLD | script.js | [0.42, 0.16, 0.07] | Holding a button: the wait before repeating, the first gap and the shortest, in seconds. |
WORDS | script.js | ['night', 'nights'] | The word for one night and for more, read out by a screen reader. |
LABEL | script.js | ['Nights', 'Stays up to {max} nights', 'At least one night'] | The label on top: at rest, at the most, at the fewest. |
In the booking card of a hotel, a holiday home or a campsite, when choosing how many nights to stay: the stretching line and the rolling date say at once when you leave, without opening a calendar.
On the phone the stepper takes its width from the screen (min with 88vw) and its heights from the height too (clamp in vh); the line is recomputed on resize. There is no hover on the notches: they take a tap and a drag.
Nothing moves: the end of the line jumps straight to the new night, the notches change colour, the number and the date cross-fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.1 KB; the libraries: GSAP 28 KB.
Tested on 1 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.