Skip to content

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.

feat: move Glassmorphism Animated to the guided-steps page

matin1507a0f982c6
diff --git a/animations/06-3d-advanced/glassmorphism-animated/README.md b/animations/06-3d-advanced/glassmorphism-animated/README.md
index 0ff7039f..5584d0a6 100644
--- a/animations/06-3d-advanced/glassmorphism-animated/README.md
+++ b/animations/06-3d-advanced/glassmorphism-animated/README.md
@@ -1,7 +1,7 @@
# Glassmorphism Animated
## What it is
-Glassmorphism is a UI style where interface elements appear as frosted glass — semi-transparent, blurred backgrounds with subtle light borders. The CSS `backdrop-filter: blur()` property applies the blur to whatever is rendered behind the element. Animating the background blobs, blur intensity, or frost tint color adds a living quality to glass panels that static glassmorphism lacks.
+Glassmorphism styles a card as frosted glass: a see-through tint, a blur of whatever sits behind it, and a thin light edge. It only works when something colorful moves behind the glass, so the demo drifts soft color blobs behind three cards: one with a still frost, one whose blur breathes, and one whose tint slowly changes.
## When to use it
- SaaS dashboards and product landing pages where glass cards display metrics or features
@@ -52,19 +52,21 @@ Three CSS properties create the glass effect:
## Key parameters
| Parameter | Default | Effect |
|-----------|---------|--------|
-| Blur intensity | 12px | 4–8px = subtle; 16–24px = heavy frost; above 30px degrades text legibility |
-| Glass opacity | 0.12 | 0.05 = nearly invisible tint; 0.25 = heavily tinted |
-| Blob speed | 8s | Faster blob motion = more active glass content; slower = calm |
-| Border opacity | 0.18 | The subtle edge is what sells "glass" — reducing to 0 makes it look plastic |
+| Frost | Medium | How strongly the glass blurs what is behind it: light is 6px, medium 12px and heavy 20px; off shows the cards with no blur, to compare |
+| Tint strength | Medium | How much color the glass adds: faint is 6%, medium 12% and strong 25% |
+| Speed | Normal | How long the colors behind take to drift through one path: slow is 13s, normal 8s and fast 5s |
+| Tint color | Blue | The color of the glass |
+| Breathing frost | on | The middle card's blur grows from 8px to 20px and back every 4 seconds |
+| Shifting tint | on | The right card's tint moves through blue, green, purple and orange every 8 seconds |
## Production notes
- **`backdrop-filter` is GPU-expensive**: the browser must capture a snapshot of everything behind the element and blur it every frame. On large glass surfaces or low-end hardware this causes frame drops. Keep glass cards small; avoid full-screen glass overlays.
- **`-webkit-` prefix still required**: Safari needs `-webkit-backdrop-filter` even in 2024. Include both the prefixed and unprefixed property.
- **The backdrop must have content**: `backdrop-filter` blurs what is behind the element. If the background is a solid color, the blur does nothing — the glass looks like dirty plastic. Colorful, high-contrast content behind the glass is required for the effect to be visible.
- **Dark mode**: glassmorphism requires a dark-enough background to read as glass rather than a white haze. The effect works better on dark themes.
-- **Disable for performance audit**: the demo includes a toggle to disable `backdrop-filter`. Use this to compare performance — if the site is noticeably faster without it, reconsider the design.
+- **Compare with the blur off**: the demo's Frost setting has an Off choice. If the page is noticeably faster without the blur, reconsider the design.
## See also
-- [WebGL Shader Animation](../webgl-shader-animation/) — GPU-based alternative for animated backgrounds
-- [Noise-Based Motion](../noise-based-motion/) — canvas-based animated background
-- [Modal Expand](../../04-micro-interactions/modal-expand/) — glassmorphism is often applied to modal overlays
+- [Mesh Gradient Animation](../../07-ambient-background/mesh-gradient/) — soft color blobs drifting as a background
+- [WebGL Shader Animation](../webgl-shader-animation/) — moving color drawn on the graphics chip
+- [Modal Expand](../../04-micro-interactions/modal-expand/) — a dialog, where frosted glass often appears
diff --git a/animations/06-3d-advanced/glassmorphism-animated/index.html b/animations/06-3d-advanced/glassmorphism-animated/index.html
index 74c6f188..243200c7 100644
--- a/animations/06-3d-advanced/glassmorphism-animated/index.html
+++ b/animations/06-3d-advanced/glassmorphism-animated/index.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glassmorphism Animated — Animation Handbook</title>
- <meta name="description" content="Frosted glass cards over animated gradient blobs — backdrop-filter: blur() + semi-transparent background.">
+ <meta name="description" content="Frosted glass cards blur the colors behind them. Best for cards and panels.">
<link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/glassmorphism-animated/">
<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="Glassmorphism Animated — Animation Handbook">
- <meta property="og:description" content="Frosted glass cards over animated gradient blobs — backdrop-filter: blur() + semi-transparent background.">
+ <meta property="og:description" content="Frosted glass cards blur the colors behind them. Best for cards and panels.">
<meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/glassmorphism-animated/">
<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="Glassmorphism Animated — Animation Handbook">
- <meta name="twitter:description" content="Frosted glass cards over animated gradient blobs — backdrop-filter: blur() + semi-transparent background.">
+ <meta name="twitter:description" content="Frosted glass cards blur the colors behind them. Best for cards and panels.">
<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": "Glassmorphism Animated", "name": "Glassmorphism Animated", "description": "Frosted glass cards over animated gradient blobs — backdrop-filter: blur() + semi-transparent background.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/glassmorphism-animated/", "inLanguage": "en", "articleSection": "3D & Advanced", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, 3D & Advanced, Glassmorphism Animated"}</script>
+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Glassmorphism Animated", "name": "Glassmorphism Animated", "description": "Frosted glass cards blur the colors behind them. Best for cards and panels.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/glassmorphism-animated/", "inLanguage": "en", "articleSection": "3D & Advanced", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, 3D & Advanced, Glassmorphism Animated"}</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:#3fd6c4;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--blur:12px;--glass-op:0.12;--blob-spd:8s;--tint:rgba(88,166,255,var(--glass-op))}
+ :root{--ui-accent:#3fd6c4;--blur:12px;--glass-op:0.12;--blob-spd:8s;--tint:rgba(88,166,255,var(--glass-op))}
*,*::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;letter-spacing:-.01em;font-size:clamp(11px,1.8vw,15px)}
- 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;display:flex;align-items:center;justify-content:center;gap:16px;padding:24px;flex-wrap:wrap}
+ .stage{position:relative;display:flex;align-items:center;justify-content:center;gap:16px;padding:24px;flex-wrap:wrap;background:#0b0b0d}
/* Animated gradient blobs behind everything */
.blob{position:absolute;border-radius:50%;filter:blur(60px);opacity:.75;animation:blob-move var(--blob-spd) ease-in-out infinite alternate}
.b1{width:280px;height:280px;background:#58a6ff;top:-80px;left:-60px;animation-delay:0s}
@@ -45,32 +36,16 @@
66%{transform:translate(-20px,40px) scale(.95)}
100%{transform:translate(30px,10px) scale(1.05)}
}
- /* Glass cards */
- .glass-card{position:relative;z-index:1;width:clamp(140px,22%,180px);min-height:200px;border-radius:16px;padding:20px 16px;display:flex;flex-direction:column;gap:8px}
- .glass-card.g1{
+ /* Glass cards: all three share the glass; the middle one breathes and the right one shifts its tint */
+ .glass-card{position:relative;z-index:1;width:clamp(140px,22%,180px);min-height:200px;border-radius:16px;padding:20px 16px;display:flex;flex-direction:column;gap:8px;
background:var(--tint);
backdrop-filter:blur(var(--blur)) saturate(1.8);
-webkit-backdrop-filter:blur(var(--blur)) saturate(1.8);
border:1px solid rgba(255,255,255,.18);
- box-shadow:0 8px 32px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.2)
- }
- .glass-card.g2{
- background:var(--tint);
- backdrop-filter:blur(var(--blur)) saturate(1.8);
- -webkit-backdrop-filter:blur(var(--blur)) saturate(1.8);
- border:1px solid rgba(255,255,255,.18);
- box-shadow:0 8px 32px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.2);
- animation:blur-breath 4s ease-in-out infinite
- }
- .glass-card.g3{
- background:var(--tint);
- backdrop-filter:blur(var(--blur)) saturate(1.8);
- -webkit-backdrop-filter:blur(var(--blur)) saturate(1.8);
- border:1px solid rgba(255,255,255,.18);
- box-shadow:0 8px 32px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.2);
- animation:tint-cycle 8s linear infinite
- }
- /* !important so the perf toggle also beats the blur-breath keyframes on card 2 */
+ box-shadow:0 8px 32px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.2)}
+ .glass-card.g2{animation:blur-breath 4s ease-in-out infinite}
+ .glass-card.g3{animation:tint-cycle 8s linear infinite}
+ /* !important so Frost's Off also beats the blur-breath keyframes on card 2 */
.stage.no-bf .glass-card{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
@keyframes blur-breath{
0%,100%{backdrop-filter:blur(8px) saturate(1.8);-webkit-backdrop-filter:blur(8px) saturate(1.8)}
@@ -79,121 +54,195 @@
@keyframes tint-cycle{
0%{background:rgba(88,166,255,var(--glass-op))}25%{background:rgba(86,211,100,var(--glass-op))}50%{background:rgba(210,168,255,var(--glass-op))}75%{background:rgba(255,166,87,var(--glass-op))}100%{background:rgba(88,166,255,var(--glass-op))}
}
- .card-tag{font-size:9px;letter-spacing:2px;text-transform:uppercase;color:rgba(255,255,255,.5)}
- .card-title{font-size:clamp(13px,1.8vw,16px);font-weight:bold;color:#fff;line-height:1.2}
- .card-body{font-size:10px;color:rgba(255,255,255,.6);line-height:1.6;margin-top:4px}
- .card-badge{margin-top:auto;font-size:9px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.2);border-radius:10px;padding:4px 10px;color:rgba(255,255,255,.7);width:fit-content}
- /* Side 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:40px;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}
- .kv{display:flex;justify-content:space-between;font-size:10px;color:var(--ui-muted)}
- .kv .v{color:var(--ui-text)}
- input[type=color]{border:none;background:none;width:44px;height:44px;cursor:pointer;border-radius:4px;padding:0}
- @media(max-width:600px){.layout{flex-direction:column}aside{width:100%}:root{--stage-h:auto}.stage{height:auto;min-height:460px}.blob{filter:blur(36px)}}
- @media(prefers-reduced-motion:reduce){.blob,.glass-card.g2,.glass-card.g3{animation:none!important}}
+ .card-tag{font-size:11px;font-weight:600;letter-spacing:2px;text-transform:uppercase;color:rgba(255,255,255,.5)}
+ .card-title{font-size:clamp(13px,1.8vw,16px);font-weight:700;color:#fff;line-height:1.2}
+ .card-body{font-size:13px;color:rgba(255,255,255,.72);line-height:1.6;margin-top:4px}
+ /* Phones: the three cards share one row, so all of them show on the shorter stage */
+ @media(max-width:600px){
+ .blob{filter:blur(36px)}
+ .stage{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-content:center;align-items:stretch;gap:8px;padding:12px}
+ .glass-card{width:auto;min-width:0;min-height:0;padding:12px 8px;border-radius:12px;gap:6px}
+ .card-title{font-size:13px}
+ .card-tag{font-size:10px;letter-spacing:1px}
+ .card-body{font-size:12px;line-height:1.4}
+ }
</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="../fluid-simulation/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../webgl-shader-animation/" 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/06-3d-advanced/glassmorphism-animated/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Glassmorphism Animated</h1>
- <p>Frosted glass cards over animated gradient blobs — backdrop-filter: blur() + semi-transparent background.</p>
-</header>
-<div class="layout">
- <div class="stage" id="stage">
- <div class="blob b1"></div>
- <div class="blob b2"></div>
- <div class="blob b3"></div>
- <div class="blob b4"></div>
- <div class="glass-card g1">
- <div class="card-tag">Static</div>
- <div class="card-title">Fixed Frost</div>
- <div class="card-body">Constant blur at the configured intensity. The baseline glass effect.</div>
- <div class="card-badge">backdrop-filter: blur</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="../fluid-simulation/" rel="prev" aria-label="Previous: Fluid / Liquid Simulation"><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>Fluid / Liquid Simulation</span></a><a href="../webgl-shader-animation/" rel="next" aria-label="Next: WebGL Shader Animation"><span><span class="hb-dir">Next: </span>WebGL Shader Animation</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">06.06 · 3D &amp; Advanced</p>
+ <h1>Glassmorphism Animated</h1>
+ <p class="hb-lede">Frosted glass cards blur the colors behind them. Best for cards and panels.</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" id="stage">
+ <div class="blob b1" aria-hidden="true"></div>
+ <div class="blob b2" aria-hidden="true"></div>
+ <div class="blob b3" aria-hidden="true"></div>
+ <div class="blob b4" aria-hidden="true"></div>
+ <div class="glass-card g1">
+ <div class="card-tag">Still</div>
+ <div class="card-title">Fixed frost</div>
+ <div class="card-body">The blur stays the same.</div>
+ </div>
+ <div class="glass-card g2">
+ <div class="card-tag">Animated</div>
+ <div class="card-title">Breathing frost</div>
+ <div class="card-body">The blur grows and fades.</div>
+ </div>
+ <div class="glass-card g3">
+ <div class="card-tag">Shifting</div>
+ <div class="card-title">Shifting tint</div>
+ <div class="card-body">The tint keeps changing.</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="frost-lbl">Frost</p>
+ <div class="seg" id="frost-seg" role="group" aria-labelledby="frost-lbl">
+ <button type="button" data-blur="off" aria-pressed="false">Off</button>
+ <button type="button" data-blur="6px" aria-pressed="false">Light</button>
+ <button type="button" data-blur="12px" class="on" aria-pressed="true">Medium</button>
+ <button type="button" data-blur="20px" aria-pressed="false">Heavy</button>
+ </div>
+ <p class="hb-hint">How strongly the glass blurs what is behind it.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="op-lbl">Tint strength</p>
+ <div class="seg" id="op-seg" role="group" aria-labelledby="op-lbl">
+ <button type="button" data-op="0.06" aria-pressed="false">Faint</button>
+ <button type="button" data-op="0.12" class="on" aria-pressed="true">Medium</button>
+ <button type="button" data-op="0.25" aria-pressed="false">Strong</button>
+ </div>
+ <p class="hb-hint">How much color the glass adds.</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-spd="13s" aria-pressed="false">Slow</button>
+ <button type="button" data-spd="8s" class="on" aria-pressed="true">Normal</button>
+ <button type="button" data-spd="5s" aria-pressed="false">Fast</button>
+ </div>
+ <p class="hb-hint">How fast the colors drift behind the glass.</p>
+ </div>
</div>
- <div class="glass-card g2">
- <div class="card-tag">Animated</div>
- <div class="card-title">Breathing Frost</div>
- <div class="card-body">Blur cycles 8px → 20px → 8px — the frost intensifies and recedes.</div>
- <div class="card-badge">animation: blur-breath</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="tint-lbl">Tint color</p>
+ <div class="swatches" id="tint-sw" role="group" aria-labelledby="tint-lbl">
+ <button type="button" aria-pressed="false" aria-label="Pink" data-color="#ff6f8b" style="background:#ff6f8b"></button>
+ <button type="button" aria-pressed="false" aria-label="White" data-color="#f4f4f2" style="background:#f4f4f2"></button>
+ <button type="button" class="on" aria-pressed="true" aria-label="Blue" data-color="#58a6ff" style="background:#58a6ff"></button>
+ <button type="button" aria-pressed="false" aria-label="Purple" data-color="#d2a8ff" style="background:#d2a8ff"></button>
+ <button type="button" aria-pressed="false" aria-label="Green" data-color="#56d364" style="background:#56d364"></button>
+ <button type="button" aria-pressed="false" aria-label="Orange" data-color="#ffa657" style="background:#ffa657"></button>
+ </div>
+ <p class="hb-hint">The color of the glass.</p>
+ </div>
+ <div class="hb-setting">
+ <label class="hb-switch-row"><span>Breathing frost</span><input class="hb-switch" type="checkbox" role="switch" id="breath-tog" checked autocomplete="off"></label>
+ <p class="hb-hint">The middle card's blur grows and fades.</p>
+ </div>
+ <div class="hb-setting">
+ <label class="hb-switch-row"><span>Shifting tint</span><input class="hb-switch" type="checkbox" role="switch" id="shift-tog" checked autocomplete="off"></label>
+ <p class="hb-hint">The right card slowly changes color.</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="glass-card g3">
- <div class="card-tag">Shifting</div>
- <div class="card-title">Tint Cycle</div>
- <div class="card-body">Frost color rotates through the palette over 8 seconds.</div>
- <div class="card-badge">animation: tint-cycle</div>
+ <div class="hb-card">
+ <p class="hb-prompt">Add frosted glass to [the cards or panels you want to style]. Give each card a see-through tinted background, blur whatever sits behind it, and add a thin light edge, so it looks like frosted glass. Put colorful shapes that drift slowly behind the cards, because glass over a plain background just looks grey. A card can also breathe, its blur growing and fading, or slowly change its tint. Blurring what is behind costs a lot, so keep the glass to small cards and blur the background shapes less on phones. If the visitor has reduced motion turned on, keep everything 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">Glass needs interesting content behind it. Without colorful blobs, glass looks like dirty plastic. backdrop-filter is GPU-expensive — limit to small UI cards.</p>
- <div class="lbl">Blur Intensity</div>
- <div class="sr"><input type="range" id="blur-sl" min="0" max="30" value="12" step="1"><span class="sv" id="blur-v">12px</span></div>
- <div class="lbl">Glass Opacity</div>
- <div class="sr"><input type="range" id="op-sl" min="3" max="40" value="12" step="1"><span class="sv" id="op-v">0.12</span></div>
- <div class="lbl">Blob Speed</div>
- <div class="sr"><input type="range" id="spd-sl" min="2" max="20" value="8" step="1"><span class="sv" id="spd-v">8s</span></div>
- <div class="lbl">Frost Tint</div>
- <input type="color" id="tint-pick" value="#58a6ff" aria-label="Tint color">
- <label class="tog"><input type="checkbox" id="blur-tog" checked><span>Animated blur (card 2)</span></label>
- <label class="tog"><input type="checkbox" id="tint-tog" checked><span>Tint cycle (card 3)</span></label>
- <div class="div"></div>
- <label class="tog"><input type="checkbox" id="perf-tog"><span>Disable backdrop-filter</span></label>
- <div class="kv"><span>Effect</span><span class="v" id="perf-v">Active</span></div>
- </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>Cards and panels</li><li>Dashboards</li><li>Modals</li><li>Navigation bars</li></ul>
+ <h3>Avoid on</h3>
+ <ul class="hb-tags hb-avoid"><li>Plain backgrounds</li><li>Large surfaces</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>
- document.getElementById('blur-sl').addEventListener('input',e=>{
- document.getElementById('blur-v').textContent=e.target.value+'px';
- document.documentElement.style.setProperty('--blur',e.target.value+'px');
- });
- document.getElementById('op-sl').addEventListener('input',e=>{
- const v=(e.target.value/100).toFixed(2);
- document.getElementById('op-v').textContent=v;
- document.documentElement.style.setProperty('--glass-op',v);
+ const root=document.documentElement.style;
+ const stage=document.getElementById('stage');
+ 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);
+ }));
+ }
+ // Off keeps the last blur in --blur, so choosing a strength again brings it back
+ choices('frost-seg',d=>{
+ stage.classList.toggle('no-bf',d.blur==='off');
+ if(d.blur!=='off')root.setProperty('--blur',d.blur);
});
- document.getElementById('spd-sl').addEventListener('input',e=>{
- document.getElementById('spd-v').textContent=e.target.value+'s';
- document.documentElement.style.setProperty('--blob-spd',e.target.value+'s');
+ choices('op-seg',d=>{root.setProperty('--glass-op',d.op)});
+ choices('speed-seg',d=>{root.setProperty('--blob-spd',d.spd)});
+ choices('tint-sw',d=>{
+ const r=parseInt(d.color.slice(1,3),16);
+ const g=parseInt(d.color.slice(3,5),16);
+ const b=parseInt(d.color.slice(5,7),16);
+ root.setProperty('--tint',`rgba(${r},${g},${b},var(--glass-op))`);
});
- document.getElementById('tint-pick').addEventListener('input',e=>{
- const r=parseInt(e.target.value.slice(1,3),16);
- const g=parseInt(e.target.value.slice(3,5),16);
- const b=parseInt(e.target.value.slice(5,7),16);
- document.documentElement.style.setProperty('--tint',`rgba(${r},${g},${b},var(--glass-op))`);
- });
- /* 'none' (not 'paused') so the card falls back to the slider/picker values while off */
- document.getElementById('blur-tog').addEventListener('change',e=>{
+ /* 'none' (not 'paused') so the card falls back to the Frost and Tint settings while off */
+ document.getElementById('breath-tog').addEventListener('change',e=>{
document.querySelector('.g2').style.animation=e.target.checked?'':'none';
});
- document.getElementById('tint-tog').addEventListener('change',e=>{
+ document.getElementById('shift-tog').addEventListener('change',e=>{
document.querySelector('.g3').style.animation=e.target.checked?'':'none';
});
- document.getElementById('perf-tog').addEventListener('change',e=>{
- const v=e.target.checked;
- document.getElementById('perf-v').textContent=v?'Disabled (compare)':'Active';
- document.getElementById('stage').classList.toggle('no-bf',v);
- });
</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.html
index 936558b4..db7617c1 100644
--- a/index.html
+++ b/index.html
@@ -1013,7 +1013,7 @@ const CATS=[
['parallax-3d-tilt','Parallax 3D Tilt','CSS perspective + rotateX/Y follows mouse — a shine highlight tracks the virtual light source.'],
['canvas-particle-effect','Canvas Particle Effect','Dots drift, link up when close, and dodge your pointer. Best for tech sites.'],
['fluid-simulation','Fluid Simulation','Blobs drift and melt into each other like liquid. Best for hero backgrounds.'],
- ['glassmorphism-animated','Glassmorphism Animated','backdrop-filter: blur() over animated gradient blobs — three frost variants.'],
+ ['glassmorphism-animated','Glassmorphism Animated','Frosted glass cards blur the colors behind them. Best for cards and panels.'],
['webgl-shader-animation','WebGL Shader Animation','Four GLSL fragment shader presets: plasma, wave distortion, Voronoi, kaleidoscope.'],
['noise-based-motion','Noise-Based Motion','Simplex noise drives a wind field and a morphing blob — smooth random, not chaotic random.'],
['svg-path-animation','SVG Path Animation','stroke-dashoffset reveals three SVG drawings — icon, signature, and logo mark.'],