
The layered button
Buttons, Hover, Physics
The bedroom humidifier card of a smart home app, dark on black, like a Dribbble shot: the ruler under the big number is the slider. Dragging it the thumb follows on a spring, the nearby ticks rise as if under a lens, the digits roll, the word goes from Dry air to Comfortable to Too damp, and behind the words a mist drawn on canvas thickens or thins with the value, from a few wisps to a soft bank of fog. Letting go, the thumb snaps to the whole number and the humidifier answers with a puff of mist from the bottom of the card.
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>
<!--
"Humidity slider" 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 humidity slider with the mist that thickens</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" data-stage>
<!-- the bedroom humidifier card of a premium smart home app. Behind the words a canvas draws the mist the
humidifier would make: thin at 30%, a soft bank of fog at 70%. The ruler under the number is the slider:
the ticks near the thumb rise like a magnifier, the thumb follows the finger on a spring -->
<article class="humid" data-card aria-label="Bedroom humidifier">
<canvas class="humid__mist" data-mist aria-hidden="true"></canvas>
<span class="humid__sheen" data-sheen aria-hidden="true"></span>
<header class="humid__head">
<span class="humid__icon" aria-hidden="true">
<svg viewBox="0 0 20 20"><path d="M10 2.6c2.9 3.4 5.2 6.3 5.2 9.1a5.2 5.2 0 0 1-10.4 0c0-2.8 2.3-5.7 5.2-9.1z"/><path class="humid__icon-wave" d="M7.4 12.4c.9.7 1.7.7 2.6 0s1.7-.7 2.6 0"/></svg>
</span>
<span class="humid__who">
<span class="humid__room">Bedroom</span>
<span class="humid__device">Brume Mist One</span>
</span>
<span class="humid__chip">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10.6 2.4a5.8 5.8 0 1 0 3 9.6 5 5 0 0 1-3-9.6z"/></svg>
Night
</span>
</header>
<div class="humid__read">
<p class="humid__value" aria-hidden="true">
<span class="humid__digits" data-digits></span><span class="humid__pct">%</span>
</p>
<div class="humid__side">
<span class="humid__state" data-state>Comfortable</span>
<span class="humid__now">Room now <b data-room>36%</b></span>
</div>
</div>
<div class="humid__slider" data-slider role="slider" tabindex="0" aria-label="Target humidity"
aria-valuemin="30" aria-valuemax="70" aria-valuenow="48" aria-valuetext="48 percent, comfortable">
<span class="humid__band" data-band aria-hidden="true"><span>Comfort</span></span>
<span class="humid__ticks" data-ticks aria-hidden="true"></span>
<span class="humid__thumb" data-thumb aria-hidden="true"><span class="humid__thumb-core"></span></span>
<span class="humid__ends" aria-hidden="true"><span>30</span><span>70</span></span>
</div>
<footer class="humid__foot">
<span class="humid__stat"><span class="humid__label">Reaches target</span><b data-eta>in 13 min</b></span>
<span class="humid__stat"><span class="humid__label">Tank lasts</span><b data-tank>7 h 50 m</b></span>
</footer>
</article>
<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.
33 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 “Humidity slider” from Animorio and fit it into my siteForty-one ticks, one for every point from 30 to 70, 7 pixels tall and 13 every five, tinted teal inside the comfort range. Their container has role slider, aria-valuenow and aria-valuetext, is taken with the pointer (setPointerCapture) and moves with the arrows, Page Up and Down, Home and End.
The thumb's value chases the finger's with a spring integrated by hand, stiffness 260 and damping 21, in two steps per frame with the time step capped at 1/30 of a second: it passes the mark by a breath and settles. Past the ends the finger counts for only 18%, like a rubber band; on release the goal rounds to the whole number.
Every frame each tick grows by a gaussian of its distance from the thumb (sigma 2.3 points), stronger while it is held; scaleY and opacity are written only when they really change, so at rest nothing is touched.
A single radial gradient sprite, drawn once, is stamped 44 times squashed into ovals, in lighter mode, with an alpha that rises and falls with the sine of each wisp's life. The density follows the value with an exponential lag; the height the wisps rise to and the band at the bottom grow with it, and the puff after a release speeds up the rise and adds light.
The two digits are columns of ten sliding with yPercent and a back.out; the word, the card's tone (a CSS variable) and the two figures at the bottom change when the whole number changes. The light on the edge is a radial gradient masked onto the edge's pixel that follows the pointer, or the thumb when the card runs on its own.
| Name | File | Default | What it changes |
|---|---|---|---|
TARGET | script.js | 48 | The target humidity the card starts and rests on, from 30 to 70. |
ROOM | script.js | 36 | The humidity the room has now, in percent. |
COMFORT_LOW | script.js | 40 | Where the comfortable range starts. |
COMFORT_HIGH | script.js | 60 | Where the comfortable range ends. |
MIST | script.js | 1 | How thick the mist gets: 0 none, 2 twice as dense. |
MAGNIFY | script.js | 13 | How many pixels the ticks near the thumb rise. |
STIFFNESS | script.js | 260 | The spring pulling the thumb to the finger: higher is quicker. |
DAMPING | script.js | 21 | Lower lets the thumb pass the mark and come back. |
SPEED | script.js | 1 | 2 = the walk on its own twice as fast, 0.5 = half. |
LOOP | script.js | true | Repeats the walk on its own. |
In a smart home app or a connected appliance's app (humidifier, purifier, air conditioner), in the wellness panel of a hotel room, in a sleep app: anywhere a value is chosen on a scale and its meaning should show at once.
The same card with adapted sizes: at most 86% of the screen wide, gaps and number sized on the height too (clamp with vh), the ticks rearrange at every resize and the mist canvas is redrawn as big as the card. With a finger the ruler drags without scrolling the page.
No spring, no following lens, no rising mist: the thumb moves straight to the value, the digits change without rolling and the mist is a still image that thickens or thins with a fade; on its own the card shows 34, 66 and 48 one after the other.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.8 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.