
The elastic button
Buttons, Hover, Text
The bedside panel of a hotel suite: two touch keys under smoked glass, Do not disturb and Make up room. A single light lives under the glass: touching a key it slides over on a spring, stretches as it travels, warms to amber for Do not disturb or cools to ice for Make up room, flares for an instant under the finger and lights the edge of the glass only where it rests. Touching the lit key again turns the sign off; the line underneath says what housekeeping will do and the small door tag what the corridor reads.
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>
<!--
"Do not disturb room switch" 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 do not disturb switch with the light under the glass</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 bedside panel of a hotel suite: two capacitive keys under smoked glass, Do not disturb and Make up room.
A light lives under the glass: it slides on a spring to the key you touch, stretches while it travels, warms
to amber for Do not disturb and cools to ice for Make up room, and lights the edge of the glass where it sits.
Touching the lit key again turns the sign off. -->
<section class="panel" data-panel aria-label="Door sign, Suite 412">
<header class="panel__head">
<span class="panel__room">Suite 412</span>
<span class="panel__hotel">Halvard Hotel</span>
</header>
<div class="pad" data-pad>
<span class="pad__grain" aria-hidden="true"></span>
<span class="glow" data-glow aria-hidden="true">
<span class="glow__bloom" data-bloom></span>
<span class="glow__strip" data-strip></span>
</span>
<span class="pad__edge" aria-hidden="true"></span>
<span class="pad__sheen" aria-hidden="true"></span>
<span class="pad__seam" aria-hidden="true"></span>
<button class="key" type="button" aria-pressed="false" data-key="dnd">
<span class="key__face" data-face>
<svg class="key__icon" viewBox="0 0 20 20" aria-hidden="true">
<path class="key__moon" d="M15.6 12.4A6.4 6.4 0 0 1 7.6 4.4a6.4 6.4 0 1 0 8 8z"/>
</svg>
<span class="key__label">Do not disturb</span>
</span>
</button>
<button class="key" type="button" aria-pressed="false" data-key="mur" data-autoclic>
<span class="key__face" data-face>
<svg class="key__icon" viewBox="0 0 20 20" aria-hidden="true">
<path d="M9 3.2c.45 3 1.8 4.35 4.8 4.8-3 .45-4.35 1.8-4.8 4.8-.45-3-1.8-4.35-4.8-4.8 3-.45 4.35-1.8 4.8-4.8z"/>
<path d="M14.6 12.2c.2 1.25.75 1.8 2 2-1.25.2-1.8.75-2 2-.2-1.25-.75-1.8-2-2 1.25-.2 1.8-.75 2-2z"/>
</svg>
<span class="key__label">Make up room</span>
</span>
</button>
</div>
<footer class="panel__foot">
<span class="status" data-status><span class="status__line" data-line>Housekeeping 10:00 to 14:00</span></span>
<span class="panel__door" data-door>
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 14V2.6h7.2V14M2.6 14h10.8M9 8.4h.01"/></svg>
<span data-doorword>Off</span>
</span>
</footer>
</section>
<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>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
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 “Do not disturb room switch” from Animorio and fit it into my siteThe plate is a two column grid with hidden overflow and isolation: underneath sits the light (a single element with the haze and the LED strip), above it an SVG feTurbulence grain in overlay blending, the reflection following the pointer, the thin line between the keys and the real keys, which are buttons with aria-pressed.
The light's position is not a tween: it is a spring integrated by hand on the GSAP ticker, stiffness 210 and damping 21, in two steps per frame with the step capped at a thirtieth of a second. So it passes the key by a pixel and settles, and touching the other key halfway it starts from the speed it has. When it is still the loop leaves the ticker.
The light is two thirds of a key wide, plus a share that grows with the spring's speed (up to 50% more): still it is an oval, travelling a streak. The colour is one number between 0 and 1 that GSAP takes from amber to ice, mixed by hand in the three channels and passed to the CSS as --lr, --lg, --lb.
The edge of the glass is a one pixel ring cut by two masks in exclusion (content-box against the whole box), filled with a radial gradient centred on the light's x (--lx): it lights up only along the stretch under the light and follows it. The panel's shadow takes a haze of the light's colour too, at a third of the strength.
On a touch a timeline takes the flare to 1 in 0.1 s and back to zero in 0.9 s, the key sinks to 95.5% and returns with elastic.out, and a thin ring spreads from the exact point of the finger. The line underneath is replaced by a new one coming in from below with back.out while the old one leaves at the top. Touching the lit key again sets the state back to Off and the intensity drops to zero.
| Name | File | Default | What it changes |
|---|---|---|---|
STIFFNESS | script.js | 210 | The spring carrying the light from key to key: higher is quicker. |
DAMPING | script.js | 21 | Lower lets the light pass the key and come back. |
STRETCH | script.js | 0.5 | How much the light stretches while it travels. |
GLOW | script.js | 1 | How bright the light under the glass is. |
FLASH | script.js | 0.45 | How much the light flares under the finger. |
SPEED | script.js | 1 | 2 = the walk on its own twice as fast, 0.5 = half. |
LOOP | script.js | true | Goes through the three states again on its own. |
For the app or site of a hotel, a holiday home or a serviced apartment: the room panel where the guest asks not to be disturbed or to have the room made up. It also suits a smart home app or any choice between two states that can also be switched off.
The same panel with adapted sizes: it is as wide as the box allows, the glass gets shorter with the screen's height, the keys work with a finger and the ring starts from the point of the touch.
The light does not travel: it fades out, moves under the chosen key and fades back in; no ring, no key giving way, the line underneath changes with a fade.
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 1 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.