
The elastic button
Buttons, Hover, Text
The black «Book a consultation» button of an invented consulting studio, alone on white: on hover the letters roll up and away one after the other and the first free time rolls into the label, «Next Tue 10:30». On click the time is pinned: «Next» folds away, a ring in the accent colour draws itself in front of the time with a check inside, the digits tap down once and the line below becomes «Confirmed · invite sent».
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 a consultation 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 Book a consultation button with the free time rolling in</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>
<!-- one button, one gesture: the first free time rolls in through the label, and a tap pins it with a drawn check -->
<div class="book" data-book>
<button class="book__btn" type="button" data-btn aria-label="Book a consultation">
<span class="book__body" data-body>
<span class="book__tick" data-tick aria-hidden="true">
<svg viewBox="0 0 24 24">
<circle class="book__ring" data-ring cx="12" cy="12" r="9.5"/>
<path class="book__check" data-check d="M7.6 12.4 10.6 15.3 16.6 8.9"/>
</svg>
</span>
<span class="book__label" data-label aria-hidden="true">
<span class="book__line" data-line="ask">Book a consultation</span>
<span class="book__line book__line--slot" data-line="slot"><span class="book__pre" data-pre><span class="book__prein">Next</span></span><span class="book__time" data-time>Tue 10:30</span></span>
</span>
</span>
</button>
<p class="book__note" aria-live="polite">
<span class="book__noteline" data-note="ask">Halden Partners · 45 min, free</span>
<span class="book__noteline" data-note="done">Confirmed · invite sent</span>
</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.
19 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 a consultation button” from Animorio and fit it into my siteThe label and the time are split into letters, each in an inline-block span, and they sit in the same cell of a one-line grid, clipped only above and below with clip-path. The old letters rise with power2.in and a 12 millisecond stagger, the new ones come up from below with back.out and a slower stagger: you read the motion, not the swap.
The label’s width is not left to the CSS: GSAP takes it to the width of the line on show, measured in its final shape and divided by the pill’s scale, with back.out. So the pill narrows onto the time and widens back onto the sentence with a pixel of bounce.
The check’s slot is zero wide until the time is pinned, then opens on the same spring as the pill while «Next» folds to zero width. The ring draws with strokeDashoffset starting from the top (rotated by minus 90 degrees), the check goes to minus 0.9, a pixel past its end, and back to zero: that is the settle.
As the ring starts, the letters of the time drop by a pixel and a half in 90 milliseconds and come back up on an elastic, one after the other: it is the knock that says «pinned», with no flash and no extra colour.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #5b7cff | The colour of the ring around the check. |
LABEL | script.js | Book a consultation | The button’s words at rest. |
SLOT | script.js | Tue 10:30 | The first free time that rolls in. |
NOTE | script.js | Halden Partners · 45 min, free | The small line under the button. |
NOTE_DONE | script.js | Confirmed · invite sent | The line below once the time is booked. |
SPRING | script.js | 1 | How springy the pill and the check are: 0.4 calm, 2 very bouncy. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
HOLD | script.js | 2.2 | How many seconds it stays booked when the button plays by itself. |
AUTO | script.js | true | The button plays the gesture by itself until someone touches it. |
For the main button on the site of a studio, a consultant or a freelancer: it shows the first free time before the click, so booking feels like a single step.
On the phone the pill and the words take their size from the screen (clamp on the shorter side); there is no hover, so on tap the time rolls in and is pinned straight away, in the same gesture.
The words, the ring and the check swap with a fade, with no rolling letters and no springs; the pill takes its new width at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 4.9 KB; the libraries: GSAP 28 KB.
Tested on 31 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.