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: finish converting the Entrance & Exit demos to the shared layout

matin58ccaefb612f
diff --git a/animations/02-entrance-and-exit/blur-in/index.html b/animations/02-entrance-and-exit/blur-in/index.html
index bbb8503a..5cfde549 100644
--- a/animations/02-entrance-and-exit/blur-in/index.html
+++ b/animations/02-entrance-and-exit/blur-in/index.html
@@ -21,11 +21,7 @@
<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": "Blur In", "name": "Blur In", "description": "Fades in while transitioning from blurred to sharp — mimics a camera pulling focus.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/blur-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Blur In"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:700ms;--ease:ease-out;--blur-start:20px;--ty:-8px}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:700ms;--ease:ease-out;--blur-start:20px;--ty:-8px}
*,*::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}
@@ -68,27 +64,12 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column}.stage{flex:none;width:100%}aside{width:100%}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../word-by-word-reveal/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../flip-in/" 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/02-entrance-and-exit/blur-in/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Blur In</h1>
- <p>Fades in while transitioning from blurred to sharp — mimics a camera pulling focus.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../word-by-word-reveal/" rel="prev" aria-label="Previous: Word-by-Word Reveal">‹ <span class="hb-name">Word-by-Word Reveal</span></a><a href="../flip-in/" rel="next" aria-label="Next: Flip In"><span class="hb-name">Flip In</span> ›</a></span></nav>
+<main class="hb-view">
<div class="stage">
<div class="card" id="card" data-mode="blur-fade">
<div class="card-icon">◉</div>
@@ -96,8 +77,14 @@ body{padding-top:46px}
<div class="card-sub">Simultaneous blur reduction and opacity rise. Feels cinematic because it mimics camera optics — avoid on long lists or low-end devices.</div>
</div>
</div>
- <aside>
- <p class="note">Blur-in feels cinematic because it mimics camera focus pulling. GPU-expensive — limit to a single hero element or a small group, not lists.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.10 · Entrance &amp; Exit</p>
+ <h1>Blur In</h1>
+ <p class="hb-lede">Fades in while sharpening from blurred to crisp, like a camera focusing.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>blur</span><span class="v" id="blur-val">20px → 0</span></div>
@@ -122,16 +109,23 @@ body{padding-top:46px}
<option value="cubic-bezier(.2,.7,.3,1)">Smooth</option>
</select>
</div>
- <label class="tog" for="slide-tog"><input type="checkbox" id="slide-tog" checked><span>+ Slight upward translate</span></label>
+ <label class="tog" for="slide-tog"><input type="checkbox" id="slide-tog" checked><span>Slight upward drift</span></label>
<div class="div"></div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
+ <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog" data-hb-skip data-hb-loop><span>Auto-loop</span></label>
<div class="btn-row">
- <button class="act pri" id="btn-in" aria-label="Play blur in">Play in</button>
+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play blur in">Play in</button>
<button class="act" id="btn-out" aria-label="Play out">Play out</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a blur-in entrance to [the element you want to animate]. It should start blurred and transparent, then sharpen into focus while it fades in, like a camera pulling focus onto the subject. It can also drift up slightly as it settles. Use it on one focal element at a time, not on a list or grid, because blur is expensive for the browser to draw. Remove the blur completely once the animation ends. If the visitor has reduced motion turned on, show the element sharp and visible without the effect. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const card=document.getElementById('card');
const stEl=document.getElementById('st'),blurVal=document.getElementById('blur-val');
@@ -167,6 +161,5 @@ body{padding-top:46px}
easeSel.addEventListener('change',()=>document.documentElement.style.setProperty('--ease',easeSel.value));
slideTog.addEventListener('change',()=>document.documentElement.style.setProperty('--ty',slideTog.checked?'-8px':'0px'));
</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/animations/02-entrance-and-exit/flip-in/index.html b/animations/02-entrance-and-exit/flip-in/index.html
index 32f537dc..067b21d9 100644
--- a/animations/02-entrance-and-exit/flip-in/index.html
+++ b/animations/02-entrance-and-exit/flip-in/index.html
@@ -21,11 +21,7 @@
<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": "Flip In", "name": "Flip In", "description": "Rotates from a flat plane into view using CSS 3D perspective — perspective on the parent is the key.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/flip-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Flip In"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:600ms;--ease:ease-out;--persp:1000px;--rot-y:90deg;--rot-x:0deg;--origin:center}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:600ms;--ease:ease-out;--persp:1000px;--rot-y:90deg;--rot-x:0deg;--origin:center}
*,*::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}
@@ -62,27 +58,12 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column}.stage{flex:none}aside{width:100%}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../blur-in/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../bounce-in/" 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/02-entrance-and-exit/flip-in/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Flip In</h1>
- <p>Rotates from a flat plane into view using CSS 3D perspective — perspective on the parent is the key.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../blur-in/" rel="prev" aria-label="Previous: Blur In">‹ <span class="hb-name">Blur In</span></a><a href="../bounce-in/" rel="next" aria-label="Next: Bounce In"><span class="hb-name">Bounce In</span> ›</a></span></nav>
+<main class="hb-view">
<div class="stage" id="stage">
<div class="card" id="card">
<div class="card-icon">⬡</div>
@@ -90,8 +71,14 @@ body{padding-top:46px}
<div class="card-sub">Perspective is set on the parent, not the card. Without it, rotateY looks like a horizontal squash — not a 3D rotation.</div>
</div>
</div>
- <aside>
- <p class="note">Flip-in requires `perspective` on the PARENT element, not the flipping card. The perspective value sets the viewer distance — lower = more dramatic, higher = more subtle.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.11 · Entrance &amp; Exit</p>
+ <h1>Flip In</h1>
+ <p class="hb-lede">Swings into view in 3D, like a hinged card turning toward you.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>Rotation</span><span class="v" id="rot-val">Y: 90°</span></div>
@@ -129,14 +116,21 @@ body{padding-top:46px}
</div>
<label class="tog" for="fade-tog"><input type="checkbox" id="fade-tog" checked><span>Combine with fade</span></label>
<div class="div"></div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
+ <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog" data-hb-skip data-hb-loop><span>Auto-loop</span></label>
<div class="btn-row">
- <button class="act pri" id="btn-in" aria-label="Play flip in">Play in</button>
+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play flip in">Play in</button>
<button class="act" id="btn-out" aria-label="Play flip out">Play out</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a 3D flip-in entrance to [the card you want to animate]. The card should start turned edge-on, like a door seen from the side, and swing toward the viewer until it faces them flat. Give the card's container a 3D perspective so the swing has real depth; without it, the flip looks like a flat squash. The hinge can sit in the middle or along one edge, and the card can fade in while it turns. If the visitor has reduced motion turned on, show the card facing forward without the flip. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const card=document.getElementById('card'),stage=document.getElementById('stage');
const stEl=document.getElementById('st'),rotVal=document.getElementById('rot-val');
@@ -186,6 +180,5 @@ body{padding-top:46px}
fadeTog.addEventListener('change',()=>{card.style.opacity=fadeTog.checked?'':'1'});
applyRot();
</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/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html b/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
index 2123116b..613d681e 100644
--- a/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
+++ b/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
@@ -21,11 +21,7 @@
<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": "Letter-by-Letter Stagger", "name": "Letter-by-Letter Stagger", "description": "Cascade: CSS transition-delay per letter. Typewriter: JS sequential reveal with a blinking cursor.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/letter-by-letter-stagger/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Letter-by-Letter Stagger"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:400ms;--ease:ease-out;--stagger:35ms}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:400ms;--ease:ease-out;--stagger:35ms}
*,*::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}
@@ -69,32 +65,23 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column;align-items:stretch}.stage{flex:none}aside{width:100%}.seg button{min-height:44px}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../split-text-reveal/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../word-by-word-reveal/" 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/02-entrance-and-exit/letter-by-letter-stagger/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Letter-by-Letter Stagger</h1>
- <p>Cascade: CSS transition-delay per letter. Typewriter: JS sequential reveal with a blinking cursor.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../split-text-reveal/" rel="prev" aria-label="Previous: Split Text Reveal">‹ <span class="hb-name">Split Text Reveal</span></a><a href="../word-by-word-reveal/" rel="next" aria-label="Next: Word-by-Word Reveal"><span class="hb-name">Word-by-Word Reveal</span> ›</a></span></nav>
+<main class="hb-view">
<div class="stage">
<div id="text-target" data-mode="cascade" data-anim="fade-up">Hello, world.</div>
</div>
- <aside>
- <p class="note">Letter-by-letter is the most dramatic split, but also the most overused. Reserve it for short phrases (under 30 chars). For longer text, word-level stagger is more legible.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.08 · Entrance &amp; Exit</p>
+ <h1>Letter-by-Letter Stagger</h1>
+ <p class="hb-lede">A phrase assembles one letter at a time, as a cascade or a typewriter.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>Total time</span><span class="v" id="total-time">—</span></div>
@@ -107,7 +94,7 @@ body{padding-top:46px}
<div id="cascade-opts">
<div class="lbl" style="margin-top:4px">Per-letter animation</div>
<div class="seg" id="anim-seg">
- <button data-a="fade-up" class="on">↑Fade</button>
+ <button data-a="fade-up" class="on" aria-label="Fade up">↑Fade</button>
<button data-a="fade">Fade</button>
<button data-a="scale">Scale</button>
<button data-a="rotate">Rotate</button>
@@ -125,11 +112,18 @@ body{padding-top:46px}
</div>
<div class="div"></div>
<div class="btn-row">
- <button class="act pri" id="btn-play" aria-label="Replay">Replay</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act pri" id="btn-play" data-hb-replay aria-label="Replay">Replay</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a letter-by-letter entrance to [a short phrase or headline]. In cascade mode, every letter plays a small entrance a moment after the previous one, so the phrase assembles from left to right. In typewriter mode, the letters appear one at a time behind a blinking cursor, as if someone is typing. Use it only on short phrases, because long text becomes tedious to wait for. Screen readers should hear the whole phrase once, not letter by letter. If the visitor has reduced motion turned on, show the full phrase immediately. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const target=document.getElementById('text-target');
const stEl=document.getElementById('st'),totalEl=document.getElementById('total-time');
@@ -208,6 +202,5 @@ body{padding-top:46px}
txtIn.addEventListener('input',reset);cursorTog.addEventListener('change',reset);
buildSpans();
</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/animations/02-entrance-and-exit/rotate-in/index.html b/animations/02-entrance-and-exit/rotate-in/index.html
index 01cf5c06..69d5bc7a 100644
--- a/animations/02-entrance-and-exit/rotate-in/index.html
+++ b/animations/02-entrance-and-exit/rotate-in/index.html
@@ -21,11 +21,7 @@
<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": "Rotate In", "name": "Rotate In", "description": "Spins while entering — best on radially-symmetric shapes like icons, stars, and gears.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Rotate In"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:600ms;--ease:cubic-bezier(.34,1.56,.64,1);--rot-start:-180deg;--scale-start:0}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:600ms;--ease:cubic-bezier(.34,1.56,.64,1);--rot-start:-180deg;--scale-start:0}
*,*::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}
@@ -65,27 +61,12 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column}.stage{flex:none;width:100%}aside{width:100%}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../bounce-in/" rel="prev" title="Previous">‹ Prev</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/02-entrance-and-exit/rotate-in/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Rotate In</h1>
- <p>Spins while entering — best on radially-symmetric shapes like icons, stars, and gears.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../bounce-in/" rel="prev" aria-label="Previous: Bounce In">‹ <span class="hb-name">Bounce In</span></a></span></nav>
+<main class="hb-view">
<div class="stage">
<div class="icon-wrap">
<div class="icon" id="icon" aria-label="Animated icon">
@@ -98,8 +79,14 @@ body{padding-top:46px}
<div class="icon-label">Landed</div>
</div>
</div>
- <aside>
- <p class="note">Rotate-in is best on radially-symmetric shapes — icons, stars, gears, badges. Avoid on text or rectangles. Scale combined with rotation creates an "arriving" feel, not just spinning in place.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.13 · Entrance &amp; Exit</p>
+ <h1>Rotate In</h1>
+ <p class="hb-lede">Spins into place while growing, best for icons, stars and badges.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>Rotation</span><span class="v" id="rot-display">-180°</span></div>
@@ -109,14 +96,14 @@ body{padding-top:46px}
</div>
<div class="lbl">Extra full rotations</div>
<div class="seg" id="extra-seg">
- <button data-x="0" class="on">0×</button>
- <button data-x="1">+1×</button>
- <button data-x="2">+2×</button>
+ <button data-x="0" class="on" aria-label="No extra turns">0×</button>
+ <button data-x="1" aria-label="One extra turn">+1×</button>
+ <button data-x="2" aria-label="Two extra turns">+2×</button>
</div>
<div class="lbl">Direction</div>
<div class="seg" id="dir-seg">
- <button data-d="ccw" class="on">↺ CCW</button>
- <button data-d="cw">↻ CW</button>
+ <button data-d="ccw" class="on" aria-label="Counter-clockwise">↺ CCW</button>
+ <button data-d="cw" aria-label="Clockwise">↻ CW</button>
</div>
<div><div class="lbl" id="dur-lbl">Duration</div>
<div class="sr"><input type="range" id="dur-sl" aria-labelledby="dur-lbl" min="100" max="2000" value="600" step="50"><span class="sv" id="dur-v">600ms</span></div>
@@ -132,14 +119,21 @@ body{padding-top:46px}
<label class="tog" for="scale-tog"><input type="checkbox" id="scale-tog" checked><span>Combine with scale</span></label>
<label class="tog" for="fade-tog"><input type="checkbox" id="fade-tog" checked><span>Combine with fade</span></label>
<div class="div"></div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
+ <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog" data-hb-skip data-hb-loop><span>Auto-loop</span></label>
<div class="btn-row">
- <button class="act pri" id="btn-in" aria-label="Play rotate in">Play in</button>
+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play rotate in">Play in</button>
<button class="act" id="btn-out" aria-label="Play out">Play out</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a rotate-in entrance to [the icon or badge you want to animate]. It should spin around its center as it appears, growing from small to full size at the same time, so it looks like it is arriving rather than just turning. Let it overshoot slightly and settle, so the spin lands instead of gliding to a stop. Use this on round or symmetric shapes like icons, stars, gears and badges; it looks wrong on text or wide rectangles. If the visitor has reduced motion turned on, show it in place without spinning. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const icon=document.getElementById('icon');
const stEl=document.getElementById('st'),rotDisplay=document.getElementById('rot-display');
@@ -193,6 +187,5 @@ body{padding-top:46px}
scaleTog.addEventListener('change',applyRot);fadeTog.addEventListener('change',applyRot);
applyRot();
</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/animations/02-entrance-and-exit/split-text-reveal/index.html b/animations/02-entrance-and-exit/split-text-reveal/index.html
index 54e8c12a..bb9e2723 100644
--- a/animations/02-entrance-and-exit/split-text-reveal/index.html
+++ b/animations/02-entrance-and-exit/split-text-reveal/index.html
@@ -21,11 +21,7 @@
<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": "Split Text Reveal", "name": "Split Text Reveal", "description": "Text split into chars, words, or lines — each piece animates with a staggered delay via --index.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/split-text-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Split Text Reveal"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:30ms}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:30ms}
*,*::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}
@@ -75,32 +71,23 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column}.stage{flex:none;width:100%}aside{width:100%}.seg button{min-height:44px}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../curtain-reveal/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../letter-by-letter-stagger/" 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/02-entrance-and-exit/split-text-reveal/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Split Text Reveal</h1>
- <p>Text split into chars, words, or lines — each piece animates with a staggered delay via --index.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../curtain-reveal/" rel="prev" aria-label="Previous: Curtain Reveal">‹ <span class="hb-name">Curtain Reveal</span></a><a href="../letter-by-letter-stagger/" rel="next" aria-label="Next: Letter-by-Letter Stagger"><span class="hb-name">Letter-by-Letter Stagger</span> ›</a></span></nav>
+<main class="hb-view">
<div class="stage">
<div id="text-target" class="splitting" data-mode="words" data-anim="fade-up">Design beyond the obvious</div>
</div>
- <aside>
- <p class="note">Wrapping each unit in a span with --index lets transition-delay cascade automatically. Splitting.js is the canonical library; this demo shows the vanilla technique.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.07 · Entrance &amp; Exit</p>
+ <h1>Split Text Reveal</h1>
+ <p class="hb-lede">Text breaks into pieces that animate in one after another.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>Total time</span><span class="v" id="total-time">—</span></div>
@@ -113,7 +100,7 @@ body{padding-top:46px}
</div>
<div class="lbl">Animation per unit</div>
<div class="seg" id="anim-seg">
- <button data-a="fade-up" class="on">↑Fade</button>
+ <button data-a="fade-up" class="on" aria-label="Fade up">↑Fade</button>
<button data-a="fade">Fade</button>
<button data-a="scale">Scale</button>
<button data-a="rotate">Rotate</button>
@@ -136,14 +123,21 @@ body{padding-top:46px}
<input type="text" id="txt-in" value="Design beyond the obvious" aria-label="Edit text">
</div>
<div class="div"></div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
+ <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog" data-hb-skip data-hb-loop><span>Auto-loop</span></label>
<div class="btn-row">
- <button class="act pri" id="btn-in" aria-label="Play reveal">Play in</button>
+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play reveal">Play in</button>
<button class="act" id="btn-out" aria-label="Hide">Play out</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a split-text reveal to [your headline]. Break the text into pieces (characters, words or lines) and animate each piece into view one after another with a short delay between them, so the text flows in as a cascade instead of appearing all at once. Every piece plays the same small entrance, such as fading up from slightly below. Screen readers should still read the text as one normal sentence, not as separate pieces, and the text must not reflow or jump while it animates. If the visitor has reduced motion turned on, show the text immediately. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const target=document.getElementById('text-target');
const stEl=document.getElementById('st'),totalEl=document.getElementById('total-time');
@@ -217,6 +211,5 @@ body{padding-top:46px}
txtIn.addEventListener('input',()=>{reset();split()});
split();
</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/animations/02-entrance-and-exit/word-by-word-reveal/index.html b/animations/02-entrance-and-exit/word-by-word-reveal/index.html
index 5f5e514e..b3a384cd 100644
--- a/animations/02-entrance-and-exit/word-by-word-reveal/index.html
+++ b/animations/02-entrance-and-exit/word-by-word-reveal/index.html
@@ -21,11 +21,7 @@
<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": "Word-by-Word Reveal", "name": "Word-by-Word Reveal", "description": "Words animate sequentially — 80–120ms per word matches comfortable reading speed.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/word-by-word-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Word-by-Word Reveal"}</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:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px;--dur:450ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:80ms}
+ :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#5fd88a;--ui-text:#f4f4f2;--ui-muted:#77777e;--stage-h:620px;--dur:450ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:80ms}
*,*::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}
@@ -63,32 +59,23 @@
@media(hover:hover){button.act:hover{border-color:var(--ui-accent);color:var(--ui-accent)}}
@media(max-width:600px){.layout{flex-direction:column}.stage{flex:none;width:100%}aside{width:100%}:root{--stage-h:480px}}
</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/handbook.css">
+<script src="../../../assets/js/handbook.js" 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="../letter-by-letter-stagger/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../blur-in/" 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/02-entrance-and-exit/word-by-word-reveal/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>
-<header>
- <h1>Word-by-Word Reveal</h1>
- <p>Words animate sequentially — 80–120ms per word matches comfortable reading speed.</p>
-</header>
-<div class="layout">
+<body class="hb" data-hb-autoplay>
+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../letter-by-letter-stagger/" rel="prev" aria-label="Previous: Letter-by-Letter Stagger">‹ <span class="hb-name">Letter-by-Letter Stagger</span></a><a href="../blur-in/" rel="next" aria-label="Next: Blur In"><span class="hb-name">Blur In</span> ›</a></span></nav>
+<main class="hb-view">
<div class="stage">
<div id="text-target" class="splitting" data-anim="fade-up"></div>
</div>
- <aside>
- <p class="note">80–120ms per word matches comfortable reading speed — slower and users wait; faster and the stagger blurs into a single reveal. Use sentence pauses for paragraph reveals.</p>
+ <aside class="hb-side">
+ <header class="hb-head">
+ <p class="hb-cat">02.09 · Entrance &amp; Exit</p>
+ <h1>Word-by-Word Reveal</h1>
+ <p class="hb-lede">Words appear one after another at a comfortable reading pace.</p>
+ </header>
+ <section class="hb-settings" aria-label="Settings">
+ <h2 class="hb-label">Settings</h2>
<div class="lbl">State</div>
<div class="kv"><span>Status</span><span class="v" id="st">hidden</span></div>
<div class="kv"><span>Total time</span><span class="v" id="total-time">—</span></div>
@@ -98,7 +85,7 @@ body{padding-top:46px}
</div>
<div><div class="lbl">Per-word animation</div>
<select id="anim-sel">
- <option value="fade-up" selected>↑ Fade up</option>
+ <option value="fade-up" selected>Fade up</option>
<option value="fade">Fade only</option>
<option value="scale">Scale in</option>
<option value="blur">Blur in</option>
@@ -123,14 +110,21 @@ Tools that feel inevitable.
Software made with care.</textarea>
</div>
<div class="div"></div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
+ <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog" data-hb-skip data-hb-loop><span>Auto-loop</span></label>
<div class="btn-row">
- <button class="act pri" id="btn-in" aria-label="Play reveal">Play in</button>
+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play reveal">Play in</button>
<button class="act" id="btn-out" aria-label="Hide">Play out</button>
- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>
+ <button class="act" id="btn-rst" data-hb-reset aria-label="Reset">Reset</button>
+ </div>
+ </section>
+ <div class="hb-take">
+ <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">
+ <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>
+ <p class="hb-prompt">Add a word-by-word reveal to [the paragraph or quote you want to reveal]. Each word should appear a moment after the one before it, at roughly the pace people read, so the text builds up as if it is being spoken. If sentence pauses are on, wait a little longer at the end of each sentence before continuing. Keep the delay short enough that nobody waits for text they could already read. The full text must stay readable by screen readers and must not reflow while it appears. If the visitor has reduced motion turned on, show all the text at once. Match the settings listed below.</p>
+ </section>
</div>
</aside>
-</div>
+</main>
<script>
const target=document.getElementById('text-target');
const stEl=document.getElementById('st'),totalEl=document.getElementById('total-time');
@@ -193,6 +187,5 @@ Software made with care.</textarea>
txtIn.addEventListener('input',()=>{stopLoop();clearTimeout(animTimer);target.classList.remove('in');buildWords();stEl.textContent='hidden'});
buildWords();
</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/tests/pages.test.js b/tests/pages.test.js
index 59fa2974..cf053f6a 100644
--- a/tests/pages.test.js
+++ b/tests/pages.test.js
@@ -21,11 +21,9 @@ const PILOT = '02-entrance-and-exit';
const PILOT_AUTOPLAY = new Set(['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal',
'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in']);
-test('the converted Entrance & Exit demos include this batch', () => {
- const done = new Set(converted.filter(d => d.cat === PILOT).map(d => d.slug));
- for (const slug of ['bounce-in', 'fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal', 'curtain-reveal']) {
- assert.ok(done.has(slug), `${slug} is converted`);
- }
+test('every Entrance & Exit demo uses the shared layout', () => {
+ const left = demos.filter(d => d.cat === PILOT && !converted.includes(d)).map(d => d.slug);
+ assert.deepEqual(left, []);
});
for (const d of converted) {
diff --git a/tools/migrations/02-entrance-and-exit.json b/tools/migrations/02-entrance-and-exit.json
index d26ba383..bbe07946 100644
--- a/tools/migrations/02-entrance-and-exit.json
+++ b/tools/migrations/02-entrance-and-exit.json
@@ -104,6 +104,86 @@
],
"lede": "A colored panel covers the content, then slides away to reveal it.",
"prompt": "Add a curtain reveal to [the content you want to reveal]. A solid colored panel should slide across and cover the content completely, pause for a beat, then keep going and slide off the far side, leaving the content visible. The pause is what makes the change register, so keep it. In split mode, two panels come in from opposite sides, meet in the middle, then part. Pick a panel color that contrasts strongly with the content. Move the panels rather than resizing them so the motion stays smooth. If the visitor has reduced motion turned on, show the content without the curtain. Match the settings listed below."
+ },
+ {
+ "slug": "split-text-reveal",
+ "number": "02.07",
+ "prev": { "href": "../curtain-reveal/", "name": "Curtain Reveal" },
+ "next": { "href": "../letter-by-letter-stagger/", "name": "Letter-by-Letter Stagger" },
+ "autoplay": true,
+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
+ "edits": [
+ ["<button data-a=\"fade-up\" class=\"on\">↑Fade</button>", "<button data-a=\"fade-up\" class=\"on\" aria-label=\"Fade up\">↑Fade</button>"]
+ ],
+ "lede": "Text breaks into pieces that animate in one after another.",
+ "prompt": "Add a split-text reveal to [your headline]. Break the text into pieces (characters, words or lines) and animate each piece into view one after another with a short delay between them, so the text flows in as a cascade instead of appearing all at once. Every piece plays the same small entrance, such as fading up from slightly below. Screen readers should still read the text as one normal sentence, not as separate pieces, and the text must not reflow or jump while it animates. If the visitor has reduced motion turned on, show the text immediately. Match the settings listed below."
+ },
+ {
+ "slug": "letter-by-letter-stagger",
+ "number": "02.08",
+ "prev": { "href": "../split-text-reveal/", "name": "Split Text Reveal" },
+ "next": { "href": "../word-by-word-reveal/", "name": "Word-by-Word Reveal" },
+ "autoplay": true,
+ "attrs": { "btn-play": "data-hb-replay", "btn-rst": "data-hb-reset" },
+ "edits": [
+ ["<button data-a=\"fade-up\" class=\"on\">↑Fade</button>", "<button data-a=\"fade-up\" class=\"on\" aria-label=\"Fade up\">↑Fade</button>"]
+ ],
+ "lede": "A phrase assembles one letter at a time, as a cascade or a typewriter.",
+ "prompt": "Add a letter-by-letter entrance to [a short phrase or headline]. In cascade mode, every letter plays a small entrance a moment after the previous one, so the phrase assembles from left to right. In typewriter mode, the letters appear one at a time behind a blinking cursor, as if someone is typing. Use it only on short phrases, because long text becomes tedious to wait for. Screen readers should hear the whole phrase once, not letter by letter. If the visitor has reduced motion turned on, show the full phrase immediately. Match the settings listed below."
+ },
+ {
+ "slug": "word-by-word-reveal",
+ "number": "02.09",
+ "prev": { "href": "../letter-by-letter-stagger/", "name": "Letter-by-Letter Stagger" },
+ "next": { "href": "../blur-in/", "name": "Blur In" },
+ "autoplay": true,
+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
+ "edits": [
+ [">↑ Fade up</option>", ">Fade up</option>"]
+ ],
+ "lede": "Words appear one after another at a comfortable reading pace.",
+ "prompt": "Add a word-by-word reveal to [the paragraph or quote you want to reveal]. Each word should appear a moment after the one before it, at roughly the pace people read, so the text builds up as if it is being spoken. If sentence pauses are on, wait a little longer at the end of each sentence before continuing. Keep the delay short enough that nobody waits for text they could already read. The full text must stay readable by screen readers and must not reflow while it appears. If the visitor has reduced motion turned on, show all the text at once. Match the settings listed below."
+ },
+ {
+ "slug": "blur-in",
+ "number": "02.10",
+ "prev": { "href": "../word-by-word-reveal/", "name": "Word-by-Word Reveal" },
+ "next": { "href": "../flip-in/", "name": "Flip In" },
+ "autoplay": true,
+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
+ "edits": [
+ ["<span>+ Slight upward translate</span>", "<span>Slight upward drift</span>"]
+ ],
+ "lede": "Fades in while sharpening from blurred to crisp, like a camera focusing.",
+ "prompt": "Add a blur-in entrance to [the element you want to animate]. It should start blurred and transparent, then sharpen into focus while it fades in, like a camera pulling focus onto the subject. It can also drift up slightly as it settles. Use it on one focal element at a time, not on a list or grid, because blur is expensive for the browser to draw. Remove the blur completely once the animation ends. If the visitor has reduced motion turned on, show the element sharp and visible without the effect. Match the settings listed below."
+ },
+ {
+ "slug": "flip-in",
+ "number": "02.11",
+ "prev": { "href": "../blur-in/", "name": "Blur In" },
+ "next": { "href": "../bounce-in/", "name": "Bounce In" },
+ "autoplay": true,
+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
+ "edits": [],
+ "lede": "Swings into view in 3D, like a hinged card turning toward you.",
+ "prompt": "Add a 3D flip-in entrance to [the card you want to animate]. The card should start turned edge-on, like a door seen from the side, and swing toward the viewer until it faces them flat. Give the card's container a 3D perspective so the swing has real depth; without it, the flip looks like a flat squash. The hinge can sit in the middle or along one edge, and the card can fade in while it turns. If the visitor has reduced motion turned on, show the card facing forward without the flip. Match the settings listed below."
+ },
+ {
+ "slug": "rotate-in",
+ "number": "02.13",
+ "prev": { "href": "../bounce-in/", "name": "Bounce In" },
+ "next": null,
+ "autoplay": true,
+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
+ "edits": [
+ ["<button data-x=\"0\" class=\"on\">0×</button>", "<button data-x=\"0\" class=\"on\" aria-label=\"No extra turns\">0×</button>"],
+ ["<button data-x=\"1\">+1×</button>", "<button data-x=\"1\" aria-label=\"One extra turn\">+1×</button>"],
+ ["<button data-x=\"2\">+2×</button>", "<button data-x=\"2\" aria-label=\"Two extra turns\">+2×</button>"],
+ ["<button data-d=\"ccw\" class=\"on\">↺ CCW</button>", "<button data-d=\"ccw\" class=\"on\" aria-label=\"Counter-clockwise\">↺ CCW</button>"],
+ ["<button data-d=\"cw\">↻ CW</button>", "<button data-d=\"cw\" aria-label=\"Clockwise\">↻ CW</button>"]
+ ],
+ "lede": "Spins into place while growing, best for icons, stars and badges.",
+ "prompt": "Add a rotate-in entrance to [the icon or badge you want to animate]. It should spin around its center as it appears, growing from small to full size at the same time, so it looks like it is arriving rather than just turning. Let it overshoot slightly and settle, so the spin lands instead of gliding to a stop. Use this on round or symmetric shapes like icons, stars, gears and badges; it looks wrong on text or wide rectangles. If the visitor has reduced motion turned on, show it in place without spinning. Match the settings listed below."
}
]
}