4nodes
Air
Markup where the component goes, CSS in your stylesheet, script before </body>. In Vue, Svelte or Angular, call initCardAir(el) on the mounted element instead.
Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Install with shadcn
Needs a free account token. Get a token
npx shadcn@latest add @movin/card-airAbout this component
An air quality card that answers how far you can see: a city skyline, a lower skyline, hills and two mountain ridges recede under a sky and a sun, and the air between them fills with haze as the reading rises. In clean air the snowy far peaks stay crisp under a deep sky; in smog they vanish one by one into an ochre haze and the sun becomes a dim orange disc. Pick a city and the haze cross-fades as the figure rolls, or drag across the landscape to scrub the pollution.
Triggers
- Card
- Ambient
- State change
- Click
- Continuous
- Gradient
Techniques
- SVG
- Filter
- CSS variables
- Gradient
- Radial gradient
- requestAnimationFrame
- Keyframes
- Event position
Difficulty
Advanced
Accessibility
Keyboard and screen readers
The city chips are native buttons with aria-pressed and a polite live region announces the pick, for example "Mirov, AQI 74, Moderate". The landscape is a focusable role="slider" named Haze (0 to 200) with aria-valuetext giving the AQI, the word and how far you can see; the arrow keys step by 5, Page Up and Page Down by 25, Home and End go to the ends. The drawn figure and scene are aria-hidden.
Reduced motion
The haze, figure and colours cut to the new reading, and the drifting band, birds and blinking windows hold still.
Use it in anything you build, commercial and client work included. Licence