Skip to content
animorio
IT
Back to the library

Rain alert

SVG, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.4 KBGSAP 28 KBFreeDownload the zip

The next-hour card of a made-up weather app, Cirrel, on a light background, in the style of product interface pieces: an SVG icon that goes from sun to cloud to rain (the rays pull into the sun as the cloud slides in front, the drops fall and splash in heavy rain), a temperature that rolls and sixty bars, one per minute. Dragging a finger or moving the pointer over the bars reads any minute, and the icon, the words and the numbers follow it.

The code

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>
<!--
  "Rain alert" 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 rain alert minute by minute</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 next-hour card of a made-up weather app, Cirrel: an icon that turns from sun to cloud to rain, the
         temperature that rolls, and sixty bars of rain minute by minute; drag or hover across the bars to read
         any minute, and the icon, the words and the numbers follow -->
    <article class="card" data-card aria-label="Next hour">
      <header class="card__top">
        <span class="card__app">
          <svg class="card__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M6.2 15.2h8.1a3.4 3.4 0 0 0 .4-6.8 4.6 4.6 0 0 0-8.9 1.2 2.8 2.8 0 0 0 .4 5.6Z"/></svg>
          <span data-app>Cirrel</span>
        </span>
        <span class="card__place">Harbor Quay</span>
      </header>

      <div class="now">
        <svg class="icon" data-icon viewBox="0 0 64 64" aria-hidden="true">
          <g class="icon__sun" data-sun>
            <g class="icon__rays" data-rays></g>
            <circle class="icon__core" data-core cx="24" cy="24" r="9.5"/>
          </g>
          <g class="icon__cloudwrap" data-cloud>
            <path class="icon__shadow" d="M19 47h27a9.5 9.5 0 0 0 1.3-18.9A13 13 0 0 0 22.6 31 8 8 0 0 0 19 47Z" transform="translate(1.6 2.4)"/>
            <path class="icon__cloud" data-cloudpath d="M19 47h27a9.5 9.5 0 0 0 1.3-18.9A13 13 0 0 0 22.6 31 8 8 0 0 0 19 47Z"/>
            <path class="icon__shine" d="M27.5 31.2a9 9 0 0 1 8.2-5.4"/>
          </g>
          <g class="icon__drops" data-drops></g>
          <g class="icon__splash" data-splash></g>
        </svg>
        <div class="now__text">
          <div class="now__temp"><span class="roll" data-temp><span>14</span></span><span class="now__deg">°</span></div>
          <p class="now__say" data-say>Rain starting in 12 min</p>
          <p class="now__sub" data-sub>Dry for now · Feels like 12°</p>
        </div>
      </div>

      <div class="chart" data-chart>
        <div class="chart__lines" aria-hidden="true">
          <span>Heavy</span><span>Moderate</span><span>Light</span>
        </div>
        <div class="chart__bars" data-bars></div>
        <div class="chart__scrub" data-scrub aria-hidden="true">
          <span class="chart__tip" data-tip><b data-tipmin>Now</b><span data-tipword>Dry</span></span>
          <span class="chart__line"></span>
          <span class="chart__knob"></span>
        </div>
      </div>
      <div class="axis" aria-hidden="true">
        <span>Now</span><span>10m</span><span>20m</span><span>30m</span><span>40m</span><span>50m</span>
      </div>

      <footer class="card__foot">
        <span data-hint>Drag across the hour</span>
        <span class="card__total">Total <b data-total>4.2 mm</b></span>
      </footer>
    </article>

    <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>

Playground

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.

37 values to change

Or ask your AI assistant for it

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 “Rain alert” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a light grey background there is a white card with round corners and a wide soft shadow: at the top the app name Cirrel with its small blue cloud and the place, Harbor Quay. Below, a weather icon drawn in SVG, the big temperature, 14 degrees, and the line Rain starting in 12 min. Further down, sixty thin bars, one for each minute of the next hour: grey and low while it is dry, then blue, taller and taller up to the strongest minute and low again, over three dashed lines reading Light, Moderate and Heavy. On arrival the card rises gently, the bars grow from left to right with a small bounce and the sun turns in. Moving the pointer over the bars or dragging a finger across them shows a thin line with its handle and a black pill with the time and the millimetres per hour; the bars after that minute dim and the one under the line hops. The icon follows the chosen minute: as the rain gets near, the sun’s rays pull in and turn while a cloud slides in front of the sun, with the rain the drops fall at a slant, longer and faster when it is heavy, the cloud turns greyer and the drops splash at the bottom with two little arcs. The temperature rolls down one degree for each level of rain, the line and the row below change with a rising fade (Heavy rain at 19:03, Stops around 19:30). Let go and everything goes back to now. A drawn pointer does the round by itself: it goes to the start, drags to the strongest minute, stops, moves to the tail of the rain and to the dry end, lets go, and starts again.

How it works

An hour of rain in sixty numbers

The millimetres per hour of each minute come from a curve: zero until the start, then a sine raised to a power that rises gently and falls more slowly, with two small waves so it doesn’t look ruled. Each bar is a flex element with its height in percent taken from a soft curve, so light rain still shows; the three guide lines sit where light, moderate and heavy begin.

The weather as one number

Sun, cloud, rain and heavy rain are a value from 0 to 3, carried by a GSAP tween with back.out. A single function draws the icon from that number: up to 1 the rays shorten and turn towards the centre while the cloud comes in from the right and the sun rises behind it; from 1 to 3 the sun disappears, the cloud darkens by mixing two colours and the drops switch on one after another.

Drops and splashes

Five lines fall under the cloud on gsap.ticker, each with its own phase; speed and length grow with the weather. When a drop starts again from the top and the rain is heavy, a splash is born: a path of two arcs that widens and fades in four tenths of a second.

Reading a minute

The minute comes from the pointer’s position over the bars. The line moves with gsap.set, the pill stays inside the card, the bars after it dim, the temperature rolls with two numbers inside a faded mask (the old one leaves upwards, the new one comes in from below with a bounce) and the lines change with a rising fade.

Values to change

NameFileDefaultWhat it changes
APPscript.js'Cirrel'The name of the made-up weather app, written at the top.
NOWscript.js'18:40'The time now: the minute labels start from here.
START_INscript.js12How many minutes until the rain starts.
PEAKscript.js4.8The millimetres per hour in the strongest minute.
MORPHscript.js0.7The seconds the icon takes to go from one weather to another.
RAIN_SPEEDscript.js1How fast the drops fall under the cloud.
PAUSEscript.js1.1The seconds the drawn pointer rests on a minute.

Try them in the Playground

When to use it

For a weather app or site, for the home of a travel or outdoor events app, for a widget that tells you whether to go out now: at a glance you see when it starts and when it stops, and dragging reads any minute.

On phones

The same animation with adapted sizes: the card narrows with the width, icon, chart and gaps are also sized on the height, and the chart is read by dragging a finger.

With reduced motion

No pointer, no entrance, no falling drops or splashes: the icon changes weather at once, the temperature and the lines change without rolling, and the chart can still be read.

Pitfalls

  • The sun’s entrance is done by GSAP on the group and its parts with inline styles: if entrance and drawing touched the same element, one transform would wipe out the other.
  • The time pill has its half offset with GSAP’s xPercent and not with translateX in the CSS, which GSAP would have overwritten on the first set.
  • When the pointer leaves the chart while the autopilot is working, the chart must not go back to now: the autopilot decides when to let go.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.4 KB; the libraries: GSAP 28 KB.

Testing

Tested on 27 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All animations