Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

feat: Highlighter Sweep (05.15)

matin7d6b7fb4504d
diff --git a/README.md b/README.md
index 28903928..bed39fd5 100644
--- a/README.md
+++ b/README.md
@@ -181,6 +181,7 @@ All 129 techniques, each linked to its live demo.
- **[Glitch Text](animations/05-text-typography/glitch-text/)** — Text tears into red and cyan strips like a broken signal. Best for bold titles.
- **[Text on a Path](animations/05-text-typography/text-on-path/)** — Text travels along a wave, an arc or a circle. Best for badges and seals.
- **[Wavy Text](animations/05-text-typography/wavy-text/)** — A wave rolls through the word, letter by letter. Best for playful titles.
+- **[Highlighter Sweep](animations/05-text-typography/highlighter-sweep/)** — A marker sweeps in behind the key words, one after another. Best for key points.
</details>
diff --git a/animations/05-text-typography/README.md b/animations/05-text-typography/README.md
index 1e63fd5f..3f659083 100644
--- a/animations/05-text-typography/README.md
+++ b/animations/05-text-typography/README.md
@@ -20,6 +20,7 @@ Animations specifically for type — where the letterforms themselves are the co
| [Glitch Text](glitch-text/) | Text tears into red and cyan strips like a broken signal. Best for bold titles. |
| [Text on a Path](text-on-path/) | Text travels along a wave, an arc or a circle. Best for badges and seals. |
| [Wavy Text](wavy-text/) | A wave rolls through the word, letter by letter. Best for playful titles. |
+| [Highlighter Sweep](highlighter-sweep/) | A marker sweeps in behind the key words, one after another. Best for key points. |
## Key principles
diff --git a/animations/05-text-typography/highlighter-sweep/README.md b/animations/05-text-typography/highlighter-sweep/README.md
new file mode 100644
index 00000000..39601053
--- /dev/null
+++ b/animations/05-text-typography/highlighter-sweep/README.md
@@ -0,0 +1,64 @@
+# Highlighter Sweep
+
+## What it is
+A highlighter sweep marks the key words of a sentence the way a pen would. A band of marker color grows behind each key phrase from left to right, one phrase after another in reading order, so the eye is led from one idea to the next. The words themselves never move; only the color behind them is drawn.
+
+## When to use it
+- Pull quotes and testimonials, to mark the line a reader should remember
+- Landing page headlines where one phrase carries the promise
+- Summaries, study notes and onboarding tips, where two or three ideas matter most
+- Key points that are marked as their section scrolls into view
+
+## How it works
+Each key phrase is a `<mark>`. The script wraps each of its words, together with the space after it, in a span whose `::before` is the band: placed behind the word (`z-index: -1` inside a card that is its own stacking context, so the band never drops behind the card), scaled to nothing from its left edge, and grown to full width when the paragraph gets the class `on`. Because every word has its own band, a phrase that wraps onto a second line is marked line by line, and because the trailing space is inside the span, the bands of one line join up.
+
+```css
+.paper { position: relative; isolation: isolate; }
+.w { position: relative; }
+.w::before {
+ content: ''; position: absolute; z-index: -1;
+ left: -.08em; right: -.08em; top: var(--top); bottom: -.06em;
+ background: var(--marker);
+ transform: scaleX(0); transform-origin: left center;
+ transition: transform var(--t) var(--e) var(--d);
+}
+.para.on .w::before { transform: scaleX(1); }
+
+@media (prefers-reduced-motion: reduce) {
+ .w::before { transform: none; opacity: 0; transition: opacity .4s linear var(--d); }
+ .para.on .w::before { opacity: 1; }
+}
+```
+
+The script gives every word its delay (`--d`), duration (`--t`) and timing curve (`--e`). A phrase gets one smooth curve, smoothstep, so the pen speeds up and slows down once per phrase rather than once per word. A word that covers the part p0 to p1 of its phrase's width runs between the times where the curve reaches p0 and p1, and its own timing curve is exactly that piece of smoothstep, written as a cubic Bézier, so the pen's speed carries on smoothly from one word to the next:
+
+```js
+const S = t => t * t * (3 - 2 * t), dS = t => 6 * t * (1 - t); // the phrase's curve and its slope
+const t0 = inv(p0), t1 = inv(p1), k = (t1 - t0) / (p1 - p0); // inv: where S reaches p0 and p1
+w.style.setProperty('--d', start + t0 * D + 'ms');
+w.style.setProperty('--t', (t1 - t0) * D + 'ms');
+w.style.setProperty('--e', `cubic-bezier(.333, ${dS(t0) * k / 3}, .667, ${1 - dS(t1) * k / 3})`);
+```
+
+Replay first drops every band back to nothing with transitions switched off for a moment, forces a style recalculation, and then adds `on` again, so each play sweeps from bare paper. Only `transform` and `opacity` change, so the text never reflows.
+
+## Key parameters
+| Parameter | Default | Effect |
+|-----------|---------|--------|
+| Marker color | Yellow | The color of the bands: yellow, pink, green, blue or orange, all light enough for the dark words to stay easy to read |
+| Speed | Normal | How long the marker takes to cross one phrase: slow is 1300ms, normal 700ms and fast 400ms, with a 250ms pause between phrases |
+| How much it covers | Whole words | Whole words covers the letters from just under their tops; Lower half covers only the bottom of the letters, like a thick underline |
+
+## Production notes
+- **The background-size version**: a single `<mark>` with `background: linear-gradient(var(--marker), var(--marker)) no-repeat; background-size: 0% 100%`, `box-decoration-break: clone` and a transition on `background-size` handles line wraps with no splitting at all. It is the shortest code, but `background-size` is repainted on every frame; the transform version here stays on the compositor.
+- **Play it once, when it is seen**: start the sweep with an IntersectionObserver as the paragraph scrolls into view, and do not run it again on every scroll.
+- **Contrast**: check the text against every marker color (WCAG asks for 4.5:1). On a dark theme use darker, more saturated markers with light text, or a translucent marker with `mix-blend-mode`.
+- **Meaning**: `<mark>` tells assistive technology that the words are highlighted, and some screen readers say so. Do not rely on the color alone to carry meaning that the words do not.
+- **Splitting**: keep the space inside each word's span so the bands join; split with `Intl.Segmenter` for languages that do not separate words with spaces.
+- **Libraries**: GSAP's SplitText with a staggered `scaleX` tween, or Framer Motion variants with `staggerChildren`, build the same thing; Rough Notation draws hand-drawn highlights with SVG.
+
+## See also
+- [Text Clip-Path Reveal](../text-clip-path-reveal/) — each line of a headline is uncovered in turn
+- [Outline to Fill](../outline-to-fill/) — hollow letters fill with color, as a wipe or a fade
+- [Text Fill on Scroll](../../01-scroll-based/text-fill-on-scroll/) — words light up one by one as you scroll
+- [Word-by-Word Reveal](../../02-entrance-and-exit/word-by-word-reveal/) — words appear one after another at a reading pace
diff --git a/animations/05-text-typography/highlighter-sweep/index.html b/animations/05-text-typography/highlighter-sweep/index.html
new file mode 100644
index 00000000..cf14d585
--- /dev/null
+++ b/animations/05-text-typography/highlighter-sweep/index.html
@@ -0,0 +1,232 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Highlighter Sweep — Animation Handbook</title>
+ <meta name="description" content="A marker sweeps in behind the key words, one after another. Best for key points.">
+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/highlighter-sweep/">
+ <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
+ <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
+ <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
+ <meta property="og:type" content="article">
+ <meta property="og:site_name" content="Animation Handbook">
+ <meta property="og:title" content="Highlighter Sweep — Animation Handbook">
+ <meta property="og:description" content="A marker sweeps in behind the key words, one after another. Best for key points.">
+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/highlighter-sweep/">
+ <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="Highlighter Sweep — Animation Handbook">
+ <meta name="twitter:description" content="A marker sweeps in behind the key words, one after another. Best for key points.">
+ <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": "Highlighter Sweep", "name": "Highlighter Sweep", "description": "A marker sweeps in behind the key words, one after another. Best for key points.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/highlighter-sweep/", "inLanguage": "en", "articleSection": "Text & Typography", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Text & Typography, Highlighter Sweep"}</script>
+ <style>
+ :root{--ui-accent:#ff6f8b;--marker:#ffe066;--top:.12em}
+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+ .stage{display:flex;align-items:center;justify-content:center;padding:clamp(16px,3vw,24px);background:#0b0b0d}
+ /* A sheet of paper: isolated, so each band can sit behind the words (z-index -1) without dropping behind the sheet */
+ .paper{position:relative;isolation:isolate;width:min(100%,640px);padding:clamp(16px,3vw,32px);border-radius:12px;background:#f7f4ec}
+ .para{font-size:clamp(18px,2.6vw,28px);font-weight:500;line-height:1.5;letter-spacing:-.005em;color:#1d1d22}
+ mark{background:none;color:inherit}
+ /* Each word of a key phrase, with the space after it, carries its own band: so a phrase that wraps is marked line by line */
+ .w{position:relative}
+ .w::before{content:'';position:absolute;z-index:-1;left:-.08em;right:-.08em;top:var(--top);bottom:-.06em;
+ background:var(--marker);transform:scaleX(0);transform-origin:left center;transition:transform var(--t,600ms) var(--e,linear) var(--d,0ms)}
+ /* Only the ends of a phrase are rounded, so its words read as one stroke of the pen */
+ .w:first-child::before{border-radius:.25em 0 0 .3em}
+ .w:last-child::before{border-radius:0 .35em .2em 0}
+ .w:only-child::before{border-radius:.25em .35em .2em .3em}
+ .para.on .w::before{transform:scaleX(1)}
+ .para.out .w::before{opacity:0;transition:opacity .35s linear}
+ .para.snap .w::before{transition:none!important}
+ /* Reduced motion: the bands are full width from the start and fade in, phrase by phrase */
+ @media(prefers-reduced-motion:reduce){
+ .w::before{transform:none;opacity:0;transition:opacity .4s linear var(--d,0ms)}
+ .para.on .w::before{opacity:1}
+ }
+ </style>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=6">
+ <script src="../../../assets/js/demo-page.js?v=6" defer></script>
+</head>
+<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="../wavy-text/" rel="prev" aria-label="Previous: Wavy Text"><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>Wavy Text</span></a></span>
+</nav>
+<main class="hb-page">
+ <header class="hb-head">
+ <p class="hb-cat">05.15 · Text &amp; Typography</p>
+ <h1>Highlighter Sweep</h1>
+ <p class="hb-lede">A marker sweeps in behind the key words, one after another. Best for key points.</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">
+ <div class="paper">
+ <p class="para" id="para">Readers skim first. A marker sweeps behind <mark>the words that matter</mark>, one phrase at a time, so <mark>the main idea</mark> stands out <mark>at a glance</mark>.</p>
+ </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 autocomplete="off"><span>Loop</span></label>
+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
+ </div>
+ </section>
+
+ <section class="hb-step hb-try" aria-labelledby="hb-try-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">2</span>
+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and the animation plays again.</p></div>
+ </div>
+ <div class="hb-settings">
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="color-lbl">Marker color</p>
+ <div class="swatches" id="color-sw" role="group" aria-labelledby="color-lbl">
+ <button type="button" class="on" aria-pressed="true" aria-label="Yellow" data-c="#ffe066" style="background:#ffe066"></button>
+ <button type="button" aria-pressed="false" aria-label="Pink" data-c="#ffa8cc" style="background:#ffa8cc"></button>
+ <button type="button" aria-pressed="false" aria-label="Green" data-c="#a6efab" style="background:#a6efab"></button>
+ <button type="button" aria-pressed="false" aria-label="Blue" data-c="#a9d5ff" style="background:#a9d5ff"></button>
+ <button type="button" aria-pressed="false" aria-label="Orange" data-c="#ffc27d" style="background:#ffc27d"></button>
+ </div>
+ <p class="hb-hint">Light colors keep the dark words easy to read.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="speed-lbl">Speed</p>
+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
+ <button type="button" data-ms="1300" 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 the marker takes to cross each phrase.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="cover-lbl">How much it covers</p>
+ <div class="seg" id="cover-seg" role="group" aria-labelledby="cover-lbl">
+ <button type="button" data-top=".12em" class="on" aria-pressed="true">Whole words</button>
+ <button type="button" data-top=".62em" aria-pressed="false">Lower half</button>
+ </div>
+ <p class="hb-hint">The lower half reads like a thick underline.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">3</span>
+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
+ </div>
+ <div class="hb-card">
+ <p class="hb-prompt">Add a highlighter sweep to [the key words in your paragraph or quote]. Behind each key phrase, a band of marker color grows from left to right, as if drawn with a highlighter pen, and the phrases are marked one after another in reading order. Draw the band behind the text, never over it, and grow it by scaling it from its left edge, so the words never move or reflow. When a phrase wraps onto a second line, sweep each line in turn, as one continuous stroke. Keep the words dark enough to read on the marker color. If the visitor has reduced motion turned on, fade the highlights in instead of sweeping them. Match the settings listed below.</p>
+ <div class="hb-chips-box" hidden>
+ <p class="hb-chips-title">Your settings</p>
+ <ul class="hb-chips"></ul>
+ </div>
+ <div class="hb-copy-row">
+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="hb-about" aria-labelledby="hb-what-title">
+ <div class="hb-what">
+ <h2 id="hb-what-title">What it is</h2>
+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
+ </div>
+ <div class="hb-fit">
+ <h2>Good for</h2>
+ <ul class="hb-tags hb-good"><li>Key points</li><li>Quotes</li><li>Headlines</li><li>Study notes</li></ul>
+ <h3>Avoid on</h3>
+ <ul class="hb-tags hb-avoid"><li>Long paragraphs</li><li>Too many words</li></ul>
+ </div>
+ </section>
+
+ <section class="hb-related" aria-labelledby="hb-related-title" hidden>
+ <h2 id="hb-related-title">Similar animations</h2>
+ <div class="hb-rel-list"></div>
+ </section>
+</main>
+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer>
+<script>
+ const para=document.getElementById('para');
+ 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;
+ const START=200,GAP=250; // the wait before the first phrase and between phrases: holds, which Slow motion does not stretch
+ let ms=700,timers=[],total=0;
+
+ // Each key phrase's words become spans that keep the space after them, so the bands of one line join up
+ const phrases=[...para.querySelectorAll('mark')].map(m=>{
+ const parts=m.textContent.split(' ');
+ m.textContent='';
+ return parts.map((word,i)=>{
+ const s=document.createElement('span');
+ s.className='w';
+ s.textContent=i<parts.length-1?word+' ':word;
+ m.appendChild(s);
+ return s;
+ });
+ });
+
+ // One smooth curve S per phrase: the pen speeds up and slows down once, not once per word. A word covering p0..p1 of the
+ // phrase's width runs between the times where S reaches p0 and p1 (inv), and its own curve is that piece of S, as a cubic Bezier.
+ const S=t=>t*t*(3-2*t),dS=t=>6*t*(1-t);
+ function inv(p){let a=0,b=1;for(let i=0;i<24;i++){const m=(a+b)/2;if(S(m)<p)a=m;else b=m}return (a+b)/2}
+ function plan(){
+ const D=ms*(slowTog.checked?3:1),reduced=!motionOk();
+ let at=START;
+ phrases.forEach(words=>{
+ const widths=words.map(w=>w.offsetWidth),sum=widths.reduce((a,b)=>a+b,0)||1;
+ let p0=0;
+ words.forEach((w,i)=>{
+ const p1=p0+widths[i]/sum,t0=inv(p0),t1=i===words.length-1?1:inv(p1),k=(t1-t0)/Math.max(p1-p0,1e-6);
+ w.style.setProperty('--d',Math.round(at+(reduced?0:t0*D))+'ms');
+ w.style.setProperty('--t',Math.max(1,Math.round((t1-t0)*D))+'ms');
+ w.style.setProperty('--e','cubic-bezier(.333,'+(dS(t0)*k/3).toFixed(3)+',.667,'+(1-dS(t1)*k/3).toFixed(3)+')');
+ p0=p1;
+ });
+ at+=(reduced?400:D)+GAP;
+ });
+ total=at-GAP;
+ }
+ function later(fn,wait){timers.push(setTimeout(fn,wait))}
+ // Every play starts from bare paper: the bands drop to nothing without a transition, then sweep in again
+ function sweep(){
+ para.classList.add('snap');
+ para.classList.remove('on','out');
+ void para.offsetWidth;
+ para.classList.remove('snap');
+ para.classList.add('on');
+ }
+ // One play marks the phrases in turn. While Loop is on, the marks hold 1600ms, fade away and the play starts again;
+ // switching Loop off leaves them marked.
+ function cycle(){
+ plan();sweep();
+ if(!loopTog.checked||!motionOk())return;
+ later(()=>{
+ if(!loopTog.checked)return;
+ para.classList.add('out');
+ later(cycle,450);
+ },total+1600);
+ }
+ function play(){timers.forEach(clearTimeout);timers=[];cycle()}
+
+ 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('color-sw',d=>{vars.setProperty('--marker',d.c)});
+ choices('speed-seg',d=>{ms=+d.ms});
+ choices('cover-seg',d=>{vars.setProperty('--top',d.top)});
+</script>
+</body>
+</html>
diff --git a/animations/05-text-typography/wavy-text/index.html b/animations/05-text-typography/wavy-text/index.html
index a38811c3..9df6f4de 100644
--- a/animations/05-text-typography/wavy-text/index.html
+++ b/animations/05-text-typography/wavy-text/index.html
@@ -41,7 +41,7 @@
<body class="hb" data-hb-kind="loop">
<nav class="hb-bar" aria-label="Animation Handbook">
<a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../text-on-path/" rel="prev" aria-label="Previous: Text on a Path"><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>Text on a Path</span></a></span>
+ <span class="hb-pager"><a href="../text-on-path/" rel="prev" aria-label="Previous: Text on a Path"><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>Text on a Path</span></a><a href="../highlighter-sweep/" rel="next" aria-label="Next: Highlighter Sweep"><span><span class="hb-dir">Next: </span>Highlighter Sweep</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">
diff --git a/index.html b/index.html
index d987f290..10f67216 100644
--- a/index.html
+++ b/index.html
@@ -722,6 +722,19 @@ button,input{font:inherit;color:inherit}
.pv-carousel .track{display:block;animation:t-carousel 4.4s var(--ease) infinite}
.pv-carousel .track b{display:block;height:1.1em;line-height:1.1em}
@keyframes t-carousel{0%,18%{transform:translateY(0)}25%,43%{transform:translateY(-1.1em)}50%,68%{transform:translateY(-2.2em)}75%,93%{transform:translateY(-3.3em)}100%{transform:translateY(0)}}
+/* a sheet with three lines of words: a marker sweeps behind one word of each line in turn, holds, and fades; 1cqh is 1% of the stage's height */
+.pv-hilite{background:#0c0608;display:grid;place-items:center;container-type:size}
+.pv-hilite .ppr{display:flex;flex-direction:column;gap:9cqh;width:66%;margin-top:9cqh;padding:8cqh 7%;border-radius:6px;background:#f4f1e8}
+.pv-hilite .ln{display:flex;gap:6%}
+/* each word is drawn by its ::after, painted after the band (::before), so the band sits behind the word */
+.pv-hilite .ln b{position:relative;flex:none;height:6cqh}
+.pv-hilite .ln b::after{content:"";position:absolute;inset:0;border-radius:2px;background:#45454d}
+.pv-hilite .ln .k::before{content:"";position:absolute;left:-5%;right:-5%;top:-55%;bottom:-55%;border-radius:3px;background:#ffd84d;transform:scaleX(0);transform-origin:left center;animation:hl-a 4s cubic-bezier(.45,0,.3,1) infinite}
+.pv-hilite .ln .k2::before{animation-name:hl-b}
+.pv-hilite .ln .k3::before{animation-name:hl-c}
+@keyframes hl-a{0%,6%{transform:scaleX(0);opacity:1}20%,78%{transform:scaleX(1);opacity:1}90%,100%{transform:scaleX(1);opacity:0}}
+@keyframes hl-b{0%,26%{transform:scaleX(0);opacity:1}40%,78%{transform:scaleX(1);opacity:1}90%,100%{transform:scaleX(1);opacity:0}}
+@keyframes hl-c{0%,46%{transform:scaleX(0);opacity:1}62%,78%{transform:scaleX(1);opacity:1}90%,100%{transform:scaleX(1);opacity:0}}
/* ── bespoke: 06 3D & Advanced ── */
.pv-orbit3d{background:#05080a;display:grid;place-items:center;perspective:460px}
@@ -1019,7 +1032,7 @@ button,input{font:inherit;color:inherit}
<section class="wrap home-hero" aria-labelledby="hero-title">
<span class="float fl1" aria-hidden="true"></span><span class="float fl2" aria-hidden="true"></span><span class="float fl3" aria-hidden="true"></span>
<span class="float fl4" aria-hidden="true"></span><span class="float fl5" aria-hidden="true"></span><span class="float fl6" aria-hidden="true"></span>
- <p class="pill"><span class="pill-dot" aria-hidden="true"></span>130 free animations · no coding needed</p>
+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>131 free animations · no coding needed</p>
<h1 class="h1" id="hero-title">What do you want to animate?</h1>
<p class="sub">Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.</p>
<form class="search" id="search-form" role="search" action="./" method="get">
@@ -1076,8 +1089,8 @@ button,input{font:inherit;color:inherit}
<p class="empty-s">Try a simpler word, or pick one of these:</p>
<p class="pop"><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p>
</div>
- <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 130 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
- <noscript><p class="noscript">This page shows its animations with JavaScript. All 130 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
+ <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 131 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
+ <noscript><p class="noscript">This page shows its animations with JavaScript. All 131 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
</section>
<section class="how" id="how" aria-labelledby="how-title">
@@ -1095,7 +1108,7 @@ button,input{font:inherit;color:inherit}
<footer class="wrap foot">
<a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <p class="foot-t">130 web animations with live demos and copyable prompts.</p>
+ <p class="foot-t">131 web animations with live demos and copyable prompts.</p>
<nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
</footer>
<div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>
@@ -1239,6 +1252,7 @@ const CATS=[
['glitch-text','Glitch Text','Text tears into red and cyan strips like a broken signal. Best for bold titles.'],
['text-on-path','Text on a Path','Text travels along a wave, an arc or a circle. Best for badges and seals.'],
['wavy-text','Wavy Text','A wave rolls through the word, letter by letter. Best for playful titles.'],
+ ['highlighter-sweep','Highlighter Sweep','A marker sweeps in behind the key words, one after another. Best for key points.'],
]
},
{
@@ -1328,7 +1342,7 @@ const PV={
'grain-overlay':'grain2','scanline':'scan','light-leak':'leak','floating-elements':'floaters',
'grid-dot-pattern-parallax':'dotgrid','abstract-geometric-motion':'geo',
'magnetic-button':'magnet','heart-burst':'heart','success-confetti':'confetti','error-shake':'shake','swipe-to-dismiss':'swipe',
- 'glitch-text':'glitch','text-on-path':'onpath','wavy-text':'wavy',
+ 'glitch-text':'glitch','text-on-path':'onpath','wavy-text':'wavy','highlighter-sweep':'hilite',
'particle-constellation':'particles','flow-field':'flow','synthwave-grid':'synth'
};
@@ -1434,6 +1448,7 @@ const PLACES={
'glitch-text':['text'],
'text-on-path':['text'],
'wavy-text':['text'],
+ 'highlighter-sweep':['text'],
// 06
'3d-model-orbit':['imgcard'],
'scroll-driven-3d-rotation':['scroll','imgcard'],
@@ -1483,6 +1498,9 @@ function pvMarkup(k){
case 'sig3': return '<span class="s3 pa anim"></span><span class="s3 pb anim"></span>';
case 'sig4': return '<span class="s4r anim"></span><span class="s4r r2 anim"></span><span class="s4r r3 anim"></span><span class="s4d"></span>';
case 'sig5': return '<span class="s5 anim"></span><span class="s5 anim"></span><span class="s5 anim"></span>';
+ case 'hilite': return '<span class="ppr"><span class="ln"><b style="width:24%"></b><b class="k anim" style="width:40%"></b><b style="width:22%"></b></span>'+
+ '<span class="ln"><b style="width:20%"></b><b style="width:28%"></b><b class="k k2 anim" style="width:38%"></b></span>'+
+ '<span class="ln"><b class="k k3 anim" style="width:44%"></b><b style="width:30%"></b></span></span>';
case 'sig6': return '<div class="cube anim"><span class="face f1"></span><span class="face f2"></span><span class="face f3"></span><span class="face f4"></span><span class="face f5"></span><span class="face f6"></span></div>';
case 'sig7': return '<span class="s7 anim"></span>';
case 'aurora': return '<span class="band b1 anim"></span><span class="band b2 anim"></span><span class="band b3 anim"></span>';
@@ -1761,7 +1779,7 @@ let shown=[];
// under the place label or between two states). Nothing here runs without reduced motion.
const STILL={
cover:.1,curtain:.6,kinetic:.25,carousel:.1,typewriter:.55,textclip:.7,svgpath:.7,smoke:.3,leak:.7,
- flash:.41,blurpage:.2,toggle:.7,shake:.8,hideheader:.72
+ flash:.41,blurpage:.2,toggle:.7,shake:.8,hideheader:.72,hilite:.7
};
function hold(card){
const anims=card.querySelector('.pv').getAnimations({subtree:true});
diff --git a/sitemap.xml b/sitemap.xml
index 24a843eb..6e40857a 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -96,6 +96,7 @@
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/glitch-text/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/text-on-path/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/wavy-text/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/highlighter-sweep/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/3d-model-orbit/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/scroll-driven-3d-rotation/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/parallax-3d-tilt/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>