Skip to content
animorio
IT
Back to the library

Gym locker code

Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.4 KBGSAP 28 KBFreeDownload the zip

The lockers of a gym changing room, from the phone: fifteen doors, free and taken. Tap a free one and its door swings open on its hinge with a spring, and the four-figure code rolls into place one figure after the other. “Lock” shuts it with a bounce, turns it blue with a padlock and takes one off the free count; “Release” gives it back to the others.

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>
<!--
  "Gym locker 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>Gym locker code</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 lockers of a gym changing room: pick a free one and its door swings open, the code rolls in
         figure by figure; lock it and it is yours, release it and it goes back to the others -->
    <section class="lk" data-lk aria-labelledby="lk-title">
      <header class="lk__head">
        <span class="lk__name"><b id="lk-title">Lockers</b><span>Northside Gym, changing room B</span></span>
        <span class="lk__free" aria-live="polite"><b><span data-free>7</span></b><span>free</span></span>
      </header>

      <div class="lk__grid" role="group" aria-label="Lockers">
        <button class="lk__cell is-taken" type="button" data-cell data-n="21" disabled aria-label="Locker 21, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>21</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="22" aria-pressed="false" aria-label="Locker 22, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>22</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="23" disabled aria-label="Locker 23, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>23</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="24" disabled aria-label="Locker 24, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>24</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="25" aria-pressed="false" aria-label="Locker 25, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>25</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="26" aria-pressed="false" aria-label="Locker 26, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>26</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="27" disabled aria-label="Locker 27, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>27</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="28" aria-pressed="false" aria-label="Locker 28, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>28</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="29" disabled aria-label="Locker 29, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>29</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="30" aria-pressed="false" aria-label="Locker 30, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>30</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="31" disabled aria-label="Locker 31, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>31</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="32" aria-pressed="false" aria-label="Locker 32, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>32</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell" type="button" data-cell data-n="33" aria-pressed="false" aria-label="Locker 33, free"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>33</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="34" disabled aria-label="Locker 34, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>34</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
        <button class="lk__cell is-taken" type="button" data-cell data-n="35" disabled aria-label="Locker 35, taken"><span class="lk__in" aria-hidden="true"></span><span class="lk__door" data-door aria-hidden="true"><i class="lk__vents"></i><b>35</b><svg class="lk__lock" viewBox="0 0 16 16"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><i class="lk__handle"></i></span></button>
      </div>

      <div class="lk__panel">
        <span class="lk__what"><b class="lk__roll"><span data-what>Pick a free locker</span></b><span class="lk__roll lk__roll--sub"><span data-sub>The code shows up here</span></span></span>
        <span class="lk__code" data-code aria-hidden="true"><i><b></b></i><i><b></b></i><i><b></b></i><i><b></b></i></span>
      </div>

      <button class="lk__go" type="button" data-go disabled><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.200 7.200V5.600a2.800 2.800 0 0 1 5.600 0v1.600M4.300 7.200h7.400a.9.9 0 0 1 .9.9v4a.9.9 0 0 1-.9.9H4.300a.9.9 0 0 1-.9-.9v-4a.9.9 0 0 1 .9-.9Z"></path></svg><span class="lk__gotext"><span data-golabel>Lock</span></span></button>
      <span class="lk__live" aria-live="polite" data-live></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

34 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Gym locker 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 cream, a light card: “Lockers”, “Northside Gym, changing room B” and on the right “7 free”. Below, set in, a grid of fifteen doors in five columns, each with its number, the air slots at the top and the handle: taken ones are darker, with a faded number and a small padlock. Below again, “Pick a free locker” and four empty boxes for the code, then the “Lock” button, off. Tap door 25 and it opens turning on its left hinge, with a spring, showing the dark inside; the edge and the number turn blue, the label rolls to “Locker 25” and in the boxes the four figures drop in and spin, one after the other, until they stop with a small settle. Pick another and the first one shuts with a bounce. “Lock locker 30” closes the door, which turns solid blue with a white padlock; the free count rolls to 6 and the button becomes “Release locker 30”, which frees it and clears the code.

How it works

The state

Two things: the locker picked and whether it is locked. One function works out the doors’ classes, the free count, the labels and the button; the door and the code move only when they change.

The door

Inside each button are the dark interior and, on top, the door: GSAP gives it rotationY with transformPerspective and the origin on the left edge. It opens on an elastic spring and shuts with a bounce.

The code

Each figure starts a few numbers before its own: a tween takes a counter up to it and writes the passing figure on every frame, with a delay growing from left to right.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f6bffThe colour of the locker picked, of the code and of the locked one.
SWINGscript.js44How many degrees the door opens.
ROLLscript.js0.5How long each figure of the code takes to roll.

Try them in the Playground

When to use it

In the app of a gym, a pool, a spa or a coworking space with code lockers; and for luggage storage, pickup points and wherever a spot is chosen from a grid and a code is handed out.

On phones

The same card, as wide as the screen minus the margins: five columns of doors about 54 pixels wide and 42 tall, the code to the right of the label. The card is about 330 pixels tall and fits whole in the phone box.

With reduced motion

No springs and no spinning figures: the door is open or shut at once, the code appears already written, labels and the free count change without rolling. The demo’s pointer does not start.

Pitfalls

  • Gym, numbers and codes are made up, and the code comes from the locker’s number only for the demo: on a real site the server hands it out, it belongs to one person and should not be read aloud to a screen reader in public without asking.
  • Free and taken are not told by colour alone: taken ones have the padlock, are disabled and say so in their label.
  • The open door turns in 3D inside a small button: with SWING too high it leaves its cell and covers its neighbour.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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