Skip to content
animorio
IT
All components

Coat check button

Buttons, Hover, PhysicsGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

The cloakroom button of a made-up theatre, the Vaudry Theatre: you hand in your coat before the show. On the tap, a rail opens inside the dark pill and the hanger rides past the taken hooks, swinging at every speed-up and brake like a real hanger, until it clicks onto the free brass hook. Then two halves of red velvet close over the pill like a stage curtain, the label becomes Coat checked · Hook 214 and the paper tag with the hook number drops from under the pill on a thread, swinging until it settles. Another tap collects the coat: the tag goes back up and the curtain opens again.

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>
<!--
  "Coat check 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 Check your coat button with the cloakroom tag that drops and swings</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">
    <!-- one gesture: hand in your coat. Pressed, the hanger rides the rail past the taken hooks, swinging with
         every change of speed; it clicks onto a free hook, the velvet closes over the pill like a curtain and the
         paper tag with your hook number drops out from under it and swings until it settles -->
    <div class="frame" data-wrap>
      <button class="c" type="button" data-btn aria-describedby="c-note">
        <span class="c__skin" aria-hidden="true"></span>
        <span class="c__glow" data-glow aria-hidden="true"></span>
        <span class="c__velvet c__velvet--l" data-vl aria-hidden="true"></span>
        <span class="c__velvet c__velvet--r" data-vr aria-hidden="true"></span>
        <span class="c__sheen" data-sheen aria-hidden="true"></span>
        <span class="c__rail" data-railbox aria-hidden="true">
          <span class="c__rail-line" data-railline></span>
          <svg class="c__hooks" data-hooks viewBox="0 0 400 24" preserveAspectRatio="xMinYMin meet"></svg>
          <span class="c__hanger" data-hanger>
            <svg viewBox="0 0 24 24"><path class="h__hook" d="M12 7.6V6.9c0-.8.6-1.2 1.2-1.6a1.8 1.8 0 1 0-2.9-1.4"></path><path class="h__body" d="M12 7.6 3.6 13.7c-.8.6-.4 1.8.6 1.8h15.6c1 0 1.4-1.2.6-1.8Z"></path><path class="h__bar" d="M6.4 15.5h11.2"></path></svg>
          </span>
        </span>
        <span class="c__labels" data-labels>
          <span class="c__label" data-l="idle">Check your coat</span>
          <span class="c__label" data-l="wait">Finding a hook</span>
          <span class="c__label" data-l="done">Coat checked<span class="c__sep">·</span><span class="c__num">Hook <span data-hooknum>214</span></span></span>
        </span>
      </button>

      <p class="note" id="c-note" data-note aria-live="polite">Cloakroom until 23:30 · £2 an item</p>

      <div class="drop" data-drop aria-hidden="true">
        <div class="fall" data-fall>
          <div class="swing" data-swing>
            <span class="thread"></span>
            <div class="tag">
              <span class="tag__eye"></span>
              <span class="tag__house">Vaudry Theatre</span>
              <span class="tag__no" data-tagnum>214</span>
              <span class="tag__perf"></span>
              <span class="tag__foot"><span>Cloakroom</span><span>Stalls</span></span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </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.

25 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 “Coat check 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 sits the dark Check your coat pill with a hanger drawn in line, and below it the grey line with the cloakroom hours and price. On hover a warm light follows the pointer and the hanger gives a small swing; pressed, the pill squashes slightly. On the tap the line below goes, the icon window grows on a spring into a stretch of brass rail with hooks: the taken hooks slide under the hanger, which first tips back, then rides, then tips forward as it brakes, while the label says Finding a hook. The free brass hook stops under the hanger, which drops onto it with a click. The two halves of red velvet come in from the sides and meet in the middle, the pill swells a hair, a light crosses the velvet, the label rolls to Coat checked · Hook 214 and the paper tag, with its brass eyelet, the theatre name, the big number and the perforation, drops from under the pill on its thread and swings until it stops. Brushing the pointer across the pill makes it sway. Another tap sends it back up and opens the curtain.

How it works

The rail with its hooks

The hooks are SVG paths created by the script, one every 14 pixels, in a 58-pixel window with edges faded by a mask. A power2.inOut tween moves their x until the free brass hook sits exactly under the hanger.

The hanger that feels the brake

The hanger is a damped pendulum integrated on every frame of the GSAP ticker: its acceleration is the spring towards zero, the friction and a push against the rail’s acceleration, worked out from the position differences between frames. So it tips back as it starts and forward as it brakes, with no hand-written animation.

The velvet curtain

Two velvet layers, a gradient with fine striped folds, have an inset clip-path with rounded corners: GSAP takes the open side from 100% to 49.4%, so the two halves overlap by a hair and no dark line is ever left in the middle.

The tag that comes out from under

The tag’s container starts halfway down the pill, behind it, with a clip-path that only cuts at the top: the tag, raised by 170 pixels, is invisible and drops with a back.out. The swing is a second pendulum, with a softer spring, pushed on landing and by the pointer crossing the pill.

Values to change

NameFileDefaultWhat it changes
HOOKscript.js214The free hook number, in the pill and on the tag.
WAITscript.js1.7The seconds the hanger rides the rail.
TRAVELscript.js9How many taken hooks go by before the free one.
SWAYscript.js1How much the hanger and the tag swing.
BOUNCEscript.js1.4How much the pill and the dropping tag bounce.
HOLDscript.js3.2The seconds the autopilot leaves the tag in view.
PAUSEscript.js1.6The seconds of rest before the round starts again.
--vellutostyle.css#7c1b2bThe colour of the curtain velvet.
--ottonestyle.css#c9a15aThe brass of the rail, the free hook and the eyelet.

Try them in the Playground

When to use it

In the app or site of a theatre, a concert hall or a conference, to book the cloakroom before arriving or from the phone in the foyer: the hook number stays in view like the real paper tag.

On phones

The pill drops to 56 pixels and the label tightens by a point; the finger taps like the mouse. Without hover the light stays off and the tag only swings as it lands.

With reduced motion

No sliding rail or pendulums: the label changes with a fade, the velvet fades in already closed and the tag appears still in its place; on the way back everything fades out.

Pitfalls

  • The push on the hanger’s pendulum must have the opposite sign to the rail’s acceleration: the rail moves left because the hanger moves right, and with the wrong sign it leaned forward on starting.
  • The acceleration worked out from position differences must be clamped, or the tween’s first frame gives a kick that spins the hanger past the rail.
  • The label width must be measured again after the load event: measured before the font arrived it cut the last letter of coat.
  • With reduced motion the curtain caught halfway left a dark stripe in the middle: there the velvet does not travel, it appears already closed.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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