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 Shimmer Effect to the guided-steps page
matin4717b9177f79
diff --git a/animations/04-micro-interactions/shimmer-effect/README.md b/animations/04-micro-interactions/shimmer-effect/README.mdindex 2885e5e6..c15419d5 100644--- a/animations/04-micro-interactions/shimmer-effect/README.md+++ b/animations/04-micro-interactions/shimmer-effect/README.md@@ -1,7 +1,7 @@# Shimmer Effect## What it is-A shimmer effect is a diagonal or horizontal gradient highlight that sweeps repeatedly across skeleton placeholder blocks. Where a skeleton pulse fades opacity up and down uniformly, a shimmer moves directionally — giving the impression that data is streaming in from one side. It is a more sophisticated loading state that reads as active progress rather than passive waiting.+A shimmer is a band of light that sweeps across gray placeholder shapes again and again while content loads. Where a pulse fades every block up and down together, a shimmer travels in one direction, so the placeholders look like content streaming in.## When to use it- Card and list skeleton loaders where the content streams from a server@@ -9,7 +9,7 @@ A shimmer effect is a diagonal or horizontal gradient highlight that sweeps repe- Any skeleton component where the motion direction matches the data source (left-to-right for left-aligned content)## How it works-A `::after` pseudo-element containing a translucent gradient is positioned absolutely over the skeleton block and translated from `-100%` to `+200%`:+A `::after` pseudo-element holding a translucent gradient covers each skeleton block, and its background position slides from one side to the other:```css:root {@@ -47,20 +47,20 @@ The `background-size: 200% 100%` and position animation gives more control over## Key parameters| Parameter | Default | Effect ||-----------|---------|--------|-| Duration | 1500ms | 1–2s per sweep is the perceptible range; under 800ms feels frantic |-| Brightness | 0.25 | Highlight opacity — 0.1 is subtle, 0.5 is bright-branded |-| Angle | 90° (horizontal) | Diagonal (`-45deg`) can look more dynamic; keep consistent across components |-| Color | White | Gold or blue for branded variants; stay translucent to work on any skeleton bg |+| Speed | Normal | How long one sweep takes: slow is 2.4s, normal 1.5s and fast 0.9s; under about 0.8s it feels frantic |+| Brightness | Medium | How strong the band of light is: soft, medium or bright; soft is subtle, bright suits a branded screen |+| Highlight angle | Upright | Upright sweeps a straight band; Slanted and Diagonal tilt it; keep one angle across the whole page |+| Highlight color | White | White works on any placeholder; blue or gold suit branded screens |## Production notes- **Single direction only**: multiple shimmer components sweeping in different directions simultaneously create visual chaos. All skeletons on a page should shimmer in the same direction.- **`overflow: hidden` required**: the shimmer pseudo-element extends beyond the card. Without overflow clipping, it bleeds into adjacent elements.-- **Combining with pulse**: the demo supports pulse + shimmer together. In practice, pick one — both simultaneously are redundant and visually loud.+- **Combining with pulse**: pick one — a pulse and a shimmer together are redundant and visually loud.- **Performance**: shimmer uses `background-position` animation rather than `transform`. While `transform` is typically preferred, background-position on a GPU-composited layer is acceptably performant. Alternatively, `translateX` with `will-change: transform` on the pseudo-element is the most performant approach.- **CSS-only**: no JavaScript required. The animation is infinite and stops automatically when the element is removed from DOM.- **React**: `react-loading-skeleton` includes shimmer. For custom components, the CSS pattern above is framework-agnostic.## See also-- [Skeleton Loader](../skeleton-loader/) — the underlying placeholder structure shimmer enhances-- [Loading Spinner](../loading-spinner/) — alternative for unknown-duration loads-- [Progress Animation](../progress-animation/) — when duration or percentage is known+- [Skeleton Loader](../skeleton-loader/) — the placeholders pulse instead+- [Loading Spinner](../loading-spinner/) — a spinner for waits of unknown length+- [Progress Animation](../progress-animation/) — a bar that shows how much is donediff --git a/animations/04-micro-interactions/shimmer-effect/index.html b/animations/04-micro-interactions/shimmer-effect/index.htmlindex bb1dc48a..977a1d63 100644--- a/animations/04-micro-interactions/shimmer-effect/index.html+++ b/animations/04-micro-interactions/shimmer-effect/index.html@@ -4,7 +4,7 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Shimmer Effect — Animation Handbook</title>- <meta name="description" content="Gradient sweep over skeleton placeholders — gives the impression of data streaming in.">+ <meta name="description" content="A band of light sweeps over gray placeholders. Best for loading screens."><link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/shimmer-effect/"><link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">@@ -12,30 +12,24 @@<meta property="og:type" content="article"><meta property="og:site_name" content="Animation Handbook"><meta property="og:title" content="Shimmer Effect — Animation Handbook">- <meta property="og:description" content="Gradient sweep over skeleton placeholders — gives the impression of data streaming in.">+ <meta property="og:description" content="A band of light sweeps over gray placeholders. Best for loading screens."><meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/shimmer-effect/"><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="Shimmer Effect — Animation Handbook">- <meta name="twitter:description" content="Gradient sweep over skeleton placeholders — gives the impression of data streaming in.">+ <meta name="twitter:description" content="A band of light sweeps over gray placeholders. Best for loading screens."><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": "Shimmer Effect", "name": "Shimmer Effect", "description": "Gradient sweep over skeleton placeholders — gives the impression of data streaming in.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/shimmer-effect/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Shimmer Effect"}</script>+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Shimmer Effect", "name": "Shimmer Effect", "description": "A band of light sweeps over gray placeholders. Best for loading screens.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/shimmer-effect/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Shimmer Effect"}</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:#ff9d5c;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--shim-dur:1500ms;--shim-bright:0.25;--shim-angle:90deg;--shim-color:255,255,255}+ :root{--ui-accent:#ff9d5c;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--shim-dur:1500ms;--shim-bright:0.25;--shim-angle:90deg;--shim-color:255,255,255}*,*::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;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px}+ .stage{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;background:#0b0b0d}+ /* On a short stage (a phone held sideways) the card and row keep their full height and use the padding instead of shrinking */+ .stage>*{flex-shrink:0}/* Skeleton card */- .skel-card{width:100%;max-width:320px;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:10px;padding:18px;position:relative;overflow:hidden}- .skel-card::after{content:'';position:absolute;inset:0;background:linear-gradient(var(--shim-angle),transparent 25%,rgba(var(--shim-color),var(--shim-bright)) 50%,transparent 75%);animation:shimmer var(--shim-dur) linear infinite;background-size:200% 100%}+ .skel-card{width:100%;max-width:320px;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:10px;padding:14px;position:relative;overflow:hidden}+ /* The band: a translucent gradient over each placeholder, slid across by animating its background position */+ .skel-card::after,.skel-row::after{content:'';position:absolute;inset:0;background:linear-gradient(var(--shim-angle),transparent 25%,rgba(var(--shim-color),var(--shim-bright)) 50%,transparent 75%);animation:shimmer var(--shim-dur) linear infinite;background-size:200% 100%}@keyframes shimmer{from{background-position:200% 0}to{background-position:-200% 0}}.sk{border-radius:4px;background:#1a1f28}.sk-avatar{width:44px;height:44px;border-radius:50%}@@ -43,114 +37,171 @@.sk-line.w100{width:100%}.sk-line.w75{width:75%}.sk-line.w50{width:50%}- .sk-img{width:100%;height:100px;border-radius:6px;margin:12px 0 4px}+ .sk-img{width:100%;height:56px;border-radius:6px;margin:10px 0 2px}.sk-header{display:flex;align-items:center;gap:12px}.sk-header-text{flex:1}/* List row variant */.skel-row{width:100%;max-width:320px;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:8px;padding:14px 16px;display:flex;align-items:center;gap:12px;position:relative;overflow:hidden}- .skel-row::after{content:'';position:absolute;inset:0;background:linear-gradient(var(--shim-angle),transparent 25%,rgba(var(--shim-color),var(--shim-bright)) 50%,transparent 75%);animation:shimmer var(--shim-dur) linear infinite;background-size:200% 100%}.sk-circle{width:36px;height:36px;border-radius:50%;background:#1a1f28;flex-shrink:0}.sk-row-lines{flex:1;display:flex;flex-direction:column;gap:6px}- /* 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)}- 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}- @media(max-width:600px){.layout{flex-direction:column}aside{width:100%}:root{--stage-h:auto}.stage{width:100%;height:auto;min-height:440px}}- @media(prefers-reduced-motion:reduce){.skel-card::after,.skel-row::after{animation:none!important;opacity:.3}}</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="../skeleton-loader/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../loading-spinner/" 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/04-micro-interactions/shimmer-effect/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Shimmer Effect</h1>- <p>Gradient sweep over skeleton placeholders — gives the impression of data streaming in.</p>-</header>-<div class="layout">- <div class="stage">- <div class="skel-card">- <div class="sk-header">- <div class="sk sk-avatar"></div>- <div class="sk-header-text">- <div class="sk sk-line w75"></div>- <div class="sk sk-line w50" style="margin-top:6px"></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="../skeleton-loader/" rel="prev" aria-label="Previous: Skeleton Loader"><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>Skeleton Loader</span></a><a href="../loading-spinner/" rel="next" aria-label="Next: Loading Spinner"><span><span class="hb-dir">Next: </span>Loading Spinner</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">04.10 · Micro-Interactions</p>+ <h1>Shimmer Effect</h1>+ <p class="hb-lede">A band of light sweeps over gray placeholders. Best for loading screens.</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 hb-dots">+ <div class="skel-card">+ <div class="sk-header">+ <div class="sk sk-avatar"></div>+ <div class="sk-header-text">+ <div class="sk sk-line w75"></div>+ <div class="sk sk-line w50" style="margin-top:6px"></div>+ </div>+ </div>+ <div class="sk sk-img"></div>+ <div class="sk sk-line w100"></div>+ <div class="sk sk-line w75"></div>+ </div>+ <div class="skel-row">+ <div class="sk sk-circle"></div>+ <div class="sk-row-lines">+ <div class="sk sk-line w100" style="margin:0"></div>+ <div class="sk sk-line w50" style="margin:0"></div></div></div>- <div class="sk sk-img"></div>- <div class="sk sk-line w100"></div>- <div class="sk sk-line w75"></div></div>- <div class="skel-row">- <div class="sk sk-circle"></div>- <div class="sk-row-lines">- <div class="sk sk-line w100" style="margin:0"></div>- <div class="sk sk-line w50" style="margin:0"></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-ms="2400" aria-pressed="false">Slow</button>+ <button type="button" data-ms="1500" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-ms="900" aria-pressed="false">Fast</button>+ </div>+ <p class="hb-hint">One sweep every one or two seconds feels calm.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="bright-lbl">Brightness</p>+ <div class="seg" id="bright-seg" role="group" aria-labelledby="bright-lbl">+ <button type="button" data-bright="0.12" aria-pressed="false">Soft</button>+ <button type="button" data-bright="0.25" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-bright="0.45" aria-pressed="false">Bright</button>+ </div>+ <p class="hb-hint">How strong the band of light is.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="angle-lbl">Highlight angle</p>+ <div class="seg" id="angle-seg" role="group" aria-labelledby="angle-lbl">+ <button type="button" data-angle="90" class="on" aria-pressed="true">Upright</button>+ <button type="button" data-angle="115" aria-pressed="false">Slanted</button>+ <button type="button" data-angle="135" aria-pressed="false">Diagonal</button>+ </div>+ <p class="hb-hint">The slant of the band as it sweeps across.</p></div></div>- <div class="skel-row">- <div class="sk sk-circle"></div>- <div class="sk-row-lines">- <div class="sk sk-line w100" style="margin:0"></div>- <div class="sk sk-line w75" style="margin:0"></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="color-lbl">Highlight color</p>+ <div class="swatches" id="color-sw" role="group" aria-labelledby="color-lbl">+ <button type="button" class="on" aria-pressed="true" aria-label="White" data-c="255,255,255" style="background:#ffffff"></button>+ <button type="button" aria-pressed="false" aria-label="Blue" data-c="88,166,255" style="background:#58a6ff"></button>+ <button type="button" aria-pressed="false" aria-label="Gold" data-c="255,215,0" style="background:#ffd700"></button>+ </div>+ <p class="hb-hint">Tinted light suits a branded loading screen.</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 shimmer to [the skeleton placeholders on your loading screen]. Lay a band of light over each placeholder and sweep it across in one direction, again and again, so the gray shapes look like content streaming in. Every placeholder on the page should shimmer in the same direction, and each one must clip the band to its own edges so it never spills out. Keep the band see-through so it works on any placeholder color. If the visitor has reduced motion turned on, keep the placeholders 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>- <aside>- <p class="note">The highlight sweeps in one direction — giving the impression data is streaming in from the left. Multiple shimmers in different directions create visual chaos.</p>- <div class="lbl">Sweep Speed</div>- <div class="sr"><input type="range" id="spd-sl" min="800" max="3000" value="1500" step="100"><span class="sv" id="spd-v">1.5s</span></div>- <div class="lbl">Brightness</div>- <div class="sr"><input type="range" id="bright-sl" min="5" max="50" value="25" step="1"><span class="sv" id="bright-v">0.25</span></div>- <div class="lbl">Angle</div>- <div class="sr"><input type="range" id="angle-sl" min="-45" max="135" value="90" step="5"><span class="sv" id="angle-v">90°</span></div>- <div class="lbl">Highlight Color</div>- <select id="color-sel">- <option value="255,255,255" selected>White</option>- <option value="88,166,255">Blue</option>- <option value="255,215,0">Gold</option>- <option value="200,200,200">Silver</option>- </select>- <div class="div"></div>- <p style="font-size:10px;color:var(--ui-muted)">All three skeletons share the same animation — adjust above to see the effect.</p>- </aside>-</div>+ <div class="hb-fit">+ <h2>Good for</h2>+ <ul class="hb-tags hb-good"><li>Feeds</li><li>Cards</li><li>Lists</li><li>Image galleries</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Very short waits</li><li>Busy pages</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('spd-sl').addEventListener('input',e=>{- document.getElementById('spd-v').textContent=(e.target.value/1000).toFixed(1)+'s';- document.documentElement.style.setProperty('--shim-dur',e.target.value+'ms');- });- document.getElementById('bright-sl').addEventListener('input',e=>{- const v=(e.target.value/100).toFixed(2);- document.getElementById('bright-v').textContent=v;- document.documentElement.style.setProperty('--shim-bright',v);- });- document.getElementById('angle-sl').addEventListener('input',e=>{- document.getElementById('angle-v').textContent=e.target.value+'°';- document.documentElement.style.setProperty('--shim-angle',e.target.value+'deg');- });- document.getElementById('color-sel').addEventListener('change',e=>{- document.documentElement.style.setProperty('--shim-color',e.target.value);+ const stage=document.querySelector('.stage');+ const vars=document.documentElement.style;+ let shimMs=1500;++ 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 --shim-dur keeps the time already played, so the band would jump to another point of its sweep.+ // Scaling each animation's time by the same factor as its length keeps the band where it is, moving or paused.+ choices('speed-seg',d=>{+ const next=+d.ms;+ stage.getAnimations({subtree:true}).forEach(a=>{if(a.currentTime!=null)a.currentTime=a.currentTime*next/shimMs});+ shimMs=next;+ vars.setProperty('--shim-dur',next+'ms');});+ choices('bright-seg',d=>{vars.setProperty('--shim-bright',d.bright)});+ choices('angle-seg',d=>{vars.setProperty('--shim-angle',d.angle+'deg')});+ choices('color-sw',d=>{vars.setProperty('--shim-color',d.c)});</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 9d83af93..bdc29776 100644--- a/index.html+++ b/index.html@@ -960,7 +960,7 @@ const CATS=[['heart-burst','Heart / Like Burst','Tap pops and fills the heart while small hearts burst outward on canvas — Twitter-style like.'],['success-confetti','Success Confetti','Completing an action fires a canvas confetti burst — rotating rectangles with gravity and spin.'],['skeleton-loader','Skeleton Loader','Gray shapes hold the place of content while it loads. Best for feeds and cards.'],- ['shimmer-effect','Shimmer Effect','Gradient sweep over skeleton placeholders — gives the impression of data streaming in.'],+ ['shimmer-effect','Shimmer Effect','A band of light sweeps over gray placeholders. Best for loading screens.'],['loading-spinner','Loading Spinner','Six spinner variants from a single CSS color and speed — ring, orbit, arc, bounce, pulse, square.'],['progress-animation','Progress Animation','A bar, a ring and steps fill up to show progress. Best for uploads.'],['checkmark-draw','Checkmark Draw','SVG path draws progressively on success — stroke-dashoffset animates from full length to zero.'],