
Swatch fan menu
Menus, Physics, Transitions, Hover
The living room scenes widget of an invented smart home app, Halvo Home: Morning, Focus, Movie and Night under a frosted glass lens. Tap a scene or drag the lens with a finger: it runs on a real spring, stretches with its speed and a light the colour of the scene rides under the glass. The room light changes colour temperature, the Kelvin reading and the brightness count to the new values, the marker slides along the warm to cool scale and the scene icon comes alive.
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>
<!--
"Home scene selector" 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 smart home lights scene selector with the glass lens and the light that changes temperature</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 scene widget of an invented smart home app: four scenes under a frosted glass lens; the light of the
room changes colour temperature, the Kelvin reading and the brightness count to the new scene -->
<section class="scenes" data-scenes aria-labelledby="sc-room">
<span class="scenes__light" aria-hidden="true"></span>
<span class="scenes__wash" aria-hidden="true" data-wash></span>
<span class="scenes__edge" aria-hidden="true"></span>
<header class="scenes__head">
<div class="scenes__now">
<span class="scenes__room" id="sc-room">Living room</span>
<span class="scenes__name" aria-live="polite"><span class="scenes__word" data-word>Morning</span><span class="scenes__word" data-word aria-hidden="true"></span></span>
<span class="scenes__meta">4 lights <span class="scenes__sep">·</span> <span class="scenes__num" data-bright>70</span>%</span>
</div>
<div class="warmth" aria-label="Colour temperature">
<span class="warmth__value"><span class="scenes__num" data-kelvin>3000</span> K</span>
<span class="warmth__bar" aria-hidden="true"><span class="warmth__mark" data-mark></span></span>
<span class="warmth__ends" aria-hidden="true"><span>Warm</span><span>Cool</span></span>
</div>
</header>
<div class="track" role="radiogroup" aria-label="Scene" data-track>
<span class="track__glow" aria-hidden="true" data-glow></span>
<span class="lens" aria-hidden="true" data-lens><span class="lens__body" data-lens-body><span class="lens__shine"></span></span></span>
<button class="seg" type="button" role="radio" aria-checked="true" data-seg>
<svg class="seg__icon" viewBox="0 0 24 24" aria-hidden="true"><g class="ic ic--morning"><path class="ic__ray" d="M12 4.2v1.6M6.3 6.6l1.1 1.1M17.7 6.6l-1.1 1.1M3.6 12.2h1.6M18.8 12.2h1.6"/><path class="ic__sun" d="M7.6 15.4a4.4 4.4 0 0 1 8.8 0"/><path d="M3.4 15.4h17.2M7 18.6h10"/></g></svg>
<span class="seg__label">Morning</span>
</button>
<button class="seg" type="button" role="radio" aria-checked="false" tabindex="-1" data-seg>
<svg class="seg__icon" viewBox="0 0 24 24" aria-hidden="true"><g class="ic ic--focus"><circle class="ic__ring" cx="12" cy="12" r="7.4" stroke-dasharray="3.2 2.6"/><circle class="ic__core" cx="12" cy="12" r="2.6"/></g></svg>
<span class="seg__label">Focus</span>
</button>
<button class="seg" type="button" role="radio" aria-checked="false" tabindex="-1" data-seg>
<svg class="seg__icon" viewBox="0 0 24 24" aria-hidden="true"><g class="ic ic--movie"><rect x="3.4" y="5.4" width="17.2" height="11.6" rx="2.6"/><path d="M9 20h6"/><path class="ic__play" d="M10.6 8.9l3.9 2.3-3.9 2.3z"/></g></svg>
<span class="seg__label">Movie</span>
</button>
<button class="seg" type="button" role="radio" aria-checked="false" tabindex="-1" data-seg>
<svg class="seg__icon" viewBox="0 0 24 24" aria-hidden="true"><g class="ic ic--night"><path class="ic__moon" d="M17.6 14.6A6.8 6.8 0 0 1 9.4 6.4a6.8 6.8 0 1 0 8.2 8.2z"/><path class="ic__star" d="M17 4.2l.6 1.6 1.6.6-1.6.6-.6 1.6-.6-1.6-1.6-.6 1.6-.6z"/></g></svg>
<span class="seg__label">Night</span>
</button>
</div>
</section>
<svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></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>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.
32 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 “Home scene selector” from Animorio and fit it into my siteThe lens position is a spring integrated every frame with requestAnimationFrame: velocity grows with (target minus position) times STIFFNESS and drops with DAMPING, with the time step capped at 1/30 of a second. With 420 and 30 the spring is a little under critical damping, so it overshoots by one pixel and comes back. When velocity and distance are nearly zero the loop stops and draws nothing more.
The outer lens moves with translateX, the glass inside deforms: scaleX grows with speed times STRETCH (up to 24%) and scaleY drops by a little less than half of that, so the volume seems the same. The highlight inside the glass is a CSS variable that moves against the motion. Pressed, the lens sinks to 95% and comes back with elastic.out.
Behind the lens an ellipse the colour of the scene, blurred by 14 pixels, follows it; the glass has backdrop-filter with blur and saturate, so the colour shows through. The room halo, the edge and the lens shadow all use the --tint variable, which GSAP moves from one colour to the next; --glow dims the halo with the brightness of the scene.
On the track a pointerdown captures the pointer; past 4 pixels of movement it becomes a drag and the spring target follows the finger with a higher stiffness. Every frame the scene is the one closest to the lens, so it changes as the lens passes. On release the lens goes to the nearest scene allowing for its speed, like a throw.
Kelvin (rounded to tens) and the percentage count with a tween on an object and power3.out; the marker moves by left in percent on the 1800 to 6500 K scale with back.out. The name has two lines that take turns: the old one leaves narrow on the wdth axis, the new one comes in at 122% and narrows to 100%. Each icon has its own small SVG timeline with svgOrigin.
| Name | File | Default | What it changes |
|---|---|---|---|
STIFFNESS | script.js | 420 | Stiffness of the lens spring: higher snaps faster. |
DAMPING | script.js | 30 | Friction of the spring: lower overshoots and wobbles more. |
STRETCH | script.js | 0.0005 | How much the glass stretches with speed (0 none). |
LIGHT_TIME | script.js | 0.9 | Seconds for the room light to change colour. |
COUNT_TIME | script.js | 0.8 | Seconds for Kelvin and brightness to count. |
SPEED | script.js | 1 | Pilot speed. |
LOOP | script.js | true | The pilot starts over. |
In the app or dashboard of a smart home, a lighting system, a thermostat or a hotel room with lights to choose: wherever you switch from one set of settings to another with a tap. The same lens works for any segmented control with three to five options.
The same animation with adapted sizes: the card is up to 94% of the screen wide, margins and the name also follow the window height. A finger taps a scene or drags the lens, and vertical page scrolling stays free.
Nothing moves: the lens is on the chosen scene at once, with no spring or stretch, the light colours change with a fade, numbers change without counting, the name cross-fades and the icons stay still; the pilot pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.9 KB; the libraries: GSAP 28 KB.
Tested on 10 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.