176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: move Slide Up Reveal to the guided-steps page
matin35b5a2480d05
diff --git a/animations/02-entrance-and-exit/slide-up-reveal/README.md b/animations/02-entrance-and-exit/slide-up-reveal/README.mdindex 1051c11c..8f1ccb7d 100644--- a/animations/02-entrance-and-exit/slide-up-reveal/README.md+++ b/animations/02-entrance-and-exit/slide-up-reveal/README.md@@ -11,7 +11,7 @@ A slide-up reveal makes a line of text rise into view from behind an invisible e- Any place a plain fade feels too flat and you want the text to feel *lifted* into place## How it works-There are two ways to achieve the identical visual, and the demo toggles between them. **Method A** wraps each line in an `overflow: hidden` container and pushes the inner text down by `translateY(110%)`; adding `.in` returns it to `0`. **Method B** leaves the text in place and animates a `clip-path: inset()` from fully clipped at the bottom to fully open — no wrapper needed:+There are two ways to achieve the identical visual, and the Reveal style setting switches between them (Slide is Method A, Wipe is Method B). **Method A** wraps each line in an `overflow: hidden` container and pushes the inner text down by `translateY(110%)`; adding `.in` returns it to `0`. **Method B** leaves the text in place and animates a `clip-path: inset()` from fully clipped at the bottom to fully open — no wrapper needed:```css/* Method A — translateY inside a clipping wrapper */@@ -34,11 +34,10 @@ Multiple lines stagger through a per-line `--d` index multiplied by a `--stagger| Parameter | Default | Effect ||-----------|---------|--------|-| Technique | Move | Two ways to build it that look identical: moving the text up, or clipping it from below |-| Duration | 700ms | How long each line takes to rise |-| Easing | Smooth | Slows smoothly to a stop; Springy adds a slight settle |-| Line stagger | 60ms | Delay between lines; 40 to 80ms reads as a cascade |-| Multi-line (3 lines) | on | Shows three lines so you can see the stagger |+| Speed | Normal | How long each line takes to rise: slow is 1100ms, normal 700ms and fast 400ms |+| Delay between lines | Medium | The wait before each next line starts: short is 30ms, medium 60ms and long 120ms; 40 to 80ms reads as a cascade |+| Reveal style | Slide | Two ways to build it that look almost the same: sliding the text up behind a hidden edge, or wiping it into view in place |+| Feel | Smooth | Smooth slows to a stop; Springy adds a slight settle; Even keeps one steady pace |## Production notes- **`translateY(110%)`, not `100%`.** The extra 10% covers descenders (g, y, p) and line-height slack so no sliver of the glyph peeks above the boundary before it moves.@@ -47,7 +46,7 @@ Multiple lines stagger through a per-line `--d` index multiplied by a `--stagger- **Library equivalents:** GSAP's SplitText plugin plus a `y: '110%'` tween is the classic production recipe; Framer Motion animates `y` inside a `overflow-hidden` wrapper with `staggerChildren`; Motion One `animate` with a `delay` derived from index.## See also-- [Split Text Reveal](../split-text-reveal/) — apply this per character or word, not per line-- [Curtain Reveal](../curtain-reveal/) — a moving bar uncovers content instead of a fixed edge-- [Clip-Path Reveal](../clip-path-reveal/) — the same clip mechanic on any element-- [Slide In](../slide-in/) — unclipped directional entry+- [Split Text Reveal](../split-text-reveal/) — text appears piece by piece, not line by line+- [Curtain Reveal](../curtain-reveal/) — a colored panel covers it, then slides away+- [Clip-Path Reveal](../clip-path-reveal/) — a shape uncovers any element+- [Slide In](../slide-in/) — travels in from any edge, with nothing hiding itdiff --git a/animations/02-entrance-and-exit/slide-up-reveal/index.html b/animations/02-entrance-and-exit/slide-up-reveal/index.htmlindex 94233b0d..3790af8c 100644--- a/animations/02-entrance-and-exit/slide-up-reveal/index.html+++ b/animations/02-entrance-and-exit/slide-up-reveal/index.html@@ -4,7 +4,7 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Slide Up Reveal — Animation Handbook</title>- <meta name="description" content="Text rises from below its clip boundary — two technique variants with identical visual results.">+ <meta name="description" content="Text rises into view from behind an invisible edge. Best for headlines."><link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-up-reveal/"><link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">@@ -12,159 +12,198 @@<meta property="og:type" content="article"><meta property="og:site_name" content="Animation Handbook"><meta property="og:title" content="Slide Up Reveal — Animation Handbook">- <meta property="og:description" content="Text rises from below its clip boundary — two technique variants with identical visual results.">+ <meta property="og:description" content="Text rises into view from behind an invisible edge. Best for headlines."><meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-up-reveal/"><meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Slide Up Reveal — Animation Handbook">- <meta name="twitter:description" content="Text rises from below its clip boundary — two technique variants with identical visual results.">+ <meta name="twitter:description" content="Text rises into view from behind an invisible edge. Best for headlines."><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>+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Slide Up Reveal", "name": "Slide Up Reveal", "description": "Text rises into view from behind an invisible edge. Best for headlines.", "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>- :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}+ :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--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}- header h1{font-size:clamp(11px,1.8vw,15px);font-family:var(--disp);font-weight:700;letter-spacing:-.01em}- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}- .stage{flex:1;min-width:0;height:var(--stage-h);border:1px solid var(--ui-border);border-radius:8px;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;overflow:hidden;padding:40px}- /* translateY method */+ .stage{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;overflow:hidden;padding:clamp(20px,5vw,40px);background:#0b0b0d}.line-wrap{overflow:hidden;line-height:1.15}[data-method="translatey"] .line{display:block;transform:translateY(110%);transition:transform var(--dur) var(--ease);transition-delay:calc(var(--d,0)*var(--stagger))}[data-method="translatey"] .line.in{transform:translateY(0)}- /* clip-path method */[data-method="clippath"] .line{display:block;clip-path:inset(100% 0 0 0);transition:clip-path var(--dur) var(--ease);transition-delay:calc(var(--d,0)*var(--stagger))}[data-method="clippath"] .line.in{clip-path:inset(0% 0 0 0)}.headline{font-family:monospace;font-size:clamp(28px,5vw,52px);font-weight:bold;text-align:center;line-height:1.1}.sub-line{font-family:monospace;font-size:clamp(13px,2vw,16px);color:var(--ui-muted);text-align:center}@media(prefers-reduced-motion:reduce){.line{opacity:0;transition:opacity 300ms linear!important;transform:none!important;clip-path:none!important} .line.in{opacity:1!important}}- aside{width:clamp(200px,22vw,240px);flex-shrink:0;background:var(--ui-bg);border:1px solid var(--ui-border);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:10px}- .note{font-size:10px;color:var(--ui-muted);line-height:1.6;border-left:2px solid var(--ui-accent);padding-left:8px}- .lbl{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}- .kv{display:flex;justify-content:space-between;font-size:10px;color:var(--ui-muted)}- .kv .v{color:var(--ui-text);font-size:9px}- .div{height:1px;background:var(--ui-border)}- .sr{display:flex;align-items:center;gap:6px;font-size:10px}- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:44px}- .sv{width:38px;text-align:right;color:var(--ui-text)}- select{background:var(--ui-bg);border:1px solid var(--ui-border);color:var(--ui-text);font-family:var(--mono);font-size:10px;padding:8px 6px;border-radius:4px;width:100%;min-height:44px}- .seg{display:flex;gap:3px;flex-wrap:wrap}- .seg button{flex:1;background:none;border:1px solid var(--ui-border);color:var(--ui-muted);font-family:var(--mono);font-size:9px;padding:8px 4px;border-radius:4px;cursor:pointer;min-height:44px}- .seg button.on{border-color:var(--ui-accent);color:var(--ui-accent);background:rgba(95,216,138,.12)}- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer;min-height:44px}- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}- .btn-row{display:flex;gap:6px}- button.act{flex:1;background:transparent;border:1px solid var(--ui-border);color:var(--ui-text);font-family:var(--mono);font-size:10px;padding:14px 6px;border-radius:4px;cursor:pointer;min-height:44px}- button.act.pri{border-color:var(--ui-accent);color:var(--ui-accent)}- @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>-<link rel="stylesheet" href="../../../assets/css/handbook.css">-<script src="../../../assets/js/handbook.js" defer></script>+ <link rel="stylesheet" href="../../../assets/css/demo-page.css">+ <script src="../../../assets/js/demo-page.js" defer></script></head>-<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>- <div class="line-wrap"><span class="headline line" id="l1" style="--d:1">interfaces</span></div>- <div class="line-wrap"><span class="sub-line line" id="l2" style="--d:2">crafted with care.</span></div>+<body class="hb" data-hb-kind="once" data-hb-autoplay>+<nav class="hb-bar" aria-label="Animation Handbook">+ <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>+ <span class="hb-pager"><a href="../slide-in/" rel="prev" aria-label="Previous: Slide In"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Slide In</span></a><a href="../scale-in/" rel="next" aria-label="Next: Scale In / Zoom In"><span><span class="hb-dir">Next: </span>Scale In / Zoom In</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>+</nav>+<main class="hb-page">+ <header class="hb-head">+ <p class="hb-cat">02.03 · Entrance & Exit</p>+ <h1>Slide Up Reveal</h1>+ <p class="hb-lede">Text rises into view from behind an invisible edge. Best for headlines.</p>+ </header>++ <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">1</span>+ <div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to see each part of the movement.</p></div>+ </div>+ <div class="stage hb-dots" 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>+ <div class="line-wrap"><span class="headline line" id="l1" style="--d:1">interfaces</span></div>+ <div class="line-wrap"><span class="sub-line line" id="l2" style="--d:2">crafted with care.</span></div>+ </div>+ </div>+ <div class="hb-player">+ <button class="hb-play" type="button" id="btn-play" data-hb-replay><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Replay</button>+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="loop-tog" data-hb-loop><span>Loop</span></label>+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo><span>Slow motion</span></label></div>- </div>- <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" 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" data-hb-skip>- <button data-m="translatey" class="on">Move</button>- <button data-m="clippath">Clip</button>+ </section>++ <section class="hb-step hb-try" aria-labelledby="hb-try-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">2</span>+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and the animation plays again.</p></div></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>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="speed-lbl">Speed</p>+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">+ <button type="button" data-ms="1100" aria-pressed="false">Slow</button>+ <button type="button" data-ms="700" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-ms="400" aria-pressed="false">Fast</button>+ </div>+ <p class="hb-hint">How long each line takes to rise.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="stagger-lbl">Delay between lines</p>+ <div class="seg" id="stagger-seg" role="group" aria-labelledby="stagger-lbl">+ <button type="button" data-stagger="30" aria-pressed="false">Short</button>+ <button type="button" data-stagger="60" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-stagger="120" aria-pressed="false">Long</button>+ </div>+ <p class="hb-hint">Longer delays make the cascade easier to see.</p>+ </div></div>- <div><div class="lbl">Easing</div>- <select id="ease-sel">- <option value="linear">Linear</option>- <option value="ease-out">Ease out</option>- <option value="cubic-bezier(.2,.7,.3,1)" selected>Smooth</option>- <option value="cubic-bezier(.34,1.56,.64,1)">Springy</option>- </select>+ <details class="hb-options">+ <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="method-lbl">Reveal style</p>+ <div class="seg" id="method-seg" role="group" aria-labelledby="method-lbl">+ <button type="button" data-method="translatey" class="on" aria-pressed="true">Slide</button>+ <button type="button" data-method="clippath" aria-pressed="false">Wipe</button>+ </div>+ <p class="hb-hint">Slide moves the text up; Wipe uncovers it in place.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="feel-lbl">Feel</p>+ <div class="seg" id="feel-seg" role="group" aria-labelledby="feel-lbl">+ <button type="button" data-ease="cubic-bezier(.2,.7,.3,1)" class="on" aria-pressed="true">Smooth</button>+ <button type="button" data-ease="cubic-bezier(.34,1.56,.64,1)" aria-pressed="false">Springy</button>+ <button type="button" data-ease="linear" aria-pressed="false">Even</button>+ </div>+ <p class="hb-hint">Springy goes a little past, then settles.</p>+ </div>+ </div>+ </details>+ </section>++ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">3</span>+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div></div>- <div><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 class="hb-card">+ <p class="hb-prompt">Add a slide-up reveal to [your headline or lines of text]. Each line should rise into view from just below an invisible edge, as if it is coming up from behind a solid surface, so viewers only see it arrive and never see it below the line. The text can slide up behind the edge or be uncovered in place from the bottom up; both look almost the same. 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>+ <div class="hb-chips-box" hidden>+ <p class="hb-chips-title">Your settings</p>+ <ul class="hb-chips"></ul>+ </div>+ <div class="hb-copy-row">+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>+ </div></div>- <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" data-hb-skip data-hb-loop><span>Auto-loop</span></label>- <div class="btn-row">- <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" data-hb-reset aria-label="Reset">Reset</button>+ </section>++ <section class="hb-about" aria-labelledby="hb-what-title">+ <div class="hb-what">+ <h2 id="hb-what-title">What it is</h2>+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div></div>- </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 class="hb-fit">+ <h2>Good for</h2>+ <ul class="hb-tags hb-good"><li>Headlines</li><li>Section titles</li><li>Taglines</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Long paragraphs</li><li>Buttons</li></ul></div>- </aside>+ </section>++ <section class="hb-related" aria-labelledby="hb-related-title" hidden>+ <h2 id="hb-related-title">Similar animations</h2>+ <div class="hb-rel-list"></div>+ </section></main>+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer><script>const stage=document.getElementById('stage');- const stEl=document.getElementById('st'),techVal=document.getElementById('tech-val');- const durSl=document.getElementById('dur-sl'),durV=document.getElementById('dur-v');- const stagSl=document.getElementById('stag-sl'),stagV=document.getElementById('stag-v');- const easeSel=document.getElementById('ease-sel');- const multiTog=document.getElementById('multi-tog'),loopTog=document.getElementById('loop-tog');- let dur=700,method='translatey',looping=false,loopTimer=null,animTimer=null;- const lines=()=>multiTog.checked?[...document.querySelectorAll('.line')]:[document.getElementById('l0')];-- const TECH={translatey:'translateY(110%)', clippath:'clip-path: inset(100% 0 0 0)'};+ const lines=[...document.querySelectorAll('.line')];+ const vars=document.documentElement.style;+ const loopTog=document.getElementById('loop-tog'),slowTog=document.getElementById('slow-tog');+ const motionOk=!window.matchMedia('(prefers-reduced-motion:reduce)').matches;+ let ms=700,stagger=60,ease='cubic-bezier(.2,.7,.3,1)',timers=[];- function _trigger(cls){- clearTimeout(animTimer);- const ls=lines();- ls.forEach(l=>{l.classList.remove('in');void l.offsetWidth});- if(cls==='in')ls.forEach(l=>l.classList.add('in'));- stEl.textContent=cls==='in'?'playing in':'playing out';- const total=dur+(ls.length-1)*(+stagSl.value);- animTimer=setTimeout(()=>stEl.textContent=cls==='in'?'visible':'hidden',total);+ function dur(){return slowTog.checked?ms*3:ms}+ function stag(){return slowTog.checked?stagger*3:stagger}+ function apply(){+ vars.setProperty('--dur',dur()+'ms');+ vars.setProperty('--stagger',stag()+'ms');+ vars.setProperty('--ease',ease);+ }+ function later(fn,wait){timers.push(setTimeout(fn,wait))}+ function revealIn(){+ // snap back to hidden without a transition so every play rises from behind the edge again+ lines.forEach(l=>l.style.setProperty('transition','none','important'));+ lines.forEach(l=>l.classList.remove('in'));+ void stage.offsetWidth;+ lines.forEach(l=>l.style.removeProperty('transition'));+ lines.forEach(l=>l.classList.add('in'));}- function stopLoop(){looping=false;clearTimeout(loopTimer);clearTimeout(animTimer);loopTog.checked=false}- function playIn(){stopLoop();_trigger('in')}- function playOut(){stopLoop();_trigger('out')}- function loop(){_trigger('in');loopTimer=setTimeout(()=>{_trigger('out');loopTimer=setTimeout(()=>{if(looping)loop()},dur+400)},dur+1000)}+ // One play reveals the lines. While Loop is on it then holds, drops the lines back down, waits and plays again;+ // switching Loop off lets the lines finish risen. Slow motion stretches the reveal and the stagger, not the waits.+ function cycle(){+ apply();revealIn();+ if(!loopTog.checked||!motionOk)return;+ later(()=>{+ if(!loopTog.checked)return;+ lines.forEach(l=>l.classList.remove('in'));+ later(cycle,dur()+400);+ },dur()+1000);+ }+ function play(){timers.forEach(clearTimeout);timers=[];cycle()}- document.getElementById('btn-in').addEventListener('click',playIn);- document.getElementById('btn-out').addEventListener('click',playOut);- document.getElementById('btn-rst').addEventListener('click',()=>{stopLoop();clearTimeout(animTimer);lines().forEach(l=>l.classList.remove('in'));stEl.textContent='hidden'});- loopTog.addEventListener('change',()=>{looping=loopTog.checked;if(looping)loop();else clearTimeout(loopTimer)});- document.querySelectorAll('#method-seg button').forEach(b=>b.addEventListener('click',()=>{- document.querySelectorAll('#method-seg button').forEach(x=>x.classList.remove('on'));- b.classList.add('on');method=b.dataset.m;stage.dataset.method=method;- techVal.textContent=TECH[method];- stopLoop();lines().forEach(l=>l.classList.remove('in'));stEl.textContent='hidden';- }));- durSl.addEventListener('input',()=>{dur=+durSl.value;durV.textContent=dur+'ms';document.documentElement.style.setProperty('--dur',dur+'ms')});- easeSel.addEventListener('change',()=>document.documentElement.style.setProperty('--ease',easeSel.value));- stagSl.addEventListener('input',()=>{stagV.textContent=stagSl.value+'ms';document.documentElement.style.setProperty('--stagger',stagSl.value+'ms')});- multiTog.addEventListener('change',()=>{- const ls=document.querySelectorAll('.line');- ls.forEach((l,i)=>{l.style.display=(!multiTog.checked&&i>0)?'none':'block';l.classList.remove('in')});- clearTimeout(animTimer);stEl.textContent='hidden';- });+ document.getElementById('btn-play').addEventListener('click',play);+ loopTog.addEventListener('change',()=>{if(loopTog.checked)play()});+ function choices(id,pick){+ const buttons=document.querySelectorAll('#'+id+' button');+ buttons.forEach(b=>b.addEventListener('click',()=>{+ buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});+ pick(b.dataset);+ }));+ }+ choices('speed-seg',d=>{ms=+d.ms});+ choices('stagger-seg',d=>{stagger=+d.stagger});+ choices('method-seg',d=>{stage.dataset.method=d.method});+ choices('feel-seg',d=>{ease=d.ease});+ apply();</script></body></html>diff --git a/index.html b/index.htmlindex 3b7405fb..4f01f0f9 100644--- a/index.html+++ b/index.html@@ -914,7 +914,7 @@ const CATS=[entries:[['fade-in-out','Fade In / Fade Out','Fades in to appear and fades out to leave. Best for pop-ups and tooltips.'],['slide-in','Slide In','Travels into place from one edge. Best for side panels and notifications.'],- ['slide-up-reveal','Slide Up Reveal','Text rises from below its clip boundary — translateY method vs clip-path inset, identical visual result.'],+ ['slide-up-reveal','Slide Up Reveal','Text rises into view from behind an invisible edge. Best for headlines.'],['scale-in','Scale In / Zoom In','Scales from a small start value to 1.0 — transform-origin controls where the pop expands from.'],['clip-path-reveal','Clip-Path Reveal','A shape mask expands to uncover the element — content is always rendered, just progressively visible.'],['curtain-reveal','Curtain Reveal','A colored bar slides over content then off the other side — the reveal is hidden then exposed.'],