176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: move Aurora / Northern Lights to the guided-steps page
matin96613fe364d5
diff --git a/animations/07-ambient-background/aurora/README.md b/animations/07-ambient-background/aurora/README.mdindex c2cc4b10..29986f7c 100644--- a/animations/07-ambient-background/aurora/README.md+++ b/animations/07-ambient-background/aurora/README.md@@ -1,7 +1,7 @@# Aurora / Northern Lights## What it is-Aurora borealis is rendered in the browser as a set of tall, vertically-oriented color bands that drift horizontally and deform slightly as they move, simulating the curtain-like waviness of real auroras. The effect uses overlapping, heavily-blurred gradient divs whose positions are animated with CSS keyframes that include translation, skewing, and scaling — the combination produces the characteristic shimmer. No WebGL is required; pure CSS creates a convincing atmospheric illusion.+An aurora background imitates the northern lights with a few tall bands of color that sway slowly across a night sky. Each band fades away at the top and bottom and is softly blurred, and each one drifts sideways and leans a little on its own cycle, so the curtains of light never move together. The browser draws it all with no script.## When to use it- Hero sections on apps with a Nordic, atmospheric, or space theme@@ -41,6 +41,8 @@ Each aurora band is an element spanning the full stage width, positioned near th}```+On phones the demo halves the blur, `@media (max-width: 600px) { .band { filter: blur(18px); } }`, which keeps the bands as soft on the smaller stage.+**Real aurora color chemistry**:- Green — oxygen atoms at ~100km altitude (most common)- Blue/purple — nitrogen molecules at lower altitudes@@ -50,20 +52,21 @@ Each aurora band is an element spanning the full stage width, positioned near th## Key parameters| Parameter | Default | Effect ||-----------|---------|--------|-| Band count | 2–3 | 2 creates clarity; 5 creates a richer, more layered sky |-| Blur amount | 35px | Lower = crisper band edges; higher = more diffuse wash |-| Cycle duration | 30s | The ambient mindset: long cycle, imperceptible reset |-| `skewY` range | ±1.5° | The subtle skew is what gives the "waving curtain" character |+| Number of bands | 2 | How many bands of light: two look clear, five make a richer, layered sky |+| Speed | Normal | How long each band takes to sway through its cycle: slow is 48s, normal 30s and fast 18s |+| Colors | Green | Which colors come first: green and blue (the most common aurora), purple and pink, or red and pink (rare); more bands add the other colors |+| Brightness | Medium | How strongly the bands glow: dim is 50%, medium 75% and bright 100% |+| Stars in the sky | off | Adds 120 twinkling stars behind the bands |## Production notes- **No WebGL needed**: CSS keyframes are sufficient for this effect at desktop resolutions. For smooth animation on mobile, reduce blur and band count.- **`overflow: hidden` is mandatory**: bands extend 30% beyond each edge (for drift headroom). Without overflow clipping, they're visible outside the stage.- **`animation-delay` offsets**: give each band a unique negative delay so they start at different phases. Without this, all bands drift together, which looks mechanical.-- **Star layer pairing**: adding a star background behind the aurora dramatically increases realism — the aurora appears to float in front of the night sky. See the demo's star toggle.+- **Star layer pairing**: adding a star background behind the aurora dramatically increases realism — the aurora appears to float in front of the night sky. See the demo's Stars in the sky switch.- **Performance**: each blurred element creates a GPU compositing layer. 5 blurred bands + a star canvas is the practical limit on mid-range mobile.- **Three.js approach**: for fully custom aurora with 3D depth and noise-driven shapes, render a plane mesh with a custom GLSL shader that samples 3D noise for the waveform and color distribution.## See also-- [Mesh Gradient](../mesh-gradient/) — similar blurred-layer approach, radial rather than vertical-- [Starfield](../starfield/) — the star background that pairs naturally with aurora-- [Animated Gradient Background](../animated-gradient-background/) — simpler single-gradient approach+- [Mesh Gradient Animation](../mesh-gradient/) — round blobs of color instead of tall bands+- [Starfield / Space Particles](../starfield/) — stars stream toward you out of the dark+- [Animated Gradient Background](../animated-gradient-background/) — one gradient that slowly shiftsdiff --git a/animations/07-ambient-background/aurora/index.html b/animations/07-ambient-background/aurora/index.htmlindex ff48eb0a..ebde28f5 100644--- a/animations/07-ambient-background/aurora/index.html+++ b/animations/07-ambient-background/aurora/index.html@@ -4,7 +4,7 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Aurora / Northern Lights — Animation Handbook</title>- <meta name="description" content="Tall color bands drift and skew horizontally — blurred gradient layers faking the waving curtain of light.">+ <meta name="description" content="Blurred bands of light sway like the northern lights. Best for dark backgrounds."><link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/aurora/"><link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">@@ -12,27 +12,18 @@<meta property="og:type" content="article"><meta property="og:site_name" content="Animation Handbook"><meta property="og:title" content="Aurora / Northern Lights — Animation Handbook">- <meta property="og:description" content="Tall color bands drift and skew horizontally — blurred gradient layers faking the waving curtain of light.">+ <meta property="og:description" content="Blurred bands of light sway like the northern lights. Best for dark backgrounds."><meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/aurora/"><meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Aurora / Northern Lights — Animation Handbook">- <meta name="twitter:description" content="Tall color bands drift and skew horizontally — blurred gradient layers faking the waving curtain of light.">+ <meta name="twitter:description" content="Blurred bands of light sway like the northern lights. Best for dark backgrounds."><meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Aurora / Northern Lights", "name": "Aurora / Northern Lights", "description": "Tall color bands drift and skew horizontally — blurred gradient layers faking the waving curtain of light.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/aurora/", "inLanguage": "en", "articleSection": "Ambient & Background", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Ambient & Background, Aurora / Northern Lights"}</script>+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Aurora / Northern Lights", "name": "Aurora / Northern Lights", "description": "Blurred bands of light sway like the northern lights. Best for dark backgrounds.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/aurora/", "inLanguage": "en", "articleSection": "Ambient & Background", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Ambient & Background, Aurora / Northern Lights"}</script><style>- @font-face{font-family:'Bricolage';src:url('../../../assets/fonts/brico-700.woff2') format('woff2');font-weight:700;font-display:swap}- @font-face{font-family:'Bricolage';src:url('../../../assets/fonts/brico-800.woff2') format('woff2');font-weight:800;font-display:swap}- @font-face{font-family:'PlexMono';src:url('../../../assets/fonts/plex-400.woff2') format('woff2');font-weight:400;font-display:swap}- @font-face{font-family:'PlexMono';src:url('../../../assets/fonts/plex-500.woff2') format('woff2');font-weight:500;font-display:swap}- :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#ffce5a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:30s}+ :root{--ui-accent:#ffce5a;--dur:30s}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}- body{background:var(--bg);color:var(--ui-text);font-family:var(--mono);-webkit-font-smoothing:antialiased;padding:clamp(12px,3vw,24px)}- header{margin-bottom:20px}- header h1{font-family:var(--disp);font-weight:700;font-size:clamp(11px,1.8vw,15px);letter-spacing:-.01em}- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}- .stage{flex:1;min-width:0;height:var(--stage-h);border:1px solid var(--ui-border);border-radius:8px;overflow:hidden;position:relative}+ .stage{position:relative;overflow:hidden}/* Sky gradient */.sky{position:absolute;inset:0;background:linear-gradient(180deg,#010508 0%,#020a12 40%,#030e1a 100%)}/* Star layer */@@ -62,85 +53,159 @@@keyframes twinkle{0%{opacity:.2}100%{opacity:.9}}/* Card */.fg-card{position:absolute;bottom:36px;left:50%;transform:translateX(-50%);width:clamp(200px,60%,300px);background:rgba(2,5,10,.75);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.08);border-radius:10px;padding:18px 20px;z-index:10}- .fg-eyebrow{font-size:9px;letter-spacing:2px;text-transform:uppercase;color:rgba(0,220,100,.7);margin-bottom:6px}- .fg-title{font-family:Georgia,serif;font-size:clamp(14px,1.8vw,18px);color:#e8f4f0;margin-bottom:6px;line-height:1.3}- .fg-body{font-size:10px;color:rgba(255,255,255,.45);line-height:1.6}- aside{width:clamp(200px,22vw,240px);flex-shrink:0;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:10px}- .note{font-size:10px;color:var(--ui-muted);line-height:1.6;border-left:2px solid var(--ui-accent);padding-left:8px}- .lbl{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}- .div{height:1px;background:var(--ui-border)}- .sr{display:flex;align-items:center;gap:6px;font-size:10px}- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:44px}- .sv{width:44px;text-align:right;color:var(--ui-text)}- select{background:var(--ui-bg);border:1px solid var(--ui-border);color:var(--ui-text);font-family:var(--mono);font-size:10px;padding:8px 6px;border-radius:4px;width:100%;min-height:44px}- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer;min-height:44px}- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}- button.rst{background:transparent;border:1px solid var(--ui-border);color:var(--ui-text);font-family:var(--mono);font-size:10px;padding:14px 8px;border-radius:4px;cursor:pointer;width:100%}- @media(hover:hover){button.rst:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}- @media(max-width:600px){.layout{flex-direction:column;align-items:stretch}aside{width:100%}:root{--stage-h:420px}.stage{flex:none}}- @media(prefers-reduced-motion:reduce){.band{animation-duration:300s!important}.star{animation:none!important}}+ .fg-eyebrow{font-size:11px;font-weight:600;letter-spacing:2px;text-transform:uppercase;color:rgba(0,220,100,.7);margin-bottom:6px}+ .fg-title{font-size:clamp(14px,1.8vw,18px);font-weight:700;color:#e8f4f0;margin-bottom:6px;line-height:1.3}+ .fg-body{font-size:13px;color:rgba(255,255,255,.72);line-height:1.6}+ /* Blur is the costly part on phones, and their stage is less than half as wide, so half the blur looks as soft */+ @media(max-width:600px){.band{filter:blur(18px)}}+ /* On phones and short screens the stage is small, so the card shrinks to leave the bands in view */+ @media(max-width:600px),(max-height:760px){+ .fg-card{padding:12px 14px}+ .fg-eyebrow{margin-bottom:4px}+ .fg-title{margin-bottom:0}+ .fg-body{display:none}+ }</style>-<style id="ah-inject">-:root{--ah-bg:rgba(17,17,20,.82);--ah-line:rgba(255,255,255,.1);--ah-ink:#f4f4f2;--ah-muted:#9a9aa2;--ah-accent:#6ea8ff}-body{padding-top:46px}-.ah-bar{position:fixed;top:0;left:0;right:0;height:46px;z-index:2147483000;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 clamp(10px,3vw,18px);background:var(--ah-bg);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--ah-line);font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px;box-sizing:border-box}-.ah-bar a,.ah-bar button{color:var(--ah-muted);text-decoration:none;background:none;border:0;font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 7px;border-radius:6px;transition:color .18s,background .18s;white-space:nowrap}-.ah-bar a:hover,.ah-bar button:hover{color:var(--ah-ink)}-.ah-home{color:var(--ah-ink);font-weight:600}-.ah-actions{display:flex;align-items:center;gap:2px}-.ah-sep{width:1px;height:16px;background:var(--ah-line);margin:0 4px}-.ah-copied{color:var(--ah-accent)!important}-@media(max-width:600px){.ah-bar .ah-hideSm{display:none}}-@media print{.ah-bar{display:none}body{padding-top:0}}-</style>+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=3">+ <script src="../../../assets/js/demo-page.js?v=3" defer></script></head>-<body>-<div class="ah-bar" role="navigation" aria-label="Animation Handbook"><a class="ah-home" href="../../../">← Animation Handbook</a><span class="ah-actions"><a class="ah-hideSm" href="../mesh-gradient/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../grain-overlay/" rel="next" title="Next">Next ›</a><span class="ah-sep ah-hideSm"></span><button type="button" id="ah-copy" class="ah-hideSm">Copy source</button><a class="ah-hideSm" href="https://github.com/matinmonshizadeh/animation-handbook/blob/main/animations/07-ambient-background/aurora/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Aurora / Northern Lights</h1>- <p>Tall color bands drift and skew horizontally — blurred gradient layers faking the waving curtain of light.</p>-</header>-<div class="layout">- <div class="stage" id="stage">- <div class="sky"></div>- <div class="stars-layer" id="stars-layer"></div>- <div class="aurora-wrap">- <div class="band band1" id="band1"></div>- <div class="band band2" id="band2"></div>- <div class="band band3" id="band3"></div>- <div class="band band4" id="band4"></div>- <div class="band band5" id="band5"></div>+<body class="hb" data-hb-kind="loop">+<nav class="hb-bar" aria-label="Animation Handbook">+ <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>+ <span class="hb-pager"><a href="../mesh-gradient/" rel="prev" aria-label="Previous: Mesh Gradient Animation"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Mesh Gradient Animation</span></a><a href="../grain-overlay/" rel="next" aria-label="Next: Grain / Film Noise Overlay"><span><span class="hb-dir">Next: </span>Grain / Film Noise Overlay</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>+</nav>+<main class="hb-page">+ <header class="hb-head">+ <p class="hb-cat">07.03 · Ambient & Background</p>+ <h1>Aurora / Northern Lights</h1>+ <p class="hb-lede">Blurred bands of light sway like the northern lights. Best for dark backgrounds.</p>+ </header>++ <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">1</span>+ <div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement.</p></div>+ </div>+ <div class="stage">+ <div class="sky" aria-hidden="true"></div>+ <div class="stars-layer" id="stars-layer" aria-hidden="true"></div>+ <div class="aurora-wrap" aria-hidden="true">+ <div class="band band1"></div>+ <div class="band band2"></div>+ <div class="band band3"></div>+ <div class="band band4"></div>+ <div class="band band5"></div>+ </div>+ <div class="horizon" aria-hidden="true"></div>+ <div class="fg-card">+ <div class="fg-eyebrow">Aurora</div>+ <div class="fg-title">Charged particles. Magnetic fields. Light.</div>+ <div class="fg-body">Green is oxygen high in the sky; red is rarer, and higher still.</div>+ </div>+ </div>+ <div class="hb-player">+ <button class="hb-play" type="button" id="btn-pause" data-hb-pause="css" data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo="css" autocomplete="off"><span>Slow motion</span></label>+ </div>+ </section>++ <section class="hb-step hb-try" aria-labelledby="hb-try-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">2</span>+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>+ </div>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="count-lbl">Number of bands</p>+ <div class="seg" id="count-seg" role="group" aria-labelledby="count-lbl">+ <button type="button" data-n="2" class="on" aria-pressed="true">2</button>+ <button type="button" data-n="3" aria-pressed="false">3</button>+ <button type="button" data-n="4" aria-pressed="false">4</button>+ <button type="button" data-n="5" aria-pressed="false">5</button>+ </div>+ <p class="hb-hint">More bands make a fuller sky.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="speed-lbl">Speed</p>+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">+ <button type="button" data-secs="48" aria-pressed="false">Slow</button>+ <button type="button" data-secs="30" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-secs="18" aria-pressed="false">Fast</button>+ </div>+ <p class="hb-hint">Longer cycles feel calmer.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="pal-lbl">Colors</p>+ <div class="seg" id="pal-seg" role="group" aria-labelledby="pal-lbl">+ <button type="button" data-pal="classic" class="on" aria-pressed="true">Green</button>+ <button type="button" data-pal="vivid" aria-pressed="false">Purple</button>+ <button type="button" data-pal="rare" aria-pressed="false">Red</button>+ </div>+ <p class="hb-hint">Green is the most common aurora; red is rare.</p>+ </div>+ </div>+ <details class="hb-options">+ <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="bri-lbl">Brightness</p>+ <div class="seg" id="bri-seg" role="group" aria-labelledby="bri-lbl">+ <button type="button" data-op=".5" aria-pressed="false">Dim</button>+ <button type="button" data-op=".75" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-op="1" aria-pressed="false">Bright</button>+ </div>+ <p class="hb-hint">How strongly the bands glow.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Stars in the sky</span><input class="hb-switch" type="checkbox" role="switch" id="stars-tog" autocomplete="off"></label>+ <p class="hb-hint">Adds twinkling stars behind the bands.</p>+ </div>+ </div>+ </details>+ </section>++ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">3</span>+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div></div>- <div class="horizon"></div>- <div class="fg-card">- <div class="fg-eyebrow">Aurora Borealis</div>- <div class="fg-title">Charged particles. Magnetic fields. Light.</div>- <div class="fg-body">Green oxygen at 100km altitude, blue nitrogen below, rare red oxygen above 200km.</div>+ <div class="hb-card">+ <p class="hb-prompt">Add an aurora background to [the dark section you want it behind]. Stack a few tall, wide bands of color that fade to transparent at the top and bottom, blur them softly, and let each one sway sideways and lean a little on its own slow cycle, so they drift apart and together like curtains of light. Make the bands wider than the section and clip them, so their ends never show. Blur less on phones to keep it smooth. If the visitor has reduced motion turned on, keep the bands still. Match the settings listed below.</p>+ <div class="hb-chips-box" hidden>+ <p class="hb-chips-title">Your settings</p>+ <ul class="hb-chips"></ul>+ </div>+ <div class="hb-copy-row">+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>+ </div></div>- </div>- <aside>- <p class="note">Aurora colors are chemistry: green = oxygen at ~100km, red = oxygen above 200km, blue/purple = nitrogen. The visual trick is tall, drifting, blurred vertical bands.</p>- <div class="lbl">Band Count</div>- <div class="sr"><input type="range" id="bands-sl" min="2" max="5" value="2" step="1"><span class="sv" id="bands-v">2</span></div>- <div class="lbl">Speed (cycle)</div>- <div class="sr"><input type="range" id="spd-sl" min="15" max="90" value="30" step="5"><span class="sv" id="spd-v">30s</span></div>- <div class="lbl">Brightness</div>- <div class="sr"><input type="range" id="bri-sl" min="30" max="100" value="75" step="5"><span class="sv" id="bri-v">0.75</span></div>- <div class="lbl">Palette</div>- <select id="pal-sel">- <option value="classic" selected>Classic (green/blue)</option>- <option value="vivid">Vivid (purple/pink)</option>- <option value="rare">Rare red aurora</option>- </select>- <label class="tog"><input type="checkbox" id="stars-tog"><span>Stars in background</span></label>- <div class="div"></div>- <button class="rst" id="pause-btn">⏸ Pause</button>- </aside>-</div>+ </section>++ <section class="hb-about" aria-labelledby="hb-what-title">+ <div class="hb-what">+ <h2 id="hb-what-title">What it is</h2>+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>+ </div>+ <div class="hb-fit">+ <h2>Good for</h2>+ <ul class="hb-tags hb-good"><li>Hero sections</li><li>Night and space themes</li><li>Music and meditation apps</li><li>Travel sites</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Light pages</li><li>Busy layouts</li></ul>+ </div>+ </section>++ <section class="hb-related" aria-labelledby="hb-related-title" hidden>+ <h2 id="hb-related-title">Similar animations</h2>+ <div class="hb-rel-list"></div>+ </section>+</main>+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer><script>const bands=[...document.querySelectorAll('.band')];const starsLayer=document.getElementById('stars-layer');- let paused=false,starsBuilt=false;+ const vars=document.documentElement.style;+ let starsBuilt=false,count=2,palette='classic',secs=30;function buildStars(){if(starsBuilt)return;starsBuilt=true;@@ -153,44 +218,42 @@ body{padding-top:46px}}// Each palette is the band order it prefers (0=green 1=blue 2=purple 3=pink 4=red);- // the count slider takes the first N off that list.+ // Number of bands takes the first N off that list.const PALETTES={classic:[0,1,2,3,4],vivid:[2,3,1,4,0],rare:[4,3,2,1,0]};- function applyPalette(name){- const count=+document.getElementById('bands-sl').value;- const on=new Set(PALETTES[name].slice(0,count));- bands.forEach((b,i)=>{b.style.display=on.has(i)?'block':'none';});+ function applyPalette(){+ const on=new Set(PALETTES[palette].slice(0,count));+ bands.forEach((b,i)=>{b.style.display=on.has(i)?'block':'none'});}- document.getElementById('bands-sl').addEventListener('input',e=>{- document.getElementById('bands-v').textContent=e.target.value;- applyPalette(document.getElementById('pal-sel').value);- });- document.getElementById('spd-sl').addEventListener('input',e=>{- document.getElementById('spd-v').textContent=e.target.value+'s';- document.documentElement.style.setProperty('--dur',e.target.value+'s');- });- document.getElementById('bri-sl').addEventListener('input',e=>{- const v=(e.target.value/100).toFixed(2);document.getElementById('bri-v').textContent=v;- bands.forEach(b=>b.style.opacity=v);+ function choices(id,pick){+ const buttons=document.querySelectorAll('#'+id+' button');+ buttons.forEach(b=>b.addEventListener('click',()=>{+ buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});+ pick(b.dataset);+ }));+ }+ choices('count-seg',d=>{count=+d.n;applyPalette()});+ // A new --dur keeps the time already played, so every band would jump to another point of its cycle.+ // Scaling each band's time by the same factor as its cycle keeps it where it is, moving or paused.+ choices('speed-seg',d=>{+ const next=+d.secs;+ bands.forEach(b=>b.getAnimations().forEach(a=>{if(a.currentTime!=null)a.currentTime=a.currentTime*next/secs}));+ secs=next;+ vars.setProperty('--dur',next+'s');});- document.getElementById('pal-sel').addEventListener('change',e=>applyPalette(e.target.value));+ choices('pal-seg',d=>{palette=d.pal;applyPalette()});+ choices('bri-seg',d=>{bands.forEach(b=>{b.style.opacity=d.op})});document.getElementById('stars-tog').addEventListener('change',e=>{- if(e.target.checked){buildStars();starsLayer.style.display='block';}+ if(e.target.checked){buildStars();starsLayer.style.display='block'}else starsLayer.style.display='none';});- document.getElementById('pause-btn').addEventListener('click',()=>{- paused=!paused;- bands.forEach(b=>b.style.animationPlayState=paused?'paused':'running');- document.getElementById('pause-btn').textContent=paused?'▶ Resume':'⏸ Pause';- });- applyPalette('classic');+ applyPalette();</script>-<script>(function(){var b=document.getElementById("ah-copy");if(!b)return;b.addEventListener("click",function(){fetch(location.href).then(function(r){return r.text();}).catch(function(){return document.documentElement.outerHTML;}).then(function(t){return navigator.clipboard.writeText(t);}).then(function(){b.textContent="Copied!";b.classList.add("ah-copied");setTimeout(function(){b.textContent="Copy source";b.classList.remove("ah-copied");},1500);}).catch(function(){b.textContent="Copy failed";setTimeout(function(){b.textContent="Copy source";},1500);});});})();</script></body></html>diff --git a/index.html b/index.htmlindex 0bfbe69d..9aa535a1 100644--- a/index.html+++ b/index.html@@ -1035,7 +1035,7 @@ const CATS=[entries:[['animated-gradient-background','Animated Gradient Background','Colors slowly drift across a soft gradient background. Best for hero sections.'],['mesh-gradient','Mesh Gradient Animation','Blurred blobs of color drift and melt together. Best for landing pages.'],- ['aurora','Aurora / Northern Lights','Tall color bands drift and skew horizontally — heavy blur fakes the curtain of light.'],+ ['aurora','Aurora / Northern Lights','Blurred bands of light sway like the northern lights. Best for dark backgrounds.'],['grain-overlay','Grain / Film Noise Overlay','Animated noise at 5–10% opacity adds cinematic warmth — subtlety is everything.'],['scanline','Scanline Effect','CRT horizontal lines with optional sweep beam, curvature, and phosphor glow.'],['light-leak','Light Leak','Warm gradient fires at random irregular intervals — analog film camera aesthetic.'],