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 Breathing / Pulsing Glow to the guided-steps page
matina29e03418596
diff --git a/animations/07-ambient-background/breathing-glow/README.md b/animations/07-ambient-background/breathing-glow/README.mdindex 5faa1504..6e30b024 100644--- a/animations/07-ambient-background/breathing-glow/README.md+++ b/animations/07-ambient-background/breathing-glow/README.md@@ -1,7 +1,7 @@# Breathing / Pulsing Glow## What it is-A breathing glow is a radial gradient that slowly expands and contracts on a 4–6 second cycle, mimicking the rhythm of relaxed breathing. The expansion increases the gradient's scale; the contraction returns it. Optional opacity variation (1.0 → 0.7 → 1.0) reinforces the breathing sensation. The effect is used behind "resting" states — a paused music player, an idle AI assistant, a meditation timer — to communicate "alive but at rest."+A breathing glow is a soft, round glow of color that slowly grows and brightens, then shrinks and dims, over and over, like someone breathing calmly. A cycle of four to six seconds matches a relaxed breath. It sits behind things that are alive but at rest, such as a paused music player, an idle voice assistant or a meditation timer.## When to use it- Idle or "rest" states for voice assistants, AI chat interfaces, and ambient computing products@@ -71,10 +71,12 @@ The 2% scale on the center element is intentionally subtle — the eye should no## Key parameters| Parameter | Default | Effect ||-----------|---------|--------|-| Cycle duration | 5s | 2s = anxious; 4–6s = relaxed breath; 8s+ = barely perceptible |-| Min scale | 0.6 | Too low = the glow nearly disappears at minimum |-| Max scale | 1.5 | Too high = the expansion looks alarming rather than calm |-| Glow size | 260px | Base radius of the gradient — larger fills more of the background |+| Speed | Normal | How long one breath takes: slow is 8s, normal 5s and fast 3s; 4 to 6 seconds feels relaxed, 2 seconds anxious |+| How much it grows | Medium | How far the glow shrinks and grows: a little is 80% to 120% of its size, medium 60% to 150% and a lot 45% to 180% |+| Glow color | Blue | The color of the glow: pink, blue, purple, green or orange (white would hide the white title at the breath's peak) |+| Glow size | Medium | The glow's size before it grows: small is 180px, medium 260px and large 340px |+| Second glow | off | A larger, fainter glow behind the first breathes the other way over a longer cycle, so the two never line up |+| Icon and title breathe too | on | The icon and the title under it swell by 2% with each breath, too little to notice consciously |## Production notes- **Why 4–6 seconds?** This range matches the respiratory rate of a relaxed adult (10–15 breaths per minute). Apple's Siri orb uses approximately this range. The match is not accidental — the timing creates a subconscious biofeedback of calm.@@ -84,6 +86,6 @@ The 2% scale on the center element is intentionally subtle — the eye should no- **Framer Motion**: `<motion.div animate={{ scale: [0.6, 1.5, 0.6] }} transition={{ duration: 5, repeat: Infinity, ease: "easeInOut" }} />` — identical result with React.## See also-- [Ambient Ripple](../ambient-ripple/) — pulsing outward rings rather than scaling inward glow-- [Mesh Gradient](../mesh-gradient/) — drifting color wash for a larger-scale ambient background-- [Floating Elements](../floating-elements/) — shapes that drift with subtle opacity pulse+- [Ambient Ripple Effect](../ambient-ripple/) — rings spread out instead of a glow swelling+- [Mesh Gradient Animation](../mesh-gradient/) — soft color drifting across a whole background+- [Floating Elements](../floating-elements/) — shapes that drift and slowly fade in and outdiff --git a/animations/07-ambient-background/breathing-glow/index.html b/animations/07-ambient-background/breathing-glow/index.htmlindex 0227cc4c..8538f1a7 100644--- a/animations/07-ambient-background/breathing-glow/index.html+++ b/animations/07-ambient-background/breathing-glow/index.html@@ -4,7 +4,7 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Breathing / Pulsing Glow — Animation Handbook</title>- <meta name="description" content="Radial gradient expands and contracts on a 5-second cycle — mimicking a slow, relaxed breath.">+ <meta name="description" content="A soft glow slowly grows and shrinks, like calm breathing. Best for idle states."><link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/breathing-glow/"><link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">@@ -12,36 +12,29 @@<meta property="og:type" content="article"><meta property="og:site_name" content="Animation Handbook"><meta property="og:title" content="Breathing / Pulsing Glow — Animation Handbook">- <meta property="og:description" content="Radial gradient expands and contracts on a 5-second cycle — mimicking a slow, relaxed breath.">+ <meta property="og:description" content="A soft glow slowly grows and shrinks, like calm breathing. Best for idle states."><meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/breathing-glow/"><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="Breathing / Pulsing Glow — Animation Handbook">- <meta name="twitter:description" content="Radial gradient expands and contracts on a 5-second cycle — mimicking a slow, relaxed breath.">+ <meta name="twitter:description" content="A soft glow slowly grows and shrinks, like calm breathing. Best for idle states."><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": "Breathing / Pulsing Glow", "name": "Breathing / Pulsing Glow", "description": "Radial gradient expands and contracts on a 5-second cycle — mimicking a slow, relaxed breath.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/breathing-glow/", "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, Breathing / Pulsing Glow"}</script>+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Breathing / Pulsing Glow", "name": "Breathing / Pulsing Glow", "description": "A soft glow slowly grows and shrinks, like calm breathing. Best for idle states.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/breathing-glow/", "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, Breathing / Pulsing Glow"}</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;--glow-dur:5s;--glow-color:#58a6ff;--glow-min:.6;--glow-max:1.5;--glow-size:260px}+ :root{--ui-accent:#ffce5a;--glow-dur:5s;--glow-color:#58a6ff;--glow-min:.6;--glow-max:1.5;--glow-size:260px}*,*::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;background:#020408;display:flex;align-items:center;justify-content:center}- /* Glow layers */+ .stage{position:relative;overflow:hidden;background:#020408;display:flex;align-items:center;justify-content:center}+ /* Glow layers: the second glow leaves the row, so it sits on the stage's centre, behind the first */.glow-wrap{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none}.glow{+ position:relative;z-index:1;width:var(--glow-size);height:var(--glow-size);border-radius:50%;background:radial-gradient(circle,var(--glow-color) 0%,transparent 70%);opacity:.6;filter:blur(40px);animation:breathe var(--glow-dur) ease-in-out infinite}.glow2{+ position:absolute;width:calc(var(--glow-size)*1.5);height:calc(var(--glow-size)*1.5);border-radius:50%;background:radial-gradient(circle,var(--glow-color) 0%,transparent 60%);opacity:.3;filter:blur(60px);@@ -55,114 +48,179 @@/* Center element */.center-el{position:relative;z-index:2;display:flex;flex-direction:column;align-items:center;gap:16px;animation:el-breathe var(--glow-dur) ease-in-out infinite}.center-icon{width:72px;height:72px;border-radius:50%;background:rgba(88,166,255,.15);border:1px solid rgba(88,166,255,.3);display:flex;align-items:center;justify-content:center;font-size:28px}- .center-label{font-size:10px;letter-spacing:3px;text-transform:uppercase;color:rgba(255,255,255,.4)}- .center-title{font-family:Georgia,serif;font-size:clamp(20px,3vw,28px);color:#fff;text-align:center;font-style:italic}+ /* The dark patch keeps the white title readable over the brightest part of the glow */+ .center-title{font-size:clamp(20px,3vw,28px);font-weight:700;color:#fff;text-align:center;padding:0 6px;border-radius:10px;background:rgba(2,4,8,.4);box-shadow:0 0 14px 8px rgba(2,4,8,.4)}@keyframes el-breathe{0%,100%{transform:scale(1);opacity:.9}50%{transform:scale(1.02);opacity:1}}- /* Panel */- 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)}- .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}- input[type=color]{border:none;background:none;width:44px;height:30px;cursor:pointer;border-radius:4px;padding:0}- button.rst{background:transparent;border:1px solid var(--ui-border);color:var(--ui-text);font-family:monospace;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}aside{width:100%}:root{--stage-h:420px}input[type=color]{height:44px}}- @media(prefers-reduced-motion:reduce){.glow,.glow2,.center-el{animation-duration:60s!important}}</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="../starfield/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../ambient-ripple/" 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/breathing-glow/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Breathing / Pulsing Glow</h1>- <p>Radial gradient expands and contracts on a 5-second cycle — mimicking a slow, relaxed breath.</p>-</header>-<div class="layout">- <div class="stage">- <div class="glow-wrap">- <div class="glow" id="glow1"></div>- <div class="glow2" id="glow2"></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="../starfield/" rel="prev" aria-label="Previous: Starfield / Space Particles"><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>Starfield / Space Particles</span></a><a href="../ambient-ripple/" rel="next" aria-label="Next: Ambient Ripple Effect"><span><span class="hb-dir">Next: </span>Ambient Ripple Effect</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.08 · Ambient & Background</p>+ <h1>Breathing / Pulsing Glow</h1>+ <p class="hb-lede">A soft glow slowly grows and shrinks, like calm breathing. Best for idle states.</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="center-el" id="center-el">- <div class="center-icon">✦</div>- <div class="center-label">Breathing glow</div>- <div class="center-title">Rest state</div>+ <div class="stage">+ <div class="glow-wrap" aria-hidden="true">+ <div class="glow"></div>+ <div class="glow2" id="glow2"></div>+ </div>+ <div class="center-el" id="center-el">+ <div class="center-icon" aria-hidden="true">✦</div>+ <div class="center-title">Rest state</div>+ </div></div>- </div>- <aside>- <p class="note">The 4–6 second cycle matches a slow, relaxed breath. Faster = anxious; slower = imperceptible. Use behind idle UI elements, meditation timers, paused media players.</p>- <div class="lbl">Cycle Duration</div>- <div class="sr"><input type="range" id="dur-sl" min="2" max="12" value="5" step="0.5"><span class="sv" id="dur-v">5s</span></div>- <div class="lbl">Min Scale</div>- <div class="sr"><input type="range" id="min-sl" min="40" max="90" value="60" step="5"><span class="sv" id="min-v">0.60</span></div>- <div class="lbl">Max Scale</div>- <div class="sr"><input type="range" id="max-sl" min="100" max="200" value="150" step="10"><span class="sv" id="max-v">1.50</span></div>- <div class="lbl">Glow Size</div>- <div class="sr"><input type="range" id="size-sl" min="100" max="400" value="260" step="20"><span class="sv" id="size-v">260px</span></div>- <div class="lbl">Glow Color</div>- <input type="color" id="color-pick" value="#58a6ff" aria-label="Glow color">- <label class="tog"><input type="checkbox" id="double-tog"><span>Double glow (two layers)</span></label>- <label class="tog"><input type="checkbox" id="el-tog" checked><span>Element breathes too</span></label>- <div class="div"></div>- <button class="rst" id="pause-btn">⏸ Pause</button>- </aside>-</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="speed-lbl">Speed</p>+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">+ <button type="button" data-secs="8" aria-pressed="false">Slow</button>+ <button type="button" data-secs="5" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-secs="3" aria-pressed="false">Fast</button>+ </div>+ <p class="hb-hint">Four to six seconds feels like a calm breath.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="grow-lbl">How much it grows</p>+ <div class="seg" id="grow-seg" role="group" aria-labelledby="grow-lbl">+ <button type="button" data-min="0.8" data-max="1.2" aria-pressed="false">A little</button>+ <button type="button" data-min="0.6" data-max="1.5" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-min="0.45" data-max="1.8" aria-pressed="false">A lot</button>+ </div>+ <p class="hb-hint">Big swings look alarming rather than calm.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="color-lbl">Glow color</p>+ <div class="swatches" id="color-sw" role="group" aria-labelledby="color-lbl">+ <button type="button" aria-pressed="false" aria-label="Pink" data-c="#ff6f8b" style="background:#ff6f8b"></button>+ <button type="button" class="on" aria-pressed="true" aria-label="Blue" data-c="#58a6ff" style="background:#58a6ff"></button>+ <button type="button" aria-pressed="false" aria-label="Purple" data-c="#d2a8ff" style="background:#d2a8ff"></button>+ <button type="button" aria-pressed="false" aria-label="Green" data-c="#56d364" style="background:#56d364"></button>+ <button type="button" aria-pressed="false" aria-label="Orange" data-c="#ffa657" style="background:#ffa657"></button>+ </div>+ <p class="hb-hint">The color of the glow.</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="size-lbl">Glow size</p>+ <div class="seg" id="size-seg" role="group" aria-labelledby="size-lbl">+ <button type="button" data-px="180" aria-pressed="false">Small</button>+ <button type="button" data-px="260" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-px="340" aria-pressed="false">Large</button>+ </div>+ <p class="hb-hint">How big the glow is before it grows.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Second glow</span><input class="hb-switch" type="checkbox" role="switch" id="double-tog" autocomplete="off"></label>+ <p class="hb-hint">A larger, fainter glow breathes out of step.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Icon and title breathe too</span><input class="hb-switch" type="checkbox" role="switch" id="el-tog" checked autocomplete="off"></label>+ <p class="hb-hint">The icon and its title swell very slightly each breath.</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="hb-card">+ <p class="hb-prompt">Add a breathing glow behind [the icon or element that should look alive but at rest]. Place a soft, round, blurred glow of color behind it, and make it slowly grow and brighten, then shrink and dim, over and over, easing gently at both ends like a calm breath. Four to six seconds a breath feels relaxed; much faster feels anxious. When the settings include it, let the element itself swell very slightly with the glow. If the visitor has reduced motion turned on, keep the glow 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>+ </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>Idle states</li><li>Voice assistants</li><li>Meditation apps</li><li>Media players</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Alerts</li><li>Busy screens</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>- let paused=false;- const allAnims=[document.getElementById('glow1'),document.getElementById('glow2'),document.getElementById('center-el')];- document.getElementById('dur-sl').addEventListener('input',e=>{- document.getElementById('dur-v').textContent=e.target.value+'s';- document.documentElement.style.setProperty('--glow-dur',e.target.value+'s');- });- document.getElementById('min-sl').addEventListener('input',e=>{- const v=(e.target.value/100).toFixed(2);document.getElementById('min-v').textContent=v;- document.documentElement.style.setProperty('--glow-min',v);- });- document.getElementById('max-sl').addEventListener('input',e=>{- const v=(e.target.value/100).toFixed(2);document.getElementById('max-v').textContent=v;- document.documentElement.style.setProperty('--glow-max',v);- });- document.getElementById('size-sl').addEventListener('input',e=>{- document.getElementById('size-v').textContent=e.target.value+'px';- document.documentElement.style.setProperty('--glow-size',e.target.value+'px');- });- document.getElementById('color-pick').addEventListener('input',e=>{- document.documentElement.style.setProperty('--glow-color',e.target.value);+ const stage=document.querySelector('.stage');+ const glow=document.querySelector('.glow'),glow2=document.getElementById('glow2'),centre=document.getElementById('center-el');+ const vars=document.documentElement.style;+ let secs=5;++ 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);+ }));+ }+ // A new --glow-dur keeps the time already played, so every layer would jump to another point of its breath.+ // Scaling each animation's time by the same factor as its length keeps the glow where it is, moving or paused.+ choices('speed-seg',d=>{+ const next=+d.secs;+ stage.getAnimations({subtree:true}).forEach(a=>{if(a.currentTime!=null)a.currentTime=a.currentTime*next/secs});+ secs=next;+ vars.setProperty('--glow-dur',next+'s');});+ choices('grow-seg',d=>{vars.setProperty('--glow-min',d.min);vars.setProperty('--glow-max',d.max)});+ choices('color-sw',d=>{vars.setProperty('--glow-color',d.c)});+ choices('size-seg',d=>{vars.setProperty('--glow-size',d.px+'px')});document.getElementById('double-tog').addEventListener('change',e=>{- document.getElementById('glow2').style.display=e.target.checked?'block':'none';+ glow2.style.display=e.target.checked?'block':'none';});document.getElementById('el-tog').addEventListener('change',e=>{- const el=document.getElementById('center-el');- el.style.animation=e.target.checked?'':'none';- el.style.animationPlayState=paused?'paused':'running';- });- document.getElementById('pause-btn').addEventListener('click',()=>{- paused=!paused;- allAnims.forEach(el=>el.style.animationPlayState=paused?'paused':'running');- document.getElementById('pause-btn').textContent=paused?'▶ Resume':'⏸ Pause';+ centre.style.animation=e.target.checked?'':'none';+ // a group that starts breathing again joins the glow at the same point of its breath+ const g=glow.getAnimations()[0],c=centre.getAnimations()[0];+ if(g&&c&&g.currentTime!=null)c.currentTime=g.currentTime;});</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 f0cf222f..362f220c 100644--- a/index.html+++ b/index.html@@ -1040,7 +1040,7 @@ const CATS=[['scanline','Scanline Effect','Dark lines and a sweeping beam imitate an old TV screen. Best for retro sites.'],['light-leak','Light Leak','Warm light washes in from a corner at random times. Best for photo sites.'],['starfield','Starfield / Space Particles','Stars stream toward you out of the dark. Best for space themes.'],- ['breathing-glow','Breathing / Pulsing Glow','Radial glow expands and contracts on a 5-second breath cycle — calm resting state.'],+ ['breathing-glow','Breathing / Pulsing Glow','A soft glow slowly grows and shrinks, like calm breathing. Best for idle states.'],['ambient-ripple','Ambient Ripple Effect','Concentric rings emit periodically from idle sources — passive atmosphere, not click-driven.'],['floating-elements','Floating Elements','Geometric shapes drift on independent sine-wave paths — no two elements synchronized.'],['grid-dot-pattern-parallax','Grid / Dot Pattern Parallax','Pattern shifts subtly opposite to mouse movement — depth felt, barely seen.'],