
The layered button
Buttons, Hover, Physics
The next-hour rain widget of a made-up weather app, Pluvo, in dark glass on black, like a premium app: sixty thin bars that fill up from the left, the line of now and a glass handle to drag on a real spring. The time and the millimetres roll, the line goes from Rain in 12 min to Stops in 22 min, and when the rain is heavy drops condense on the widget’s glass: it mists up, the drops grow, merge and slide down leaving a clear trail. At the end, Dry by 10:52, with the sun coming out from behind the cloud and the light turning amber.
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>
<!--
"Minute rain forecast" 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 minute by minute rain forecast with the chart that fills up</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>
<div class="widget" data-widget>
<!-- the light behind the glass: blue with the rain, amber when it is dry -->
<span class="widget__glow" data-glow aria-hidden="true"></span>
<span class="widget__shadow" aria-hidden="true"></span>
<article class="card" data-card aria-label="Rain in the next hour">
<span class="card__grain" aria-hidden="true"></span>
<span class="card__spot" aria-hidden="true"></span>
<!-- the mist and the drops that condense on the glass when the rain is heavy -->
<canvas class="card__wet" data-wet aria-hidden="true"></canvas>
<header class="head">
<span class="brand">
<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M5.6 14.6h8.1a3.3 3.3 0 0 0 .3-6.6 4.6 4.6 0 0 0-8.8 1.2 2.7 2.7 0 0 0 .4 5.4Z"/></svg>
Pluvo
</span>
<span class="place" data-place>Canal Row</span>
</header>
<div class="hero">
<svg class="icon" viewBox="0 0 48 48" aria-hidden="true" data-icon>
<g class="icon__sun" data-sun>
<circle cx="31" cy="15" r="6.2"/>
<g class="icon__rays" data-rays>
<path d="M31 4.6v2.6M31 22.8v2.6M20.6 15h2.6M38.8 15h2.6M23.6 7.6l1.9 1.9M36.5 20.5l1.9 1.9M23.6 22.4l1.9-1.9M36.5 9.5l1.9-1.9"/>
</g>
</g>
<path class="icon__cloud" data-cloud d="M13.5 32.5h18.2a7 7 0 0 0 .7-14 9.6 9.6 0 0 0-18.5 2.6 5.7 5.7 0 0 0-.4 11.4Z"/>
<g class="icon__rain" data-rain>
<path d="M16.5 37.2l-1.6 4.6"/>
<path d="M23.5 37.2l-1.6 4.6"/>
<path d="M30.5 37.2l-1.6 4.6"/>
</g>
</svg>
<h2 class="title" aria-live="polite">
<span class="title__line" data-line="before">Rain in <span class="roll" data-roll="before"></span> min</span>
<span class="title__line" data-line="during" aria-hidden="true">Stops in <span class="roll" data-roll="during"></span> min</span>
<span class="title__line" data-line="after" aria-hidden="true">Dry by <span data-dry>10:52</span></span>
</h2>
</div>
<div class="read">
<span class="read__time roll" data-time></span>
<span class="read__mm"><span class="roll" data-mm></span><span class="read__unit">mm/h</span></span>
<span class="read__word"><span class="word" data-word>Dry</span></span>
</div>
<div class="chart" data-chart>
<span class="guide guide--heavy" data-guide="heavy"><span>Heavy</span></span>
<span class="guide guide--light" data-guide="light"><span>Light</span></span>
<span class="now" aria-hidden="true"><span>Now</span></span>
<div class="bars" data-bars aria-hidden="true"></div>
<div class="cursor" data-cursor>
<span class="cursor__line"></span>
<span class="cursor__knob" data-knob role="slider" tabindex="0" aria-label="Minute of the forecast" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="Now, dry">
<span class="cursor__grip" data-grip></span>
</span>
</div>
</div>
<div class="axis" aria-hidden="true">
<span data-tick="0">Now</span><span data-tick="20">10:20</span><span data-tick="40">10:40</span><span data-tick="60">11:00</span>
</div>
</article>
</div>
<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"/></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.
35 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 “Minute rain forecast” from Animorio and fit it into my siteThe millimetres per hour of each minute come from a curve: zero until the start, then a sine on a bent time (it rises fast, falls slowly), a second wave near the end and two small wobbles, rescaled so the strongest minute is worth PEAK. Each bar’s height is the value to the power 0.75, so light rain still shows, and the Light and Heavy lines sit on the same scale.
The finger or the autopilot only change the target minute; every frame a spring with SPRING and DAMPING pulls the line towards it, with the time step capped at 1/30 s. The spring’s speed tilts the handle by a few degrees, pressing squashes it and letting go brings it back on an elastic; the nearby bars rise with a Gaussian bell and the ones already passed dim.
Each digit is a column from 0 to 9 inside a window faded at the top and bottom: GSAP moves it with yPercent and back.out, a little longer when the jump is big. The tens digit of the minutes, when it is zero, shrinks to zero width, so Rain in 9 min closes up without a gap. The three lines share one grid cell and swap with a rising fade.
A canvas under the words does two things. The mist is a second, off-screen canvas that every frame gets a pale veil (stronger at the bottom) and loses a little with destination-out: it finds its own balance. Drops are born at random, grow while the rain is heavy, merge by adding their areas and, past a certain size, slide down in jerks wiping the mist along the way and leaving droplets behind. Each drop is a shadow, a body with a radial gradient, an arc of blue light at the bottom and a white highlight at the top.
Past the end of the rain the line becomes Dry by with the computed time, the sun comes in with back.out and the rays turn on an elastic, and the widget’s --acc variable moves from blue to amber: the glow behind the glass, the edge, the brand’s little cloud and the millimetres follow it.
| Name | File | Default | What it changes |
|---|---|---|---|
NOW | script.js | "10:00" | The time now: the chart’s and the reading’s times start from here. |
START_IN | script.js | 12 | How many minutes until the rain starts. |
LENGTH | script.js | 40 | How many minutes the rain lasts. |
PEAK | script.js | 6.2 | The millimetres per hour in the strongest minute. |
HEAVY | script.js | 4 | From how many millimetres per hour the rain is heavy and the glass gets wet. |
SPRING | script.js | 240 | The stiffness of the cursor’s spring: higher is quicker. |
DAMPING | script.js | 24 | The spring’s damping: lower overshoots the minute more. |
CONDENSATION | script.js | 1 | How much the glass mists up and how many drops form in heavy rain. |
ROLL | script.js | 0.5 | The seconds the digits take to roll to the new number. |
PLACE | script.js | "Canal Row" | The place written at the top right. |
On the home screen of a weather app, in a phone widget, in a smart home dashboard, in a delivery, outdoor events or hotel app that tells people whether to go out now: at a glance you see when it starts and when it stops, and dragging reads any minute.
The same animation with adapted sizes: the widget is sized on the window’s width and height and stays whole in the frame, the chart gets shorter with the height and is read by dragging a finger, which does not scroll the page.
No entrance, no spring and no drawn pointer: the line jumps to the chosen minute, the digits and the lines change without rolling with a fade, the icon’s drops do not fall and the ones on the glass appear and fade without sliding.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.
Tested on 7 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.