
The elastic button
Buttons, Hover, Text
The Share room key button in a made-up hotel app, Velde: a dark pill with the digital key drawn in line, the contactless waves in brass and the room number. Pressed, the pill widens on a spring and shows the guest the key goes to; the card of room 412 rises out of the button, dark, with a brass edge, the chip and a holographic glint crossing it. Beside it the copy prints itself: first a dashed outline that marches, then the full card; the copy flies in an arc into the guest’s circle, shrinking, the circle takes the hit, its brass ring closes and a green check appears. The real key sinks back into the button and the line says until when the guest can open the door.
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>
<!--
"Share room key 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 Share room key button with the copy of the key flying to the guest</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">
<!-- the Share room key button of a made-up hotel app, Velde: pressed, the pill widens, the digital key card of room 412
rises out of the button, a copy of it prints itself beside it and flies in an arc into the avatar of the second
guest, whose ring closes; the original key sinks back and the pill says until when the guest can open the door -->
<div class="wrap" data-wrap>
<!-- the slot: its bottom edge is the middle of the pill, so the key really comes out of the button -->
<div class="slot" aria-hidden="true">
<div class="card" data-card>
<span class="card__holo" data-holo></span>
<span class="card__brand">Velde</span>
<svg class="card__nfc" viewBox="0 0 24 24"><path d="M8.6 8.4a5 5 0 0 1 0 7.2"></path><path d="M11.8 6a8.4 8.4 0 0 1 0 12"></path><path d="M15 3.8a11.6 11.6 0 0 1 0 16.4"></path></svg>
<span class="card__room"><i>Room</i><b>412</b></span>
<span class="card__chip"></span>
</div>
</div>
<!-- the copy: it lives over the pill so it can fly into the avatar -->
<div class="card card--copy" data-copy aria-hidden="true">
<span class="card__fill" data-copyfill>
<span class="card__holo"></span>
<span class="card__brand">Velde</span>
<svg class="card__nfc" viewBox="0 0 24 24"><path d="M8.6 8.4a5 5 0 0 1 0 7.2"></path><path d="M11.8 6a8.4 8.4 0 0 1 0 12"></path><path d="M15 3.8a11.6 11.6 0 0 1 0 16.4"></path></svg>
<span class="card__room"><i>Room</i><b>412</b></span>
<span class="card__chip"></span>
</span>
<svg class="card__dash" viewBox="0 0 100 62" preserveAspectRatio="none"><rect data-dash x="1" y="1" width="98" height="60" rx="9" ry="9"></rect></svg>
</div>
<div class="pill" data-pill>
<span class="pill__halo" aria-hidden="true"></span>
<div class="pill__clip">
<span class="pill__grain" aria-hidden="true"></span>
<span class="pill__sheen" data-sheen aria-hidden="true"></span>
<button class="share" type="button" data-share data-autoclic aria-label="Share the key of room 412 with Lena">
<span class="share__in" data-sharein>
<svg class="key" viewBox="0 0 28 24" aria-hidden="true">
<rect x="2.6" y="5" width="17.4" height="13.6" rx="2.6"></rect>
<path class="key__chip" d="M6 9.6h3.6v3.4H6z"></path>
<path class="key__wave" data-wave d="M22.2 9.2a4 4 0 0 1 0 5.2"></path>
<path class="key__wave" data-wave d="M24.8 7.2a7.2 7.2 0 0 1 0 9.2"></path>
</svg>
<span class="share__word" data-word>Share room key</span>
<span class="share__room">412</span>
</span>
</button>
<div class="state" data-state aria-hidden="true">
<span class="guest" data-guest>
<svg class="guest__ring" viewBox="0 0 44 44"><circle data-ring cx="22" cy="22" r="20"></circle></svg>
<span class="guest__face">LM</span>
<span class="guest__badge" data-badge><svg viewBox="0 0 16 16"><path data-tick d="M4.2 8.4 6.8 11 11.8 5.4"></path></svg></span>
</span>
<span class="lines">
<span class="lines__a"><span data-linea>Sending to Lena</span></span>
<span class="lines__b"><span data-lineb>Room 412 · Velde Amsterdam</span></span>
</span>
</div>
</div>
<span class="pill__edge" aria-hidden="true"></span>
</div>
<p class="sr" data-live aria-live="polite"></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.
29 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 “Share room key button” from Animorio and fit it into my siteThe card lives in a slot behind the pill with hidden overflow and its bottom edge at the middle of the pill: rising, it seems to come out of the button. It rises with back.out, straightens and settles; a holographic glint crosses it by animating a CSS variable.
The copy is a second element over the pill, placed with getBoundingClientRect on the real card: first only a dashed SVG outline that marches (stroke-dashoffset), then the fill appearing.
GSAP keyframes take the copy from where it is to a high point halfway and then to the centre of the guest’s circle, shrinking and turning; on arrival the circle swells with elastic.out and the ring closes with stroke-dashoffset.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL | script.js | Share room key | The label of the closed button. |
ROOM | script.js | 412 | The room number, on the button and on the key. |
GUEST | script.js | Lena | The name of the guest receiving the copy. |
INITIALS | script.js | LM | The initials in the guest’s circle. |
UNTIL | script.js | until Sun, 11:00 | Until when the copy opens the door. |
BRASS | script.js | #d8bd86 | The hotel’s brass: the key edge, the ring, the number. |
FLIGHT | script.js | 0.9 | The seconds of the copy’s flight to the guest. |
SPRING | script.js | 0.8 | How long the spring widening the pill lasts. |
HOLD | script.js | 2.4 | The seconds of the message before going back to rest. |
In the app of a hotel, a holiday rental or a hostel, where whoever booked gives the digital key to whoever travels with them; also in coworking and gym apps to give a guest access.
The open pill narrows to the screen width minus thirty-two pixels and the guest line gets slightly smaller; the finger presses like the mouse. Without hover the light stays off and the contactless waves still.
No springs, flight or glints: the pill changes width in a moment, the guest’s circle fades in with the ring already closed and the check, and the line says Key sent at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.7 KB; the libraries: GSAP 28 KB.
Tested on 14 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.