
The elastic button
Buttons, Hover, Text
The button to book a seat at a workshop, on white, in the style of real product interface pieces: beside it the count of seats left, with a rolling digit and a thin bar getting shorter. Pressed, the button fills with orange while an arc spins and becomes You’re in with a check drawing itself; when the last seat goes, the black pill turns on a spring into the light Join waitlist tag, with a swinging bell.
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>
<!--
"Book button with seats" 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 Book button with seats running 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">
<!-- one gesture: book. The button sits next to the seats left, which drop now and then; pressing it books one,
and when the last seat goes the button turns into Join waitlist -->
<div class="frame" data-inquadra>
<p class="event">
<b>Type at Night</b>
<span>Lettering workshop, Thu Nov 14, 7 pm</span>
</p>
<div class="row">
<button class="book" type="button" data-book aria-describedby="nota">
<span class="book__bg" data-bg aria-hidden="true"></span>
<span class="book__fill" data-fill aria-hidden="true"></span>
<span class="ico" aria-hidden="true">
<svg class="ico__arrow" data-arrow viewBox="0 0 20 20"><path d="M4 10h11"></path><path d="m10.6 5.6 4.4 4.4-4.4 4.4"></path></svg>
<svg class="ico__spin" data-spin viewBox="0 0 20 20"><path d="M10 3.6a6.4 6.4 0 1 1-6.4 6.4"></path></svg>
<svg class="ico__check" data-check viewBox="0 0 20 20"><path d="m5 10.4 3.2 3.1L15.2 6.6"></path></svg>
<svg class="ico__bell" data-bell viewBox="0 0 20 20"><path d="M6 13.6V9.2a4 4 0 0 1 8 0v4.4l1.2 1.2H4.8Z"></path><path d="M8.6 16.8a1.5 1.5 0 0 0 2.8 0"></path></svg>
</span>
<span class="labels" data-labels>
<span class="label" data-l="book">Book a seat</span>
<span class="label" data-l="busy">Booking</span>
<span class="label" data-l="in">You’re in</span>
<span class="label" data-l="wait">Join waitlist</span>
<span class="label" data-l="listed">On the waitlist</span>
</span>
</button>
<div class="seats" data-seats aria-live="polite">
<span class="seats__n"><span class="roll" data-roll><span class="digit" data-digit>4</span></span><span class="word" data-word>left</span></span>
<span class="bar" aria-hidden="true"><span class="bar__fill" data-bar></span></span>
</div>
</div>
<p class="note" id="nota" data-note>
<span class="note__t" data-note-t="book">Free cancellation until Nov 12</span>
<span class="note__t" data-note-t="in">Ticket sent. See you on Nov 14</span>
<span class="note__t" data-note-t="wait">Sold out. Get the next free seat</span>
<span class="note__t" data-note-t="listed">We’ll email you if a seat frees up</span>
</p>
</div>
<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.
25 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 “Book button with seats” from Animorio and fit it into my siteThe button’s five labels all sit in the same box, in absolute position; the outgoing one rises and narrows on the wdth axis, the incoming one comes up narrow and widens with back.out, and the box width follows its measured offsetWidth, so the pill grows and shrinks on the same spring.
The count is a one-line window with hidden overflow: on every change a new digit is born next to the old one, one comes in from above and the other leaves downwards. The bar is an element in scaleX going to seats left divided by total seats, with power3.out.
The orange background is a layer under the label going from scaleX 0 to 1 over the loading time, while the arc spins with an endless tween; at the end the check is a stroke with a strokeDasharray that draws itself.
When the seats reach zero the button changes shape: border-radius from 999 to 12 pixels, the background from black to white with a border made of an inset box-shadow, the text from white to black, and an elastic that stretches and squashes it for a moment. The bell swings with rotation keyframes.
A timeline takes the drawn pointer to the button reading its real position every time, presses it with the same functions as a click and makes the other visitors book with timed calls. At the first real touch it stops, and it starts again from the top after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #f0531f | The colour filling the booked button and of the seats when they are few. |
START | script.js | 4 | The seats left when the demo starts. |
CAPACITY | script.js | 12 | The total seats: the bar is full when they are all free. |
LOW | script.js | 3 | From how many seats down the count and the bar take the colour. |
BOOK_TIME | script.js | 0.9 | The seconds of loading before You’re in. |
BOUNCE | script.js | 1.6 | How much the shape and the labels bounce. |
PAUSE | script.js | 1.6 | The seconds the autopilot shows each state. |
For the page of a workshop, a course, a concert or a dinner with limited seats, booking a gym class, a limited product drop: wherever knowing how many seats are left helps people decide.
The block is at most 92% of the screen wide; under 400 pixels the button drops to 44 pixels in height and 14 for the text and the line below to 12, so button and count stay on one row. A tap does what a click does.
No bounces, jumps or rolls: labels, digit and icons change with a fade, the arc does not spin, the fill is almost instant, the shape changes without the elastic and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.2 KB; the libraries: GSAP 28 KB.
Tested on 27 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.