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: convert six more Entrance & Exit demos to the shared layout
matincc9dfd2a20cf
diff --git a/animations/02-entrance-and-exit/clip-path-reveal/index.html b/animations/02-entrance-and-exit/clip-path-reveal/index.htmlindex 8656b502..879e71c4 100644--- a/animations/02-entrance-and-exit/clip-path-reveal/index.html+++ b/animations/02-entrance-and-exit/clip-path-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": "Clip-Path Reveal", "name": "Clip-Path Reveal", "description": "A shape mask expands to uncover the element — content is fully rendered the whole time, just progressively visible.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/clip-path-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, Clip-Path 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:800ms;--ease:cubic-bezier(.2,.7,.3,1)}+ :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:800ms;--ease:cubic-bezier(.2,.7,.3,1)}*,*::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;align-items:stretch}aside{width:100%}:root{--stage-h:480px}.stage{flex:none}.seg button{min-height:44px}}</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="../scale-in/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../curtain-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/clip-path-reveal/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Clip-Path Reveal</h1>- <p>A shape mask expands to uncover the element — content is fully rendered the whole time, just progressively visible.</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="../scale-in/" rel="prev" aria-label="Previous: Scale In / Zoom In">‹ <span class="hb-name">Scale In / Zoom In</span></a><a href="../curtain-reveal/" rel="next" aria-label="Next: Curtain Reveal"><span class="hb-name">Curtain Reveal</span> ›</a></span></nav>+<main class="hb-view"><div class="stage"><div class="surface" id="surface"><div class="surface-bg"></div>@@ -97,11 +78,17 @@ body{padding-top:46px}<div class="clip-outline" id="outline"></div></div></div>- <aside>- <p class="note">Clip-path masks reveal content without moving or fading it — the element is fully rendered the whole time, only progressively visible. This is what gives clip-path reveals their cinematic feel.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.05 · Entrance & Exit</p>+ <h1>Clip-Path Reveal</h1>+ <p class="hb-lede">A shape uncovers the element while it stays perfectly still.</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>clip-path</span><span class="v" id="cp-val">—</span></div>+ <div class="kv" hidden><span>clip-path</span><span class="v" id="cp-val">—</span></div><div class="div"></div><div class="lbl">Shape</div><div class="seg" id="shape-seg">@@ -112,11 +99,11 @@ body{padding-top:46px}</div><div class="lbl" id="dir-head" style="margin-top:2px">Direction (inset)</div><div class="seg" id="dir-seg">- <button data-d="left" class="on">←</button>- <button data-d="right">→</button>- <button data-d="top">↑</button>- <button data-d="bottom">↓</button>- <button data-d="center">⊙</button>+ <button data-d="left" class="on" aria-label="From the left">←</button>+ <button data-d="right" aria-label="From the right">→</button>+ <button data-d="top" aria-label="From the top">↑</button>+ <button data-d="bottom" aria-label="From the bottom">↓</button>+ <button data-d="center" aria-label="From the center">⊙</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="800" step="50"><span class="sv" id="dur-v">800ms</span></div>@@ -129,16 +116,23 @@ body{padding-top:46px}<option value="cubic-bezier(.34,1.56,.64,1)">Springy</option></select></div>- <label class="tog" for="outline-tog"><input type="checkbox" id="outline-tog"><span>Show clip-path boundary</span></label>+ <label class="tog" for="outline-tog"><input type="checkbox" id="outline-tog" data-hb-skip><span>Show clip-path boundary</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="Reveal">Play in</button>+ <button class="act pri" id="btn-in" data-hb-replay aria-label="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 mask reveal to [the image or block you want to reveal]. The element should stay completely still and fully drawn while a shape uncovers it, like a window opening: an edge wipe that travels in from one side, a circle or ellipse that opens from the middle, or an angled swipe. Nothing moves, fades or changes size; only the visible area grows until the whole element shows. Let the wipe slow down as it finishes instead of stopping abruptly. The content must stay accessible even while part of it is hidden. If the visitor has reduced motion turned on, show it fully without the wipe. Match the settings listed below.</p>+ </section></div></aside>-</div>+</main><script>const surface=document.getElementById('surface'),outline=document.getElementById('outline');const stEl=document.getElementById('st'),cpVal=document.getElementById('cp-val');@@ -206,6 +200,5 @@ body{padding-top:46px}outlineTog.addEventListener('change',()=>outline.classList.toggle('show',outlineTog.checked));applyClips();</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/curtain-reveal/index.html b/animations/02-entrance-and-exit/curtain-reveal/index.htmlindex 03ed4572..7849f8b6 100644--- a/animations/02-entrance-and-exit/curtain-reveal/index.html+++ b/animations/02-entrance-and-exit/curtain-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": "Curtain Reveal", "name": "Curtain Reveal", "description": "A colored bar slides over content then off the other side — the reveal is hidden then exposed.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/curtain-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, Curtain 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);--curtain-color:#111827;--pause:300ms}+ :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);--curtain-color:#111827;--pause:300ms}*,*::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}@@ -79,27 +75,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="../clip-path-reveal/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../split-text-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/curtain-reveal/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Curtain Reveal</h1>- <p>A colored bar slides over content then off the other side — the reveal is hidden then exposed.</p>-</header>-<div class="layout">+<body class="hb">+<nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../">← <span>Animation Handbook</span></a><span class="hb-pager"><a href="../clip-path-reveal/" rel="prev" aria-label="Previous: Clip-Path Reveal">‹ <span class="hb-name">Clip-Path Reveal</span></a><a href="../split-text-reveal/" rel="next" aria-label="Next: Split Text Reveal"><span class="hb-name">Split Text Reveal</span> ›</a></span></nav>+<main class="hb-view"><div class="stage" id="stage"><div class="curtain" id="curtain" data-axis="h"></div><div class="curtain-b" id="curtain-b" data-axis="h" style="display:none"></div>@@ -114,8 +95,14 @@ body{padding-top:46px}<div class="tl-seg" id="tl2"><span class="tl-label" style="left:0">exit</span></div></div></div>- <aside>- <p class="note">The curtain reveal is theatrical because the reveal is hidden THEN exposed — your eye registers the change. Pair with content that warrants the drama.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.06 · Entrance & Exit</p>+ <h1>Curtain Reveal</h1>+ <p class="hb-lede">A colored panel covers the content, then slides away to reveal it.</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">idle</span></div><div class="div"></div>@@ -129,10 +116,10 @@ body{padding-top:46px}</div><div class="lbl">Direction</div><div class="seg" id="dir-seg">- <button data-ax="h" data-dir="ltr" class="on">→ L→R</button>- <button data-ax="h" data-dir="rtl">← R→L</button>- <button data-ax="v" data-dir="ttb">↓ Top</button>- <button data-ax="v" data-dir="btt">↑ Bot</button>+ <button data-ax="h" data-dir="ltr" class="on" aria-label="Left to right">→ L→R</button>+ <button data-ax="h" data-dir="rtl" aria-label="Right to left">← R→L</button>+ <button data-ax="v" data-dir="ttb" aria-label="Top to bottom">↓ Top</button>+ <button data-ax="v" data-dir="btt" aria-label="Bottom to top">↑ Bot</button></div><div><div class="lbl" id="dur-lbl">Curtain speed</div><div class="sr"><input type="range" id="dur-sl" aria-labelledby="dur-lbl" min="100" max="1500" value="500" step="50"><span class="sv" id="dur-v">500ms</span></div>@@ -142,13 +129,20 @@ body{padding-top:46px}</div><label class="tog" for="twin-tog"><input type="checkbox" id="twin-tog"><span>Two curtains (split)</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-play" aria-label="Play curtain reveal">Play reveal</button>- <button class="act" id="btn-rst" aria-label="Reset">Reset</button>+ <button class="act pri" id="btn-play" data-hb-replay aria-label="Play curtain reveal">Play reveal</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 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.</p>+ </section></div></aside>-</div>+</main><script>const curtain=document.getElementById('curtain'),curtainB=document.getElementById('curtain-b');const stEl=document.getElementById('st'),loopTog=document.getElementById('loop-tog');@@ -233,6 +227,5 @@ body{padding-top:46px}pauseSl.addEventListener('input',()=>{pause=+pauseSl.value;pauseV.textContent=pause+'ms'});twinTog.addEventListener('change',()=>{twin=twinTog.checked;if(!busy)clearCurtains()});</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/fade-in-out/index.html b/animations/02-entrance-and-exit/fade-in-out/index.htmlindex 220e221f..221ad80c 100644--- a/animations/02-entrance-and-exit/fade-in-out/index.html+++ b/animations/02-entrance-and-exit/fade-in-out/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": "Fade In / Fade Out", "name": "Fade In / Fade Out", "description": "Opacity 0 → 1 enter, 1 → 0 exit. The compositor handles this without re-painting.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/fade-in-out/", "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, Fade In / Fade Out"}</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}+ :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}*,*::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}@@ -58,27 +54,12 @@@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:0 0 auto}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="../slide-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/fade-in-out/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Fade In / Fade Out</h1>- <p>Opacity 0 → 1 enter, 1 → 0 exit. The compositor handles this without re-painting.</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="../slide-in/" rel="next" aria-label="Next: Slide In"><span class="hb-name">Slide In</span> ›</a></span></nav>+<main class="hb-view"><div class="stage"><div class="card" id="card"><div class="card-icon">◈</div>@@ -86,8 +67,14 @@ body{padding-top:46px}<div class="card-sub">The compositor handles opacity without re-painting. It is the most performant property to animate.</div></div></div>- <aside>- <p class="note">Opacity is the cheapest property to animate — the compositor handles it without re-painting. Combine with transform for richer motion.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.01 · Entrance & Exit</p>+ <h1>Fade In / Fade Out</h1>+ <p class="hb-lede">Goes from invisible to visible to enter, and back again to leave.</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>Opacity</span><span class="v" id="op">0.00</span></div>@@ -105,17 +92,24 @@ body{padding-top:46px}</select></div><div><div class="lbl" id="hold-lbl">Hold time</div>- <div class="sr"><input type="range" id="hold-sl" aria-labelledby="hold-lbl" min="200" max="3000" value="800" step="100"><span class="sv" id="hold-v">0.8s</span></div>+ <div class="sr"><input type="range" id="hold-sl" data-hb-skip aria-labelledby="hold-lbl" min="200" max="3000" value="800" step="100"><span class="sv" id="hold-v">0.8s</span></div></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 fade in">Play in</button>+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play fade in">Play in</button><button class="act" id="btn-out" aria-label="Play fade 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 fade-in and fade-out to [the element you want to show and hide]. When it appears, it should go smoothly from fully transparent to fully visible, and when it leaves it should do the reverse. Nothing moves or changes size; only the opacity changes, which keeps the animation smooth because the browser doesn't need to repaint. Reserve the element's space while it is invisible so the layout doesn't jump, and make sure a hidden element can't be clicked or focused. If the visitor has reduced motion turned on, show and hide it instantly or with a very short fade. Match the settings listed below.</p>+ </section></div></aside>-</div>+</main><script>const card=document.getElementById('card');const durSl=document.getElementById('dur-sl'),durV=document.getElementById('dur-v');@@ -164,6 +158,5 @@ body{padding-top:46px}easeSel.addEventListener('change',()=>document.documentElement.style.setProperty('--ease',easeSel.value));holdSl.addEventListener('input',()=>{hold=+holdSl.value;holdV.textContent=(hold/1000).toFixed(1)+'s'});</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/scale-in/index.html b/animations/02-entrance-and-exit/scale-in/index.htmlindex 42a27c0c..ddac21e1 100644--- a/animations/02-entrance-and-exit/scale-in/index.html+++ b/animations/02-entrance-and-exit/scale-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": "Scale In / Zoom In", "name": "Scale In / Zoom In", "description": "Scales from a small start value to 1.0 — transform-origin changes where the pop expands from.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/scale-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, Scale In / Zoom 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:500ms;--ease:cubic-bezier(.34,1.56,.64,1);--ss:0.8;--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:500ms;--ease:cubic-bezier(.34,1.56,.64,1);--ss:0.8;--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;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="../slide-up-reveal/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../clip-path-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/scale-in/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Scale In / Zoom In</h1>- <p>Scales from a small start value to 1.0 — transform-origin changes where the pop expands from.</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="../slide-up-reveal/" rel="prev" aria-label="Previous: Slide Up Reveal">‹ <span class="hb-name">Slide Up Reveal</span></a><a href="../clip-path-reveal/" rel="next" aria-label="Next: Clip-Path Reveal"><span class="hb-name">Clip-Path Reveal</span> ›</a></span></nav>+<main class="hb-view"><div class="stage"><div class="card" id="card"><div class="card-icon">◆</div>@@ -90,8 +71,14 @@ body{padding-top:46px}<div class="card-sub">Springy easing makes it feel like the element is landing into place — try different transform-origins to change the feel.</div></div></div>- <aside>- <p class="note">Scale-in pairs well with springy easing. The slight overshoot makes the element feel physical. cubic-bezier(.34,1.56,.64,1) is the sweet spot.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.04 · Entrance & Exit</p>+ <h1>Scale In / Zoom In</h1>+ <p class="hb-lede">Grows from slightly smaller to full size, from a point you choose.</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>Scale</span><span class="v" id="sc-val">0.80</span></div>@@ -114,20 +101,27 @@ body{padding-top:46px}<div class="lbl">Transform origin</div><div class="seg" id="orig-seg"><button data-o="center" class="on">Center</button>- <button data-o="top left">Top-L</button>+ <button data-o="top left" aria-label="Top left">Top-L</button><button data-o="top center">Top</button>- <button data-o="bottom center">Bot</button>+ <button data-o="bottom center" aria-label="Bottom">Bot</button></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 scale in">Play in</button>+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play scale in">Play in</button><button class="act" id="btn-out" aria-label="Play scale 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 scale-in entrance to [the element you want to animate]. It should start a little smaller than its final size and grow to full size, anchored at the point given in the settings: its center, or an edge or corner so it seems to grow out of the button that opened it. A springy curve lets it overshoot slightly and settle, which makes the arrival feel physical. Unless the settings turn it off, fade it in while it grows so it never flashes at full strength while it is still tiny. Animate only its size and opacity. If the visitor has reduced motion turned on, show it at full size without the zoom. Match the settings listed below.</p>+ </section></div></aside>-</div>+</main><script>const card=document.getElementById('card');const stEl=document.getElementById('st'),scVal=document.getElementById('sc-val');@@ -161,6 +155,5 @@ body{padding-top:46px}easeSel.addEventListener('change',()=>document.documentElement.style.setProperty('--ease',easeSel.value));fadeTog.addEventListener('change',()=>document.documentElement.style.setProperty('--fade-opacity',fadeTog.checked?'0':'1'));</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/slide-in/index.html b/animations/02-entrance-and-exit/slide-in/index.htmlindex e5572338..eb70bda3 100644--- a/animations/02-entrance-and-exit/slide-in/index.html+++ b/animations/02-entrance-and-exit/slide-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": "Slide In", "name": "Slide In", "description": "Translates from off-screen edge into final position — with or without simultaneous fade.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-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, Slide 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;--tx:0px;--ty:200px;--fade: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:ease-out;--tx:0px;--ty:200px;--fade: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}@@ -63,27 +59,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="../fade-in-out/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../slide-up-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/slide-in/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Slide In</h1>- <p>Translates from off-screen edge into final position — with or without simultaneous fade.</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="../fade-in-out/" rel="prev" aria-label="Previous: Fade In / Fade Out">‹ <span class="hb-name">Fade In / Fade Out</span></a><a href="../slide-up-reveal/" rel="next" aria-label="Next: Slide Up Reveal"><span class="hb-name">Slide Up Reveal</span> ›</a></span></nav>+<main class="hb-view"><div class="stage"><div class="card" id="card"><div class="card-icon">→</div>@@ -91,18 +72,24 @@ body{padding-top:46px}<div class="card-sub">Directional motion reads as arrival. Combined with a fade it feels natural; slide alone feels mechanical.</div></div></div>- <aside>- <p class="note">Slide-in alone often feels mechanical. Combined with a subtle fade (opacity 0 → 1 during the slide), it reads as arrival rather than movement.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.02 · Entrance & Exit</p>+ <h1>Slide In</h1>+ <p class="hb-lede">Travels into place from one edge, with or without a fade.</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>Translate</span><span class="v" id="tr-val">—</span></div><div class="div"></div><div class="lbl">Direction</div><div class="seg" id="dir-seg">- <button data-dir="top" class="on">↑ Top</button>- <button data-dir="bottom">↓ Bot</button>- <button data-dir="left">← Left</button>- <button data-dir="right">→ Right</button>+ <button data-dir="top" class="on" aria-label="From the top">↑ Top</button>+ <button data-dir="bottom" aria-label="From the bottom">↓ Bot</button>+ <button data-dir="left" aria-label="From the left">← Left</button>+ <button data-dir="right" aria-label="From the right">→ Right</button></div><div class="dir-diagram" id="dir-diag">↑</div><div><div class="lbl" id="dist-lbl">Distance</div>@@ -122,14 +109,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 slide in">Play in</button>+ <button class="act pri" id="btn-in" data-hb-replay aria-label="Play slide in">Play in</button><button class="act" id="btn-out" aria-label="Play slide 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 slide-in entrance to [the element you want to animate]. It should start a short distance away from its final position, on the side given in the settings, and travel into place, slowing down as it arrives so it feels like it came from somewhere. Unless the settings turn it off, fade it in during the slide too, because a slide on its own tends to look mechanical. Give longer distances a little more time so the speed still feels natural. Move it without changing the layout, so nothing around it shifts. If the visitor has reduced motion turned on, skip the travel and simply show it. Match the settings listed below.</p>+ </section></div></aside>-</div>+</main><script>const card=document.getElementById('card');const stEl=document.getElementById('st'),trVal=document.getElementById('tr-val');@@ -182,6 +176,5 @@ body{padding-top:46px}fadeTog.addEventListener('change',()=>{withFade=fadeTog.checked;applyDir()});applyDir();</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/slide-up-reveal/index.html b/animations/02-entrance-and-exit/slide-up-reveal/index.htmlindex c7e3bd6f..94233b0d 100644--- a/animations/02-entrance-and-exit/slide-up-reveal/index.html+++ b/animations/02-entrance-and-exit/slide-up-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": "Slide Up Reveal", "name": "Slide Up Reveal", "description": "Text rises from below its clip boundary — two technique variants with identical visual results.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-up-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, Slide Up 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:700ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:60ms}+ :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:cubic-bezier(.2,.7,.3,1);--stagger:60ms}*,*::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}@@ -64,27 +60,12 @@@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%}: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="../slide-in/" rel="prev" title="Previous">‹ Prev</a><a class="ah-hideSm" href="../scale-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/slide-up-reveal/index.html" target="_blank" rel="noopener noreferrer">Source ↗</a></span></div>-<header>- <h1>Slide Up Reveal</h1>- <p>Text rises from below its clip boundary — two technique variants with identical visual results.</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="../slide-in/" rel="prev" aria-label="Previous: Slide In">‹ <span class="hb-name">Slide In</span></a><a href="../scale-in/" rel="next" aria-label="Next: Scale In / Zoom In"><span class="hb-name">Scale In / Zoom In</span> ›</a></span></nav>+<main class="hb-view"><div class="stage" id="stage" data-method="translatey"><div id="lines-wrap"><div class="line-wrap"><span class="headline line" id="l0" style="--d:0">Beautiful</span></div>@@ -92,16 +73,22 @@ body{padding-top:46px}<div class="line-wrap"><span class="sub-line line" id="l2" style="--d:2">crafted with care.</span></div></div></div>- <aside>- <p class="note">Slide-up reveal is the typographic workhorse. clip-path preserves accessibility; translateY performs slightly better. Both look identical to users.</p>+ <aside class="hb-side">+ <header class="hb-head">+ <p class="hb-cat">02.03 · Entrance & Exit</p>+ <h1>Slide Up Reveal</h1>+ <p class="hb-lede">Text rises into view from behind an invisible edge.</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>Technique</span><span class="v" id="tech-val">translateY(110%)</span></div>+ <div class="kv" hidden><span>Technique</span><span class="v" id="tech-val">translateY(110%)</span></div><div class="div"></div><div class="lbl">Technique</div>- <div class="seg" id="method-seg">- <button data-m="translatey" class="on">translateY</button>- <button data-m="clippath">clip-path</button>+ <div class="seg" id="method-seg" data-hb-skip>+ <button data-m="translatey" class="on">Move</button>+ <button data-m="clippath">Clip</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="700" step="50"><span class="sv" id="dur-v">700ms</span></div>@@ -117,16 +104,23 @@ body{padding-top:46px}<div><div class="lbl" id="stag-lbl">Line stagger</div><div class="sr"><input type="range" id="stag-sl" aria-labelledby="stag-lbl" min="0" max="150" value="60" step="10"><span class="sv" id="stag-v">60ms</span></div></div>- <label class="tog" for="multi-tog"><input type="checkbox" id="multi-tog" checked><span>Multi-line (3 lines)</span></label>+ <label class="tog" for="multi-tog"><input type="checkbox" id="multi-tog" data-hb-skip checked><span>Multi-line (3 lines)</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 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="Play 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 slide-up reveal to [your headline or lines of text]. Each line should rise into place from just below an invisible edge, as if it is coming up from behind a solid surface: the text moves, but anything below the line stays hidden, so viewers only see it arrive. When there are several lines, start each one a moment after the line above it so they cascade. The text must stay readable by screen readers and search engines the whole time. If the visitor has reduced motion turned on, show the text immediately without the rise. Match the settings listed below.</p>+ </section></div></aside>-</div>+</main><script>const stage=document.getElementById('stage');const stEl=document.getElementById('st'),techVal=document.getElementById('tech-val');@@ -172,6 +166,5 @@ body{padding-top:46px}clearTimeout(animTimer);stEl.textContent='hidden';});</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.jsindex 51f7761f..59fa2974 100644--- a/tests/pages.test.js+++ b/tests/pages.test.js@@ -21,8 +21,11 @@ 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('Bounce In uses the shared layout', () => {- assert.ok(converted.some(d => d.cat === PILOT && d.slug === 'bounce-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`);+ }});for (const d of converted) {diff --git a/tools/migrations/02-entrance-and-exit.json b/tools/migrations/02-entrance-and-exit.jsonindex b5728c8a..d26ba383 100644--- a/tools/migrations/02-entrance-and-exit.json+++ b/tools/migrations/02-entrance-and-exit.json@@ -14,6 +14,96 @@],"lede": "Overshoots its final size and position, then springs back to rest.","prompt": "Add a bounce-in entrance to [the element you want to animate]. When it appears, it should start small and a little below its final spot, grow slightly past full size, dip just under it, then settle, as if it landed with a small spring. Each bounce is smaller than the one before, like energy running out, and one bounce usually looks best. Unless the settings turn it off, fade it in at the same time. Animate only its position, size and opacity so it stays smooth. If the visitor has reduced motion turned on, show the element without the bounce. Match the settings listed below."+ },+ {+ "slug": "fade-in-out",+ "number": "02.01",+ "prev": null,+ "next": { "href": "../slide-in/", "name": "Slide In" },+ "autoplay": true,+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "hold-sl": "data-hb-skip" },+ "edits": [],+ "lede": "Goes from invisible to visible to enter, and back again to leave.",+ "prompt": "Add a fade-in and fade-out to [the element you want to show and hide]. When it appears, it should go smoothly from fully transparent to fully visible, and when it leaves it should do the reverse. Nothing moves or changes size; only the opacity changes, which keeps the animation smooth because the browser doesn't need to repaint. Reserve the element's space while it is invisible so the layout doesn't jump, and make sure a hidden element can't be clicked or focused. If the visitor has reduced motion turned on, show and hide it instantly or with a very short fade. Match the settings listed below."+ },+ {+ "slug": "slide-in",+ "number": "02.02",+ "prev": { "href": "../fade-in-out/", "name": "Fade In / Fade Out" },+ "next": { "href": "../slide-up-reveal/", "name": "Slide Up Reveal" },+ "autoplay": true,+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },+ "edits": [+ ["<button data-dir=\"top\" class=\"on\">↑ Top</button>", "<button data-dir=\"top\" class=\"on\" aria-label=\"From the top\">↑ Top</button>"],+ ["<button data-dir=\"bottom\">↓ Bot</button>", "<button data-dir=\"bottom\" aria-label=\"From the bottom\">↓ Bot</button>"],+ ["<button data-dir=\"left\">← Left</button>", "<button data-dir=\"left\" aria-label=\"From the left\">← Left</button>"],+ ["<button data-dir=\"right\">→ Right</button>", "<button data-dir=\"right\" aria-label=\"From the right\">→ Right</button>"]+ ],+ "lede": "Travels into place from one edge, with or without a fade.",+ "prompt": "Add a slide-in entrance to [the element you want to animate]. It should start a short distance away from its final position, on the side given in the settings, and travel into place, slowing down as it arrives so it feels like it came from somewhere. Unless the settings turn it off, fade it in during the slide too, because a slide on its own tends to look mechanical. Give longer distances a little more time so the speed still feels natural. Move it without changing the layout, so nothing around it shifts. If the visitor has reduced motion turned on, skip the travel and simply show it. Match the settings listed below."+ },+ {+ "slug": "slide-up-reveal",+ "number": "02.03",+ "prev": { "href": "../slide-in/", "name": "Slide In" },+ "next": { "href": "../scale-in/", "name": "Scale In / Zoom In" },+ "autoplay": true,+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "method-seg": "data-hb-skip", "multi-tog": "data-hb-skip" },+ "edits": [+ ["<div class=\"kv\"><span>Technique</span><span class=\"v\" id=\"tech-val\">", "<div class=\"kv\" hidden><span>Technique</span><span class=\"v\" id=\"tech-val\">"],+ ["<button data-m=\"translatey\" class=\"on\">translateY</button>", "<button data-m=\"translatey\" class=\"on\">Move</button>"],+ ["<button data-m=\"clippath\">clip-path</button>", "<button data-m=\"clippath\">Clip</button>"]+ ],+ "lede": "Text rises into view from behind an invisible edge.",+ "prompt": "Add a slide-up reveal to [your headline or lines of text]. Each line should rise into place from just below an invisible edge, as if it is coming up from behind a solid surface: the text moves, but anything below the line stays hidden, so viewers only see it arrive. When there are several lines, start each one a moment after the line above it so they cascade. The text must stay readable by screen readers and search engines the whole time. If the visitor has reduced motion turned on, show the text immediately without the rise. Match the settings listed below."+ },+ {+ "slug": "scale-in",+ "number": "02.04",+ "prev": { "href": "../slide-up-reveal/", "name": "Slide Up Reveal" },+ "next": { "href": "../clip-path-reveal/", "name": "Clip-Path Reveal" },+ "autoplay": true,+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },+ "edits": [+ ["<button data-o=\"top left\">Top-L</button>", "<button data-o=\"top left\" aria-label=\"Top left\">Top-L</button>"],+ ["<button data-o=\"bottom center\">Bot</button>", "<button data-o=\"bottom center\" aria-label=\"Bottom\">Bot</button>"]+ ],+ "lede": "Grows from slightly smaller to full size, from a point you choose.",+ "prompt": "Add a scale-in entrance to [the element you want to animate]. It should start a little smaller than its final size and grow to full size, anchored at the point given in the settings: its center, or an edge or corner so it seems to grow out of the button that opened it. A springy curve lets it overshoot slightly and settle, which makes the arrival feel physical. Unless the settings turn it off, fade it in while it grows so it never flashes at full strength while it is still tiny. Animate only its size and opacity. If the visitor has reduced motion turned on, show it at full size without the zoom. Match the settings listed below."+ },+ {+ "slug": "clip-path-reveal",+ "number": "02.05",+ "prev": { "href": "../scale-in/", "name": "Scale In / Zoom In" },+ "next": { "href": "../curtain-reveal/", "name": "Curtain Reveal" },+ "autoplay": true,+ "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "outline-tog": "data-hb-skip" },+ "edits": [+ ["<div class=\"kv\"><span>clip-path</span><span class=\"v\" id=\"cp-val\">", "<div class=\"kv\" hidden><span>clip-path</span><span class=\"v\" id=\"cp-val\">"],+ ["<button data-d=\"left\" class=\"on\">←</button>", "<button data-d=\"left\" class=\"on\" aria-label=\"From the left\">←</button>"],+ ["<button data-d=\"right\">→</button>", "<button data-d=\"right\" aria-label=\"From the right\">→</button>"],+ ["<button data-d=\"top\">↑</button>", "<button data-d=\"top\" aria-label=\"From the top\">↑</button>"],+ ["<button data-d=\"bottom\">↓</button>", "<button data-d=\"bottom\" aria-label=\"From the bottom\">↓</button>"],+ ["<button data-d=\"center\">⊙</button>", "<button data-d=\"center\" aria-label=\"From the center\">⊙</button>"]+ ],+ "lede": "A shape uncovers the element while it stays perfectly still.",+ "prompt": "Add a mask reveal to [the image or block you want to reveal]. The element should stay completely still and fully drawn while a shape uncovers it, like a window opening: an edge wipe that travels in from one side, a circle or ellipse that opens from the middle, or an angled swipe. Nothing moves, fades or changes size; only the visible area grows until the whole element shows. Let the wipe slow down as it finishes instead of stopping abruptly. The content must stay accessible even while part of it is hidden. If the visitor has reduced motion turned on, show it fully without the wipe. Match the settings listed below."+ },+ {+ "slug": "curtain-reveal",+ "number": "02.06",+ "prev": { "href": "../clip-path-reveal/", "name": "Clip-Path Reveal" },+ "next": { "href": "../split-text-reveal/", "name": "Split Text Reveal" },+ "autoplay": false,+ "attrs": { "btn-play": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },+ "edits": [+ ["<button data-ax=\"h\" data-dir=\"ltr\" class=\"on\">→ L→R</button>", "<button data-ax=\"h\" data-dir=\"ltr\" class=\"on\" aria-label=\"Left to right\">→ L→R</button>"],+ ["<button data-ax=\"h\" data-dir=\"rtl\">← R→L</button>", "<button data-ax=\"h\" data-dir=\"rtl\" aria-label=\"Right to left\">← R→L</button>"],+ ["<button data-ax=\"v\" data-dir=\"ttb\">↓ Top</button>", "<button data-ax=\"v\" data-dir=\"ttb\" aria-label=\"Top to bottom\">↓ Top</button>"],+ ["<button data-ax=\"v\" data-dir=\"btt\">↑ Bot</button>", "<button data-ax=\"v\" data-dir=\"btt\" aria-label=\"Bottom to top\">↑ Bot</button>"]+ ],+ "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."}]}