Skip to content
animorio
IT
All components

Digital room key button

Buttons, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 8.7 KBGSAP 28 KBFreeDownload the zip

The digital key button in a hotel app, made of smoked glass on a warm black, like a Dribbble shot: on the left a padlock inside a champagne metal well, then Unlock Room 412 with the hotel and the floor underneath, on the right the contactless sign. On hover a soft light follows the pointer and the sheen on the metal rim turns towards it. Tapped, a ring of light closes around the padlock while the phone talks to the door; then the shackle springs up and opens, an amber light spreads through the glass from the lock like the light of a door left ajar, and the ring drains as the seconds roll down until the door locks again with a click.

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>
<!--
  "Digital 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 digital room key button that unlocks the door</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 digital key of a hotel app: a pill of smoked glass with a champagne metal lock on the left. Tapped, a ring
         of light closes around the lock while the phone talks to the door, then the shackle springs open, a warm
         light spreads through the glass from the lock like the light of a door left ajar, and the ring drains as the
         seconds count down to the relock. At zero the shackle snaps shut and the light goes back into the lock -->
    <div class="rk" data-wrap>
      <span class="rk__spill" data-spill aria-hidden="true"></span>
      <button class="rk__btn" type="button" data-btn data-autoclic aria-label="Unlock room 412">
        <span class="rk__glass" data-glass>
          <span class="rk__base" aria-hidden="true"></span>
          <span class="rk__door" aria-hidden="true"><span class="rk__door-light" data-door></span><span class="rk__door-edge" data-edge></span></span>
          <span class="rk__shine" data-shine aria-hidden="true"></span>
          <span class="rk__frost" aria-hidden="true"></span>
          <span class="rk__rim" data-rim aria-hidden="true"></span>
          <span class="rk__row">
            <span class="rk__well" aria-hidden="true">
              <svg class="rk__ring" viewBox="0 0 58 58">
                <defs>
                  <linearGradient id="rk-grad" x1="0" y1="0" x2="1" y2="1">
                    <stop offset="0" stop-color="var(--amber)"/>
                    <stop offset="1" stop-color="var(--brass)"/>
                  </linearGradient>
                </defs>
                <circle class="rk__ring-track" cx="29" cy="29" r="26.5"/>
                <circle class="rk__ring-glow" data-ring-glow cx="29" cy="29" r="26.5" pathLength="1" transform="rotate(-90 29 29)"/>
                <circle class="rk__ring-line" data-ring cx="29" cy="29" r="26.5" pathLength="1" transform="rotate(-90 29 29)"/>
              </svg>
              <span class="rk__metal" data-metal>
                <span class="rk__face" data-face>
                  <svg class="rk__lock" viewBox="0 0 24 24">
                    <path class="rk__shackle" data-shackle d="M8.4 11.2V8.4a3.6 3.6 0 0 1 7.2 0v2.8"/>
                    <path class="rk__shackle rk__shackle--open" data-shackle-open d="M8.4 11.2V5.9a3.6 3.6 0 0 1 7.2 0"/>
                    <g data-body>
                      <rect class="rk__body" x="5.6" y="10.6" width="12.8" height="9.6" rx="2.4"/>
                      <rect class="rk__body-hi" x="6.4" y="11.3" width="11.2" height="1" rx="0.5"/>
                      <path class="rk__hole" d="M12 13.9a1.35 1.35 0 0 1 .7 2.5v1.5h-1.4v-1.5a1.35 1.35 0 0 1 .7-2.5z"/>
                    </g>
                  </svg>
                </span>
              </span>
            </span>
            <span class="rk__words">
              <span class="rk__stack" aria-hidden="true">
                <span class="rk__label" data-label>Unlock Room 412</span>
                <span class="rk__label" data-label>Connecting</span>
                <span class="rk__label rk__label--open" data-label>Door open</span>
              </span>
              <span class="rk__stack" aria-hidden="true">
                <span class="rk__sub" data-sub>Aurelia Hotel · Floor 4</span>
                <span class="rk__sub" data-sub>Hold near the lock</span>
                <span class="rk__sub" data-sub>Relocks in <span class="rk__count" data-count><span class="rk__digit" data-digit>5</span></span>s</span>
              </span>
            </span>
            <span class="rk__nfc" aria-hidden="true">
              <svg viewBox="0 0 24 24">
                <path class="rk__arc" data-arc d="M6.6 9.4a3.6 3.6 0 0 1 0 5.2"/>
                <path class="rk__arc" data-arc d="M9.8 6.8a7.3 7.3 0 0 1 0 10.4"/>
                <path class="rk__arc" data-arc d="M13 4.2a11 11 0 0 1 0 15.6"/>
              </svg>
            </span>
          </span>
        </span>
      </button>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

22 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 “Digital 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 warm black with a very fine grain and a faint champagne haze, alone in the middle, there is a pill button 60 pixels tall made of smoked glass: the top edge catches the light in one pixel, the bottom one stays in shadow and under the button the floor warms a little. On the left there is a round well with a polished champagne metal rim, with a sheen that turns like on a real ring, and inside a dark face with the brass padlock; then the words Unlock Room 412, in small type underneath Aurelia Hotel · Floor 4, and on the right the three arcs of the contactless sign. With the mouse over it, a soft light follows the pointer inside the glass, the sheen of the metal turns towards it and the arcs brighten one after the other. Pressed, the glass sinks by a pixel and narrows a little, the well narrows a little more, and on release they spring back. Then the words become Connecting with Hold near the lock underneath, the sheen of the metal goes all the way round, the arcs light up in waves from the smallest to the largest and around the well a ring of light from amber to brass closes clockwise. When the ring is full the shackle springs up and tilts open with a small bounce, the body of the padlock gives by a pixel and settles, the well and the glass swell by a hair and from the left an amber light spreads through the whole glass, led by a brighter line running to the right, like the light of a door opening; the edge of the glass also turns amber near the lock, the arcs turn amber and the glow on the floor warms. The words become Door open with Relocks in 5s underneath: every second the old digit rolls up and away and the new one comes from below, the ring drains clockwise and the light cools a little. At zero the shackle drops and shuts with a click, the padlock and the glass shiver by a pixel, the light goes back into the lock and the button is Unlock Room 412 again. Until someone touches it, the button goes round by itself.

How it works

The glass in layers

The button is a single box moved only by GSAP; inside, absolute layers with overflow hidden and the same radius: a warm dark base, the door light, the light under the pointer (a radial-gradient on two CSS variables moved by gsap.quickTo), a pane with a feTurbulence grain and three inner shadows for the one pixel edge, and on top an amber edge with a mask-image that makes it stronger near the lock.

The turning metal

The rim of the well is a conic-gradient with seven stops from shadow to highlight, starting from a --ang variable: on hover a quickTo turns it towards the pointer, while connecting a tween spins it 360 degrees in a loop, so it looks like a real metal ring catching the light.

The ring with pathLength

Two SVG circles with pathLength 1 and stroke-dasharray 1, a thin one and a wider blurred one for the glow: strokeDashoffset from 1 to 0 fills it clockwise while the phone connects, from 0 to minus 1 drains it, still clockwise, during the countdown, tied to the same timeline as the seconds.

The padlock that springs

The shackle rises 3.4 units in 0.16 seconds and tilts by minus 16 degrees around its left leg (svgOrigin) with a back.out; the body gives by 0.9 and comes back on an elastic spring. On closing the opposite with power4.in, then the body takes the blow and the glass shivers by a pixel with elastic.out: that is the click.

The door light and the seconds

The light is a layer with its transform-origin on the lock going from scaleX 0 to 1 with power3.out, while a brighter blurred line runs in x to the right edge and fades. The countdown is a linear tween of a number: when the whole number changes, the old digit leaves with yPercent minus 100 and a new one arrives from 100 with a back.out.

Values to change

NameFileDefaultWhat it changes
ROOMscript.jsRoom 412The room written on the button.
PLACEscript.jsAurelia Hotel · Floor 4The small line underneath.
CONNECTscript.js1.4How many seconds the phone takes to talk to the door.
RELOCKscript.js5How many seconds the door stays open before it locks again.
WARMTHscript.js1How strong the warm light of the open door is.
SPRINGscript.js1How springy the press and the shackle are: 0.4 calm, 2 very bouncy.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For the digital key in the app of a hotel, a vacation rental or a serviced apartment: the button that opens the room door from the phone, with the state of the connection and the time before it locks again told inside the button itself. It also works for a gate, a locker or a garage that opens from the app.

On phones

On the phone the button is at most 86% of the screen wide and the rest is the same; there is no hover, so the light under the finger turns on at the touch.

With reduced motion

Nothing moves: the ring fills and drains without movement, the open and the closed shackle swap with a fade, the door light fades in and out, the words and the digits change in place.

Pitfalls

  • The countdown compared the new digit with the counter’s first child, which during the change was still the old digit: on every frame another one was born and they piled up. Now the shown digit lives in a variable and changes only when the whole number really changes.
  • With stroke-linecap round and strokeDashoffset 1 the empty ring left a dot at the top of the well at rest: the ring is hidden with opacity when empty and turns on only when connecting starts.
  • A ring tight on the metal rim blended into the metal itself and the countdown could not be read: the ring has a radius of 26.5 on a well of 22, with three and a half pixels of dark space between them.
  • GSAP does not interpolate a CSS variable as a stroke colour: amber and ink are read from :root with getComputedStyle and the arcs move between two real colours.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.7 KB; the libraries: GSAP 28 KB.

Testing

Tested on 2 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