
The star rating
Ratings, SVG, Hover
The air quality widget of a weather app, in frosted glass on near black, with two soft lights behind the glass that take the colour of the air: a four part arc with the index rising, digits that roll, a one pixel edge and a light that follow the pointer. Refresh it and the digits roll to the new value, the arc reaches it on a spring and the light behind moves from mint to amber; tap it and the card flips on a real spring, with a sheen crossing the glass, and its back shows the pollutants with bars that fill.
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>
<!--
"Air quality widget" 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 glass air quality widget that flips on a spring</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>
<!-- two soft lights behind the glass: they take the colour of the air -->
<span class="orb orb--a" data-orb aria-hidden="true"></span>
<span class="orb orb--b" data-orb aria-hidden="true"></span>
<div class="widget" data-widget>
<span class="widget__shadow" data-shadow aria-hidden="true"></span>
<!-- the glass card: one element turns (front and back swap at 90 degrees), the light and the 1px edge follow the pointer -->
<article class="card" data-card aria-label="Air quality">
<span class="card__grain" aria-hidden="true"></span>
<span class="card__spot" aria-hidden="true"></span>
<span class="card__sheen" data-sheen aria-hidden="true"></span>
<section class="face face--front" data-front>
<header class="head">
<div class="head__words">
<span class="head__kicker">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 6h7.5a2.2 2.2 0 1 0-2.2-2.2M2 9.5h10a2.2 2.2 0 1 1-2.2 2.2M2 13h4.5"/></svg>
Air quality
</span>
<span class="head__place" data-place>Harbour District</span>
</div>
<span class="chip">US AQI</span>
</header>
<div class="gauge">
<svg class="gauge__svg" viewBox="0 0 220 162" aria-hidden="true">
<defs>
<filter id="soft" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="4"/></filter>
</defs>
<g data-segs></g>
<path class="gauge__glow" data-glow pathLength="1" d=""/>
<path class="gauge__fill" data-fill pathLength="1" d=""/>
<g data-tick><line class="gauge__tick" x1="110" y1="7" x2="110" y2="25"/></g>
<text class="gauge__end" x="37" y="160" text-anchor="middle">0</text>
<text class="gauge__end" x="183" y="160" text-anchor="middle">200</text>
</svg>
<div class="gauge__read">
<span class="num" data-num aria-hidden="true"></span>
<span class="level"><span class="roll" data-level>Good</span></span>
</div>
</div>
<p class="insight"><span class="roll" data-insight>Clear air for a run along the water.</span></p>
<footer class="foot">
<span class="foot__time"><span class="roll" data-updated>Updated 2 min ago</span></span>
<button class="icon-btn" type="button" data-refresh aria-label="Refresh the reading">
<span class="btn-face" data-face>
<svg viewBox="0 0 20 20" aria-hidden="true" data-spin><path d="M15.6 7.4A6 6 0 0 0 4.3 8.2M4.4 12.6a6 6 0 0 0 11.3-.8"/><path d="M15.9 3.6v3.9h-3.9M4.1 16.4v-3.9h3.9"/></svg>
</span>
</button>
<button class="pill-btn" type="button" data-flip aria-label="Show the pollutants">
<span class="btn-face" data-face>Details<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6.5 4l4 4-4 4"/></svg></span>
</button>
</footer>
</section>
<section class="face face--back" data-back aria-hidden="true" inert>
<header class="head">
<div class="head__words">
<span class="head__kicker">Pollutants</span>
<span class="head__place">Right now</span>
</div>
<span class="chip">µg/m³</span>
</header>
<ul class="rows" data-rows>
<li class="row"><span class="row__name">PM2.5</span><span class="row__bar"><span class="row__fill" data-bar></span></span><span class="row__val" data-val>0</span></li>
<li class="row"><span class="row__name">PM10</span><span class="row__bar"><span class="row__fill" data-bar></span></span><span class="row__val" data-val>0</span></li>
<li class="row"><span class="row__name">O<sub>3</sub></span><span class="row__bar"><span class="row__fill" data-bar></span></span><span class="row__val" data-val>0</span></li>
<li class="row"><span class="row__name">NO<sub>2</sub></span><span class="row__bar"><span class="row__fill" data-bar></span></span><span class="row__val" data-val>0</span></li>
</ul>
<div class="hours">
<span class="hours__head"><span>Next 12 hours</span><span class="hours__peak" data-peak>Peak 48 at 1 pm</span></span>
<span class="hours__bars" data-hours aria-hidden="true"></span>
<span class="hours__axis" aria-hidden="true"><span>Now</span><span>6 pm</span><span>Midnight</span></span>
</div>
<footer class="foot foot--back">
<span class="best">
<span class="best__label">Best hours outside</span>
<span class="best__time" data-best>All day</span>
</span>
<button class="pill-btn pill-btn--back" type="button" data-unflip aria-label="Back to the overview">
<span class="btn-face" data-face><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.5 4l-4 4 4 4"/></svg>Overview</span>
</button>
</footer>
</section>
</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>
<p class="sr" aria-live="polite" data-live></p>
</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.
43 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 “Air quality widget” from Animorio and fit it into my siteThe card has a backdrop-filter with blur over two blurred lights in the background, an almost transparent white gradient and a grain made with feTurbulence in an SVG background. The edge is a ::before with one pixel of padding and a mask that keeps only the frame (mask-composite: exclude): its background is a radial-gradient centred on --mx and --my, the pointer’s coordinates, so it lights up only where the light passes.
The card’s angle follows a spring worked out every frame (force = -stiffness × distance - damping × velocity), in steps of 1/240 of a second. The target is 0 or 180: below 90 degrees you see the front, above it the back, turned by angle - 180 so it is not mirrored. Only one element turns, without preserve-3d, which is why the backdrop-filter keeps working during the flip.
Three things come from the sine of the angle: the card’s scale (up to +3.5% when edge on), the opacity and position of the band of light crossing the glass, and the width of the shadow below, which narrows halfway through the turn. All in the same hand written transform, together with the tilt towards the pointer, which has its own two springs.
The arc is a 240 degree SVG path with pathLength=1: the bright part is a stroke-dasharray GSAP takes to the value with back.out, and the white tick turns around the centre with the same value. The number is two reels of digits from 0 to 9, moved with yPercent under a mask that fades at top and bottom. The colour of the air is a CSS variable, --lvl, that GSAP slides on the arc, the edge, the bars and the light behind the glass all together.
| Name | File | Default | What it changes |
|---|---|---|---|
STIFFNESS | script.js | 170 | The stiffness of the spring that flips the card: higher is quicker. |
DAMPING | script.js | 18 | The damping of the spring: lower makes the card go further past the half turn and come back. |
TILT | script.js | 5 | How many degrees at most the card tilts towards the pointer. |
BLUR | script.js | 14 | How frosted the glass is, in pixels of blur. |
GOOD_COLOR | script.js | #5be3b0 | The colour of good air: arc, edge, bars and the light behind the glass. |
MODERATE_COLOR | script.js | #f6c35b | The colour of moderate air. |
PLACE | script.js | Harbour District | The neighbourhood written at the top. |
On the home screen of a weather, health or running app, or in a smart home dashboard with an air purifier: a glance on the front (number, colour, one sentence to read) and the details on the back, without opening another page.
The card is sized on the window’s width and height and stays whole in the frame; tap it to flip it, refresh with the round button, and the light and the tilt follow your finger.
No tilt and no turn: front and back swap with a fade, the digits change without rolling, the labels fade and the light stays still.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 3 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.