
The liquid grid
Hover, Transitions
The home page of Halcyon Star Club, a made-up astronomy night, all in black and white and in a monospaced type, like the one of Star Party Silverlake. In the ticker at the bottom sits the pill switch: the knob runs on a spring and one pixel too far, the sun and the moon swap with a turn, and the page flips not all at once but with a wave leaving the knob: the sky turns over in a circle, the stars become ink dots, and ticker, panel and header change colour the moment the wave reaches them. Touched, the switch says MANUAL and a thin line wears down; when it ends, the page goes back by itself to the theme of the real sun, worked out from the sun’s altitude.
Rebuilt from scratch studying starpartysl.com by Hayda Studios: the idea is theirs; code, copy and images are ours. Read how it’s made
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>
<!--
"Day-night page flip" 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 day and night switch that flips the whole page and goes back to the real sun</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- the home page of Halcyon Star Club, a made-up monthly astronomy night, in black and white: the switch in the
ticker flips the whole page between night and day, not all at once but in a staggered choreography (the sky
from the knob outwards, then the header, the panel and the ticker); touched, it says MANUAL and a thin line
drains, then the page goes back by itself to the theme of the real sun, worked out with the sun's altitude -->
<main class="page" data-page>
<div class="sky layer" data-layer="sky">
<span class="sky__wipe" data-wipe aria-hidden="true"></span>
<canvas class="sky__stars" data-stars aria-hidden="true"></canvas>
</div>
<header class="head layer" data-layer="head">
<a class="brand" href="#" aria-label="Halcyon Star Club">
<svg class="brand__mark" data-mark viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 1.8 13.6 10.4 22.2 12 13.6 13.6 12 22.2 10.4 13.6 1.8 12 10.4 10.4Z"></path>
<path class="brand__small" d="M19.2 3.4 19.8 5.6 22 6.2 19.8 6.8 19.2 9 18.6 6.8 16.4 6.2 18.6 5.6Z"></path>
</svg>
<span class="brand__name">Halcyon<span class="brand__sub">Star Club</span></span>
</a>
<nav class="nav" aria-label="Main">
<a href="#">Nights</a>
<a href="#" class="nav__wide">Telescopes</a>
<a href="#" class="nav__join">Join</a>
</nav>
</header>
<section class="panel layer" data-layer="panel" data-panel aria-label="This month">
<button class="panel__close" type="button" data-close aria-label="Close panel">
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M2.5 2.5 9.5 9.5M9.5 2.5 2.5 9.5"></path></svg>
</button>
<span class="label">This month</span>
<h1 class="panel__title">Late-autumn sky<br>over the reservoir</h1>
<div class="panel__row">
<span class="panel__when">SAT · NOV 21 · 8 PM</span>
<a class="panel__book" href="#">Book a spot
<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 9 9 3M4.2 3H9v4.8"></path></svg>
</a>
</div>
</section>
<footer class="ticker layer" data-layer="ticker">
<div class="ticker__col">
<span class="label">Local time</span>
<span class="value clock" data-clock>08:41:07 PM</span>
<span class="sub" data-date>SAT · NOV 14, 2026</span>
</div>
<div class="ticker__col ticker__col--sun">
<span class="label">The sun</span>
<svg class="gauge" viewBox="0 0 96 30" aria-hidden="true">
<path class="gauge__arc" d="M6 28 A42 24 0 0 1 90 28"></path>
<path class="gauge__line" d="M2 28H94"></path>
<g data-sun>
<circle class="gauge__sun" r="3.2" cx="0" cy="0"></circle>
</g>
</svg>
<span class="sub" data-alt>12.4° BELOW</span>
</div>
<div class="ticker__col ticker__col--right">
<button class="switch" type="button" role="switch" aria-checked="true" aria-label="Night sky" data-switch>
<span class="switch__word switch__word--night" data-word-night>Night</span>
<span class="switch__word switch__word--day" data-word-day>Day</span>
<span class="switch__knob" data-knob>
<span class="switch__squash" data-squash>
<svg class="switch__icon switch__icon--sun" data-icon-sun viewBox="0 0 16 16" aria-hidden="true">
<circle cx="8" cy="8" r="3"></circle>
<path d="M8 1.2V3M8 13v1.8M1.2 8H3M13 8h1.8M3.2 3.2l1.3 1.3M11.5 11.5l1.3 1.3M3.2 12.8l1.3-1.3M11.5 4.5l1.3-1.3"></path>
</svg>
<svg class="switch__icon switch__icon--moon" data-icon-moon viewBox="0 0 16 16" aria-hidden="true">
<path d="M10.6 2.2a6 6 0 1 0 3.2 9.6A5 5 0 0 1 10.6 2.2Z"></path>
</svg>
</span>
</span>
</button>
<span class="status" data-status>
<span class="status__text" data-status-text>AUTO · FOLLOWS THE SUN</span>
<span class="status__line" aria-hidden="true"><span data-drain></span></span>
</span>
</div>
</footer>
</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.
34 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 “Day-night page flip” from Animorio and fit it into my siteAs on the site, sunAltitude() does the astronomy: mean anomaly, equation of the centre, ecliptic longitude, declination and sidereal time, then the altitude with the latitude. Above -0.833 degrees (the sun’s edge rising, with refraction) it is day. The place is neither asked nor shown: the longitude comes from the visitor’s time zone (15 degrees an hour) and the latitude is a middle one.
Sky, header, panel and ticker each have their own --bg and --fg variables, and everything else uses them (edges, knob, icons). GSAP tweens them one by one: so the page does not change all at once but part by part.
On the sky a veil of the new colour opens with clip-path: circle() from the knob’s centre to the farthest corner, with sine.inOut. Since the radius is R(1 - cos(πt/T))/2, the moment it reaches a distance d is T·acos(1 - 2d/R)/π: each part starts changing colour exactly when the wave reaches its nearest point and ends when it passes the farthest.
Stars and lines are on a canvas. On every frame each star checks whether it is inside the circle: inside it takes the new colour, outside the old one, so they flip the moment the wave passes them. Each star twinkles with its own sine and follows the pointer by its depth.
The run goes one pixel too far with power3.out and comes back with sine.inOut; meanwhile the knob stretches halfway and turns round again with an elastic. The sun leaves with a 90 degree turn and the moon comes in turning from the other side, with back.out. Pressed it squashes, under the pointer it leans three pixels towards the other side.
Like the site’s spslSkyManual variable, the manual choice stops the automatic check; here though it lasts a few seconds: a one-pixel line wears down with a linear tween and at zero the page goes back by itself to the sun’s theme. Turn it back to the sun’s side and it says AUTO at once.
| Name | File | Default | What it changes |
|---|---|---|---|
RETURN_AFTER | script.js | 5 | How many seconds the manual choice lasts before the page goes back by itself to the theme of the real sun. |
WIPE | script.js | 1.15 | How many seconds the wave takes to leave the knob and flip the whole sky. |
LAYER_TIME | script.js | 0.42 | How many seconds each part (header, panel, ticker) takes to change colour when the wave reaches it. |
KNOB_TIME | script.js | 0.62 | How long the knob’s run lasts, in seconds. |
OVERSHOOT | script.js | 1 | How many pixels the knob goes past before settling. |
SQUASH | script.js | 0.26 | How much the knob stretches halfway (0 = never). |
STARS | script.js | 150 | How many stars in the sky behind the page. |
TWINKLE | script.js | 0.45 | How much the stars twinkle (0 = still). |
DRIFT | script.js | 6 | How many pixels the sky follows the pointer. |
AUTOPILOT_WAIT | script.js | 2.4 | How many seconds the autopilot waits before turning the switch by itself. |
For sites that change theme by themselves with the time of day (an observatory, an evening event, a bar that turns into a club at night, a hotel, a weather or sleep app) and for every dark-mode switch that should feel like a gesture and not a flash: the wave from the knob and the parts changing one after the other carry over to any page.
The same gesture with adapted sizes: the header keeps the mark and «Join», the panel moves to the centre and is sized on the height with clamp, the ticker keeps the clock, the switch and the word (the sun on its arc hides under 620 pixels). The wave always leaves the knob and reaches the farthest corner, recomputed if the window changes size. A finger taps like the mouse.
No wave and no running knob: the knob is already on the right side, icons and words cross-fade and the whole page fades from one theme to the other in 0.45 s. The stars do not twinkle or follow the pointer.
GSAP 3.15.0, Geist Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.
Tested on 14 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.