
The layered button
Buttons, Hover, Physics
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.
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>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
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 siteThe 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 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.
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’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.
| Name | File | Default | What it changes |
|---|---|---|---|
HOOK | script.js | 214 | The free hook number, in the pill and on the tag. |
WAIT | script.js | 1.7 | The seconds the hanger rides the rail. |
TRAVEL | script.js | 9 | How many taken hooks go by before the free one. |
SWAY | script.js | 1 | How much the hanger and the tag swing. |
BOUNCE | script.js | 1.4 | How much the pill and the dropping tag bounce. |
HOLD | script.js | 3.2 | The seconds the autopilot leaves the tag in view. |
PAUSE | script.js | 1.6 | The seconds of rest before the round starts again. |
--velluto | style.css | #7c1b2b | The colour of the curtain velvet. |
--ottone | style.css | #c9a15a | The brass of the rail, the free hook and the eyelet. |
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.
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.
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.
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.
Tested on 15 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.