
The slide-to-confirm button
Buttons, Physics, Transitions
NewFree
The weather of a seaside town in a widget whose background is the real sky of the hour chosen, worked out the way the air does it: sunlight scattered along every line of sight on a round Earth, clouds lit by marching towards the sun, the sea mirroring it all with the sun's path of glitter. Scrolling the hours runs the day like a time-lapse: the sun slides down its arc and sinks into the sea, the clouds race with the wind, the rain comes, the stars come out, at dawn the fog turns gold and lifts.
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>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The weather hour by hour</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/onest@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the weather of a seaside town hour by hour: the background is the sky of the hour chosen, worked out the way
the air does it (sunlight scattered along every line of sight, clouds lit from the sun, the sea mirroring it
all), and scrolling the hours runs the day like a time-lapse -->
<section class="sky" aria-labelledby="sky-place" data-sky data-autoclic>
<canvas class="sky__canvas" aria-hidden="true" data-canvas></canvas>
<header class="now" data-now>
<h2 class="now__place" id="sky-place" data-place></h2>
<p class="now__when" data-when></p>
<p class="now__temp"><span data-temp></span><span class="now__deg" aria-hidden="true">°</span><span class="sr"> degrees</span></p>
<p class="now__cond" data-cond></p>
<p class="now__range" data-range></p>
</header>
<div class="panel">
<dl class="facts">
<div class="fact">
<dt>
<svg class="fact__icon fact__wind" viewBox="0 0 16 16" aria-hidden="true" data-wind-icon><path d="M8 2.2v11.6M8 2.2 4.4 5.9M8 2.2l3.6 3.7"/></svg>
<span class="sr">Wind</span>
</dt>
<dd data-wind></dd>
</div>
<div class="fact">
<dt>
<svg class="fact__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.9c2.2 3 4.3 5.4 4.3 8a4.3 4.3 0 0 1-8.6 0c0-2.6 2.1-5 4.3-8Z"/></svg>
<span class="sr">Chance of rain</span>
</dt>
<dd data-chance></dd>
</div>
<div class="fact">
<dt>
<svg class="fact__icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M1.4 8c1.7-2.9 4-4.4 6.6-4.4s4.9 1.5 6.6 4.4c-1.7 2.9-4 4.4-6.6 4.4S3.1 10.9 1.4 8Z"/><circle cx="8" cy="8" r="2.1"/></svg>
<span class="sr">Visibility</span>
</dt>
<dd data-vis></dd>
</div>
</dl>
<div class="hours" role="slider" tabindex="0" aria-label="Forecast hour" data-hours>
<span class="hours__lens" aria-hidden="true"></span>
<ol class="hours__track" aria-hidden="true" data-track></ol>
</div>
</div>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/Draggable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/InertiaPlugin.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.
282 values to change
With the Animorio connector, Claude Code takes it from here, guide included, and fits it into your project. Paste this request:
Take “The weather hour by hour” from Animorio and fit it into my siteFor 64 heights of the line of sight, closer together near the horizon, the script marches in 16 steps through the air of a round Earth (a 6360 km radius, 60 km of air) and at each step adds up the sunlight scattered by the molecules (Rayleigh, the blue) and by the haze (Mie), dimmed along the way by the air, the haze and the ozone. Rayleigh and Mie are kept apart, so each point of the sky only multiplies them by its own phase function, that is by its angle to the sun; the table is rebuilt only when the hour changes. The Earth hides the sun from the low air: after sunset the sky goes from red to mauve to blue by itself, with the shadow of the Earth above the horizon, and the ozone keeps the twilight sky blue.
The clouds lie on a layer at 1.6 km: each point of the sky meets it at a point (x, z), where a fractal noise that tiles without seams, cut by the hour's cloud cover, says how much cloud there is. Where a point of the grid spans many texels the fine octaves are left out, and the density is also worked out at the four corners of every point and averaged, so the edges do not come out in steps. The light: three steps towards the sun through the layer say how much the cloud is in shadow; from below you see the sun through the thin edges (Henyey-Greenstein phase, the silver lining), the light spread inside (greyer where it is thick), the base lit from below when the sun is low, the sky and, at night, the town's light on the clouds above it. Far away the haze comes in front.
Every point of the sea knows how far it is from a camera 15 metres above the water: there the slope of the waves comes from two trains of ripples moving with the wind, and the reflected direction takes the sky from that same table, weighted by Fresnel (Schlick). Where the waves are smaller than a point their average is used, which tips the mirror up towards a higher sky. The sun's path is the chance that the facets of the waves throw the sun at the eye (Beckmann, with Cox and Munk's width given by the wind); on top, sharp glints flash on and off where the path is strong.
The fog is a layer 120 metres thick crossed in fine steps, lit by the sun (gold at dawn, strongest on its side) and by the whole sky, and its thickness changes in banks that drift. The rain is grey curtains under the far clouds (the density taken along the line of sight below the base) and streaks slanted by the wind close by. The stars have a fixed place on the sphere and turn round the pole with the hours: the latitude, which stays inside the code, comes from the sun's height at midday and the length of the day. The moon is a crescent lit on the side where the sun is, with earthshine on its dark part.
The sky is worked out on a grid of DETAIL pixels a point (about 10,000 points) and stretched smooth, the sea on another grid, so the horizon stays sharp. The light is linear: an exposure that opens up as the light goes (the eye adapts, but not all the way), the ACES filmic curve and the sRGB gamma in a single table. On top the sun with its glow, the moon, the stars, the glints and the rain are drawn sharp. The ink of the writing looks at the brightness behind it (and at the brightest stretch under the glass), with two thresholds so it does not flicker, and turns over in a third of a second; the glass takes the tint of the sea, darkened.
The strip is a Draggable with inertia that stops on an hour; its position is the time, interpolated between one hour and the next, so the sky moves while you drag. Where the clouds are: the wind added up hour after hour (going back brings back the same clouds) plus the drift while you watch. With the keys it is a slider (arrows, Page Up and Down, Home, End) that speaks the hour, the sky, the temperature, the rain, the wind and the visibility; the wheel scrolls the hours and at either end lets the page scroll. A click from a script (detail 0, the library's preview) runs to the next fine moment: sunset, evening, rain, night, fog, sunrise, morning, now.
| Name | File | Default | What it changes |
|---|---|---|---|
PLACE | script.js | 'Larkmouth' | The town. |
DAYS | script.js | ['Tuesday', 'Wednesday'] | Today and tomorrow: tomorrow's name shows at midnight in the strip of hours. |
NOW | script.js | 14 | The hour it is now: the hours before it are the morning gone, fainter. |
SUNSET | script.js | '18:49' | The time of sunset. |
SUNRISE | script.js | '07:43' | The time of sunrise. |
SUN_HEIGHT | script.js | 33 | How high the sun climbs at midday, in degrees: with sunrise and sunset it gives its whole arc (and the turning of the stars). |
HOURS | script.js | [[11, 'fogClearing', 13, 0, 9, 200, 3], …] | The forecast: the hour, the sky (a name from SKIES), the temperature, the chance of rain in %, the wind in km/h, where it blows from in degrees and how far you can see in km. After midnight the clock starts again and the strip goes on into the next day. |
SKIES | script.js | { sunny: ['Sunny', 0.03, 0.2, 0, 0], … } | The skies: the name you read, how much of the sky is cloud, how thick the clouds are, the rain and the fog, from 0 to 1. The sky worked out and the icons come from these numbers. |
TIME_LAPSE | script.js | 3 | How many km the clouds travel with the wind, at 15 km/h, for each hour scrolled: higher, and they race faster as the hours scroll. |
DRIFT | script.js | 4 | How fast the clouds drift while you watch, times the real wind. |
DETAIL | script.js | 3 | How many pixels each point of the sky worked out covers: smaller is finer and slower. |
STARS | script.js | 260 | How many stars come out at night. |
RAIN | script.js | 150 | How many drops fall in the heaviest rain. |
CHANGE | script.js | 1.2 | The seconds the sky takes to run to an hour picked with a click or a key. |
For the app or the site of a seaside resort, a harbour, a campsite or a sailing school, an app for photographers waiting for the right light, the page of an outdoor event, and in general for a forecast where what the sky looks like matters, not only the figures.
The widget is 380 pixels wide and on a phone it narrows to the screen (358 on a 390 screen), always 424 tall: the sky is worked out again for the new size. The hours are dragged with a finger, with inertia, and vertically the page scrolls as usual (touch-action pan-y). The canvas is drawn at a density of 2 at most, and if a slow phone takes more than 14 milliseconds for a frame the sky is worked out on a slightly coarser grid instead of stuttering.
The hours do not run: an hour picked with a click, the keys or the preview arrives at once and the old sky fades into the new one in 0.4 seconds. A finger still drags the strip (the hand moves it), but without inertia; the clouds do not drift, the sea does not glitter, the drops close by do not fall and there is no entrance.
GSAP 3.15.0, Onest (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 25 KB; the libraries: GSAP + Inertia + Draggable 44 KB.
Tested on 6 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.
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.