Skip to content
animorio
IT
All components

Share room key button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.7 KBGSAP 28 KBFreeDownload the zip

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.

The code

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>

Playground

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

Or ask your AI assistant for it

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 site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a white ground there is only a dark pill sixty pixels tall, its body shading from grey to near black, a very fine grain, a one-pixel edge catching light at the top and soft layered shadows with a brass glint: inside, the digital key drawn in line, Share room key and the number 412 in a brass tag. On hover the pill rises by a pixel, a warm light follows the pointer and the two contactless waves pulse gently. Pressed, it squeezes and widens on a spring; the room card comes out of the button, its dashed copy fills in and flies into the guest’s circle, whose ring closes with the check; then everything returns to rest.

How it works

The key comes out of the button

The 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 prints itself

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.

The flight in an arc

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.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsShare room keyThe label of the closed button.
ROOMscript.js412The room number, on the button and on the key.
GUESTscript.jsLenaThe name of the guest receiving the copy.
INITIALSscript.jsLMThe initials in the guest’s circle.
UNTILscript.jsuntil Sun, 11:00Until when the copy opens the door.
BRASSscript.js#d8bd86The hotel’s brass: the key edge, the ring, the number.
FLIGHTscript.js0.9The seconds of the copy’s flight to the guest.
SPRINGscript.js0.8How long the spring widening the pill lasts.
HOLDscript.js2.4The seconds of the message before going back to rest.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The copy flies over the pill, so it cannot live in the hidden-overflow slot the card comes out of: it is a separate element, placed on the real card with getBoundingClientRect at the right moment.
  • Later fromTo tweens in the timeline need immediateRender: false, otherwise the message lines disappear at once.

Libraries

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.

Testing

Tested on 14 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All components