Skip to content
animorio
IT
Back to the library

Key box check-in code

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 4.6 KBGSAP 28 KBFreeDownload the zip

The self check-in card of a holiday flat: the code of the key box is hidden behind four bars. Pressing “Reveal the code”, each digit spins like the wheel of a combination lock and stops one after the other, then a line runs out and the code hides by itself.

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>
<!--
  "Key box check-in code" 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>Self check-in code with the digits of the key box that spin like reels</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 self check-in card of a holiday flat: the code of the key box is hidden behind four bars; revealed, each
         digit spins like the wheel of a combination lock and lands, then the code hides itself again after a while -->
    <section class="kb" data-kb aria-label="Self check-in">
      <header class="kb__head">
        <span class="kb__place">Vicolo Nove, flat 2</span>
        <span class="kb__when">Check-in from 3 pm</span>
      </header>
      <p class="kb__label" id="kb-label">Key box code</p>
      <div class="kb__code" data-code role="img" aria-labelledby="kb-label" aria-live="polite"></div>
      <div class="kb__timer" aria-hidden="true"><span data-timer></span></div>
      <button class="kb__go" type="button" data-go aria-pressed="false"><span class="kb__go-text"><span data-gotext>Reveal the code</span></span></button>
      <p class="kb__foot">The box is by the green door, on the left.</p>
    </section>

    <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.

18 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 “Key box check-in code” 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 paper-coloured ground, a white card: at the top the address and the check-in time, then “Key box code” and four recessed windows with a grey bar each, a thin line, a black pill button and a line saying where the box is. Pressing the button the bars withdraw and in each window a strip of digits runs upwards, slows and stops on the right number: the first after a little more than a second, the others in turn, each with more turns. When a digit stops its window takes a knock, the edge turns green and the digit is heavier for a moment. The button turns green and says “Hide the code”, the line below runs out in four seconds and at the end the digits slide away and the bars come back.

How it works

One strip per reel

At each reveal the script builds for each window a strip of digits ending on the code’s number (the ones before count up to it), and moves it up by yPercent with power4.out: fast at first, a very long braking. Each reel has four digits and 0.28 seconds more than the previous one.

The landing

At 72% of the run the digit is practically still: there the window drops two pixels and comes back with back.out(4), and the digit’s font-weight goes from HEAVY to 640.

It does not stay on screen

Once the spin is over a line in scaleX runs out in SHOWN seconds and calls the function that hides. Screen readers also get the code only when it is revealed (aria-label kept up to date).

Values to change

NameFileDefaultWhat it changes
CODEscript.js"4071"The key box code (made up).
SPINscript.js1.1How many seconds the first reel spins (each later reel spins a little longer).
TURNSscript.js9How many digits go by before the first reel stops.
SHOWNscript.js4After how many seconds the code hides by itself.
HEAVYscript.js800The font weight of the digit just as it stops.
ACCENTscript.js#2f7d5bThe colour of the revealed code.
LOOPscript.jstrueLeft alone, a pointer reveals the code.

Try them in the Playground

When to use it

On the stay page of a holiday home or a short let, in the guest app of a hotel with no front desk, wherever a code is shown that should not stay on screen (lockers, gates, pickup codes).

On phones

The same card, as wide as the screen; the windows never exceed 19% of the height and the digits scale with them.

With reduced motion

No reels: the digits appear already still in place of the bars and disappear the same way; the time line still runs out.

Pitfalls

  • At rest the digits are not in the DOM: the code cannot be read even by inspecting the page until it is revealed (in a real product it comes from the server at that moment).
  • The hidden state is made of bars, not dots.
  • yPercent on the strip is a percentage of its own height: with n plus one digits, stopping on the last one means minus one hundred times n over n plus one.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 16 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 animations