
The liquid grid
Hover, Transitions
The settings of a reading app, in the clean style of today’s apps: turn on dark mode and the light of the page pulls back into the toggle, with a soft edge like a lamp’s, leaving the glass cards lit only by the small warm light of the knob. Turn it off and the light pours out of the toggle again and fills the page.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React tab holds the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Dark mode 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>Settings that switch to dark mode as the light retreats into the toggle</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 settings of a reading app: flip Appearance and the light pulls back into the toggle,
leaving the glass cards lit only by the small lamp of the knob; flip it again and the light pours out -->
<div class="scene" data-scene>
<div class="layer layer--dark" data-layer="dark"></div>
<div class="layer layer--light" data-layer="light"></div>
</div>
<template data-panel>
<section class="panel">
<header class="panel__head" data-row>
<span class="brand">
<svg viewBox="0 0 24 24" aria-hidden="true"><path class="brand__frame" d="M8 4.5h8M9 4.5v2.2M15 4.5v2.2M7.2 8.2c0-1 .8-1.5 1.8-1.5h6c1 0 1.8.5 1.8 1.5v8.6c0 1.3-1 2.2-2.3 2.2H9.5c-1.3 0-2.3-.9-2.3-2.2Z"/><path class="brand__flame" d="M12 10.2c1.4 1.5 2 2.6 2 3.6a2 2 0 0 1-4 0c0-1 .6-2.1 2-3.6Z"/></svg>
Lanternly
</span>
<span class="panel__title">Settings</span>
</header>
<div class="card card--main" data-row>
<div class="row row--theme">
<span class="row__icon">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="7.5"/><path d="M12 4.5a7.5 7.5 0 0 1 0 15Z" class="fill"/></svg>
</span>
<span class="row__text">
<span class="row__name">Appearance</span>
<span class="row__value"><span class="roll" data-roll><span>Light</span><span>Dark</span></span></span>
</span>
<button class="switch" data-switch type="button" role="switch" aria-checked="false" aria-label="Dark mode">
<span class="switch__track"></span>
<span class="switch__knob" data-knob>
<span class="switch__glow"></span>
<svg class="sun" data-sun viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 3v2.2M12 18.8V21M3 12h2.2M18.8 12H21M5.6 5.6l1.6 1.6M16.8 16.8l1.6 1.6M5.6 18.4l1.6-1.6M16.8 7.2l1.6-1.6"/></svg>
<svg class="moon" data-moon viewBox="0 0 24 24" aria-hidden="true"><path d="M18.5 14.6A7 7 0 0 1 9.4 5.5a7 7 0 1 0 9.1 9.1Z"/></svg>
</span>
</button>
</div>
<div class="row" data-hover>
<span class="row__icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 5.5h8.5a3 3 0 0 1 3 3v10H9a3 3 0 0 1-3-3Z"/><path d="M9 9.5h5.5M9 12.5h4"/></svg></span>
<span class="row__text"><span class="row__name">Reading font</span><span class="row__value">Serif, 18 pt</span></span>
<svg class="chev" viewBox="0 0 24 24" aria-hidden="true"><path d="m10 7 5 5-5 5"/></svg>
</div>
<div class="row" data-hover>
<span class="row__icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4.5v3M12 16.5v3M4.5 12h3M16.5 12h3"/><circle cx="12" cy="12" r="2.4"/></svg></span>
<span class="row__text"><span class="row__name">Warm light after sunset</span><span class="row__value">From 7:40 PM</span></span>
<span class="pill">On</span>
</div>
</div>
<div class="card" data-row>
<div class="row" data-hover>
<span class="row__icon"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 16.5a4 4 0 0 1-.4-8 5.5 5.5 0 0 1 10.6 1.4 3.4 3.4 0 0 1-.7 6.6Z"/></svg></span>
<span class="row__text"><span class="row__name">Sync library</span><span class="row__value">412 books, 3 devices</span></span>
<svg class="chev" viewBox="0 0 24 24" aria-hidden="true"><path d="m10 7 5 5-5 5"/></svg>
</div>
<div class="row row--bar" data-hover>
<span class="row__icon"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="6" width="14" height="12" rx="2.5"/><path d="M5 10.5h14"/></svg></span>
<span class="row__text"><span class="row__name">Storage</span><span class="bar"><i></i></span></span>
<span class="row__num">2.4 of 5 GB</span>
</div>
</div>
</section>
</template>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></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.
16 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 “Dark mode switch” from Animorio and fit it into my siteThe settings are a template copied twice: the dark version below, the light one on top. Everything that moves (knob, icons, rolling label, rows) moves together in both copies, so at any moment the two pages are the same except for their colours.
The light copy has a radial mask-image centred on the toggle: solid up to r0, transparent at r, with r0 equal to r times 1 minus FEATHER. GSAP takes r from the radius that covers the farthest corner down to zero in LIGHT_TIME seconds, and the light pulls back with a soft edge like a lamp’s; on the way back it does the opposite.
In the dark theme every card has two radial gradients centred on the toggle: one inside, barely warm, and one on the border, cut out with mask-composite, that makes the nearest edges catch the light. Their strength is a CSS variable that rises as the last light arrives, flares once and settles on GLOW.
Each row has a delay worked out from its distance from the toggle: as the edge of the light crosses it, it shifts by ROW_NUDGE pixels and returns to its place with back.out.
On press the knob widens from the side it starts on, runs with back.out in KNOB_TIME seconds and turns round again with elastic.out; the sun and the moon swap places turning ninety degrees.
| Name | File | Default | What it changes |
|---|---|---|---|
LIGHT_TIME | script.js | 1.15 | The seconds in which the light pulls back into the toggle, or pours out of it. |
FEATHER | script.js | 0.32 | How soft the edge of the light is, as a share of the radius. |
KNOB_TIME | script.js | 0.5 | The seconds of the knob’s run on its spring. |
ROW_NUDGE | script.js | 7 | How many pixels each row shifts as the light crosses it. |
GLOW | script.js | 1 | How much glow the lamp of the knob leaves on the glass. |
PAUSE | script.js | 1.6 | The seconds of pause of the drawn pointer at the end of a round. |
For the settings of an app or a site with a dark theme, when the switch should feel like a light going out rather than a plain swap of colours; for the page of a reading or evening app; or to present a product’s new dark theme.
The same settings sized on the height and width of the box, the same light pulling back into the toggle, which is pressed with a finger.
The knob and the icons go to their place without a run, the light page fades out over the dark one or comes back, with no retreating light and no shifting rows; the drawn pointer is hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.2 KB; the libraries: GSAP 28 KB.
Tested on 28 October 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.