
The layered button
Buttons, Hover, Physics
The form for booking a visit at a dental practice. The treatment sets how long the visit block is, from 30 to 75 minutes; the block drags along the morning, over the times already taken, and when you let go it snaps on a spring to the nearest free time. The button says the chosen time and, pressed, becomes “Booked”.
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>
<!--
"Dentist booking form" 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>Dentist booking form</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">
<!-- a booking form for a dental practice: the treatment sets how long the block is, the block is dragged
along the morning and snaps on a spring to the nearest time that is really free -->
<form class="dn" data-dn novalidate>
<header class="dn__head">
<h2 class="dn__title">Book a visit</h2>
<p class="dn__sub">Tuesday 24 November</p>
</header>
<div class="dn__treat" data-treat role="radiogroup" aria-label="Treatment"></div>
<div class="dn__day">
<div class="dn__rail" data-rail>
<span class="dn__land" data-land aria-hidden="true"></span>
<span class="dn__block" data-block role="slider" tabindex="0" aria-label="Appointment time" aria-orientation="horizontal">
<i></i><i></i><i></i>
</span>
</div>
<div class="dn__hours" data-hours aria-hidden="true"></div>
</div>
<button class="dn__book" type="submit" data-book>
<svg viewBox="0 0 20 20" aria-hidden="true"><path data-tick pathLength="1" d="M4.500 10.500l3.800 3.800L15.500 6.500"></path></svg>
<span class="dn__roll"><span data-label>Book 9:00</span></span>
</button>
<span class="dn__say" data-say aria-live="polite"></span>
</form>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
13 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Dentist booking form” from Animorio and fit it into my siteFor each length the list of valid starts is worked out: on the fifteen-minute step, inside the morning, clear of the busy intervals. The block can only rest there.
While dragged the block follows the pointer to the minute; an outline shows the nearest valid start. On release a GSAP elastic takes the block to that start.
Position and length live in one animated object: on a new treatment the width and, if needed, the start move in the same tween, so the block grows and shifts together.
The treatments are a radiogroup; the block is a slider: the arrows take it to the free time before or after, Home and End to the first and last, and aria-valuetext says the time.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #0f9b8e | The colour of the visit block and of the chosen treatment. |
OPENS | script.js | 9 | When the practice opens: the morning shown lasts four hours. |
STEP | script.js | 15 | How many minutes apart visits can start. |
SPRING | script.js | 1 | How elastic the block is when it snaps: 0.3 = stiff, 2 = very elastic. |
LOOP | script.js | true | Left alone, the demo’s pointer changes treatment, drags the block and books. |
On the site of a dental practice, a doctor, a physiotherapist, a hairdresser or a garage: wherever services of different lengths have to fit into a day that already has commitments.
The same card, as wide as the screen: the track is 46 pixels tall, you can tap anywhere to bring the block there and dragging does not scroll the page.
The block follows the finger and on release goes straight to the valid time, with no spring; width, labels and tick change at once. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.9 KB; the libraries: GSAP 28 KB.
Tested on 21 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.
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.