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
docs: small corrections in the Scroll-Based sheet part 2
matin9bfd9cf6a246
diff --git a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md b/docs/superpowers/plans/2026-09-29-scroll-content-part2.mdindex e4cf43f3..80a57fe4 100644--- a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md+++ b/docs/superpowers/plans/2026-09-29-scroll-content-part2.md@@ -32,7 +32,7 @@ The two lists below, A and B, were settled after both halves were reviewed. They4. **Trigger lines:** every trigger-line choice must be reachable within the box's scroll distance at every size, from the tallest box to a narrow window just over 600px (part 1: Reveal on Scroll, Stagger Reveal, ScrollTrigger Animation — check and state it).5. **`container-type:size`:** only on a scroller whose height comes from outside (the stage, or `height:100%` of it); never together with `hb-grow`; never padding on that scroller (cqh measures its content box); any `cqh` use needs that container (without one it falls back to the viewport). No `--box-h` script fallback.6. **Play stops on input:** the shared script stops Play on any trusted input anywhere inside the stage (pointer, wheel, touch, key). Sections state it as a fact; no page works around it (part 2's Scrollspy "blocker" line becomes a plain statement).-7. **Snapping during Play:** the shared script turns CSS scroll snapping off on the scroller while Play runs — it saves the scroller's inline `scroll-snap-type`, sets it to `none`, and restores the saved inline value when the run ends, is stopped, or Back to top is pressed (it does nothing when snapping is already off). So no page sets `scroll-snap-type` inline: Snap Scrolling's Snapping setting sets an attribute (e.g. `data-snap="mandatory|proximity|off"` with three CSS rules). When a wheel turn stops Play, snapping returns and the box settles on the nearest point by itself.+7. **Snapping during Play:** while Play runs, the shared script marks the scroller with `data-hb-autoscrolling`, and a shared rule turns CSS scroll snapping off on a marked scroller (`scroll-snap-type:none !important`). When the run ends, is stopped, or Back to top is pressed, the mark goes and the scroller's own snapping applies again — whatever the page set, even during the run. Pages set snapping however they like, but never with `!important`; Snap Scrolling's Snapping setting sets an attribute (e.g. `data-snap="mandatory|proximity|off"` with three CSS rules). When a wheel turn stops Play, snapping returns and the box settles on the nearest point by itself.8. **Instant jumps:** Back to top, and Play restarting from the top, are instant jumps. Say so wherever an effect reads scroll speed or eases toward the scroll position; Velocity Skew ignores the frame after a jump (listen for clicks on `#btn-top` / `#btn-scroll`, by id) and measures speed per 1/60 s, so 120 Hz screens lean the same.9. **Small stage text:** paragraph text in the stage is at least 14px; small labels (chips, ticks, captions, buttons) at least 11px. Part 1: `.chip-name`, `.card-sub`, `.card-btn`, `.dir` grow to 11px. Part 2: Smooth Scroll's `.card-body` and Background Color's `p` go to 14px.10. **Text that changes every frame** (counters, depth numbers, frame counts): `role="img"` plus an `aria-label` with the real value, or `aria-hidden="true"` when it only repeats something else on the stage; never a live region (part 1: Scrollytelling's `#depth-num`, Scrub Animation's frame count and `.dir`).@@ -187,7 +187,7 @@ The two lists below, A and B, were settled after both halves were reviewed. They- `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A section that holds still while its content changes"`. `position:relative` also puts the steps back in the right place: today `wrap.offsetTop` is measured from the top of the page.- `.spacer`: `height:100cqh` and the cue style; the texts are "Scroll down ↓" and "The page moves on ↓".- `#sticky-wrap{height:400cqh}`; `#sticky-inner`, `#text-col` and `#vis-col` each get `height:100cqh`.- - The text is sized to fit every stage, down to the smallest. Each step centres its text, so a short stage only eats into the padding. Measured, the tallest step's text is 183px at 1366 and 1280 wide (263px with its padding), which fits the 258px smallest stage, and 164px on phones:+ - The text is sized to fit every stage, down to the smallest. Each step centres its text, so a short stage only eats into the padding. Measured, the tallest step's text is 183px at 1366 and 1280 wide (263px with its padding), which fits the 258px smallest stage; 164px on a 375px phone; and 187px on a 320px phone and at 601px wide, where the text column is narrowest. All of these fit:- `.state{padding:clamp(24px,4vw,40px)}`;- `.state-eye{font-size:12px;font-weight:600}`, keeping its capitals, letter spacing and inline colour, without the opacity .6;- `.state-head{font-size:clamp(20px,2.6vw,28px);line-height:1.2}`;@@ -252,7 +252,7 @@ The two lists below, A and B, were settled after both halves were reviewed. They- **Player bar:** Play · Back to top- **Scroller:** the stage.- **What scrolling shows:** the cue "Scroll down ↓", then four tiles (active users, uptime, revenue, experience). When the top of the tiles passes the line that Starts counting sets, the four numbers count up from zero to 12,847, 98.4%, $2.4M and 8 yrs, formatted the whole way. Scrolling back above the line and down again counts again; as today, the numbers keep their totals until the next count starts from zero.-- **Scroll distance and Play:** a 100cqh lead-in, then `#stats`, which holds the tiles (measured: 292px tall on phones, 350px at 768×1024, 402px on laptops). The empty spacer after the tiles goes, so the box ends with the tiles in view instead of an empty screen. `#stats` gets `min-height:80cqh`, so the box always scrolls at least 80cqh. Late needs 70cqh, so every Starts counting choice is reached at every size (rule B4). Measured on a prototype at 610×1000, 640×1000, 768×1024, 1280×590, 1366×657, 1280×800, 375×812 and 320×640: all three lines are reached at each. At the default (Middle), Play reaches the line 2 to 3 s into its pass, and the count (1.8 s, with 0.6 s more for the last tile) ends before the box stops: at 5.4 s at the latest, on a 768×1024 tablet.+- **Scroll distance and Play:** a 100cqh lead-in, then `#stats`, which holds the tiles. Measured, the tiles need 292px on phones, 345px at 768×1024 and 402px on laptops; at 768×1024 the 80cqh minimum below (350px) is the taller. The empty spacer after the tiles goes, so the box ends with the tiles in view instead of an empty screen. `#stats` gets `min-height:80cqh`, so the box always scrolls at least 80cqh. Late needs 70cqh, so every Starts counting choice is reached at every size (rule B4). Measured on a prototype at 610×1000, 640×1000, 768×1024, 1280×590, 1366×657, 1280×800, 375×812 and 320×640: all three lines are reached at each. At the default (Middle), Play reaches the line 1.6 s into its pass at 1280×590, 2.0 s at 1366×657, 2.5 s on phones and 3.0 s on tablets. The count (1.8 s, with 0.6 s more for the last tile) ends before the box stops: at 5.4 s at the latest, on a 768×1024 tablet.- **Reduced motion:** nothing scrolls by itself. As today, the numbers jump to their totals when the tiles pass the line (the `motionOk` branch stays). The CSS rule `.tile-num{transition:none}` goes: the numbers have no transition.- **Stage font:** site font. `.tile-num` drops `var(--disp)` and keeps weight 700.- **Stage:**@@ -752,7 +752,7 @@ None: leave out the `details.hb-options` block.- **Stage:**- `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A paragraph that fills word by word as you scroll"`.- `.track{height:350cqh}`; `.pinned{height:100cqh}`.- - The paragraph is shortened from 80 words to 48, and its size becomes `font-size:clamp(17px,2.4vw,24px)`: today's paragraph needs 393px on phones and 538px on laptops, more than the stage. `.pinned` centres the paragraph, so a short stage only eats into the padding. Measured with the new text, the paragraph is 216px high at 1366 and 1280 wide (304px with its padding), which fits the 258px smallest stage, and 179px on phones. The new text:+ - The paragraph is shortened from 80 words to 48, and its size becomes `font-size:clamp(17px,2.4vw,24px)`: today's paragraph needs 393px on phones and 538px on laptops, more than the stage. `.pinned` centres the paragraph, so a short stage only eats into the padding. Measured with the new text, the paragraph is 216px high at 1366 and 1280 wide (304px with its padding), which fits the 258px smallest stage. It is 179px on a 375px phone and 230px on a 320px phone, both inside the 298px phone stage. The new text:> Scroll is not a play button. It is a position. Every word here watches how far you have read. Words behind that point light up; words ahead wait in the dark. Stop anywhere and the sentence holds still. Scroll back up and it un-reads itself, word by word.@@ -873,6 +873,7 @@ None: leave out the `details.hb-options` block.- [Scrub Animation](../scrub-animation/) — movement tied to where you are, not how fast you go- [Marquee / Ticker](../../05-text-typography/marquee-ticker/) — text that scrolls sideways forever, often sped up by scrolling- **README How it works:**+ - In the paragraph before the snippet, "the per-frame difference in `scrollTop`" becomes "the change in `scrollTop` from one frame to the next, counted per sixtieth of a second".- The snippet becomes:```js@@ -977,8 +978,8 @@ None: leave out the `details.hb-options` block.- **Scroller:** `<div class="doc" id="doc" data-hb-scroller tabindex="0" role="region" aria-label="Documentation sections">` inside the `.stage`. The `.stage` does the job of today's `.stage-wrap`: it holds the menu (`nav.spy-nav`) beside the scroller, so the menu stays in place. The script calls the scroller `doc` wherever it said `stage`. The page adds no focus rule: the shared stylesheet draws the focus ring of the scroller and of the menu links inset, inside the stage (rule B2).- **Play and the menu:** the shared script stops Play on any trusted input anywhere inside the stage (rule B6), including a press on a menu link, so Play has stopped before the link scrolls the box. The link handler needs nothing more.- **What scrolling shows:** six documentation sections scroll by. As a section's heading passes the line that Link changes at sets, its link lights and the marker slides to it; at the very bottom the last link lights. Pressing a link glides (or jumps) to its section and lights that link at once, without flickering through the links in between. Under 600px wide the menu is a strip across the top, as today.-- **Scroll distance and Play:** six sections of at least 500px (3,000px in the site font at every width) and a 40cqh run-out: about 6 box heights on a 440px tablet stage and 9 on a phone. Play passes about one section a second, so the marker steps down the menu about once a second.-- **Every Link changes at choice reaches every section** (rule B4). The last heading sits 2,500px down, and at the end of the scroll even the highest line (20% down) is at 3,000px − 0.4 × the box height, below that heading for any box up to 1,250px tall. The last link is also forced on at the very bottom, as today.+- **Scroll distance and Play:** six sections of at least 500px and a 40cqh run-out. In the site font the sections are exactly 500px (3,000px in all) from 375px wide up. On a 320px phone the text wraps more, and each section is 564px (3,384px in all). Measured, that is about 6 box heights on a 440px tablet stage, 8.6 at 1366×657, 9.5 on a 375px phone, 10.8 on a 320px phone and 11 in the smallest stage (1280×590). Play passes about one section a second, so the marker steps down the menu about once a second.+- **Every Link changes at choice reaches every section** (rule B4). At the end of the scroll even the highest line (20% down) sits 0.4 × the box height above the bottom of the last section. That section is at least 500px tall, so the line has passed its heading in any box up to 1,250px tall. The last link is also forced on at the very bottom, as today.- **Reduced motion:** nothing scrolls by itself. As today, a link jumps to its section instead of gliding (`reduced` in the click handler), and the marker and link colours change without their transitions (the demo's rule stays).- **Stage font:** site font. The section headings become `h3` (rule B13; the script builds them), and `.sec h3` takes today's `.sec h2` rule without `var(--disp)`, keeping weight 800. `.spy-link` gets `font:inherit;font-size:14px;font-weight:500` in place of `font-family:var(--mono)` and 11px.- **Stage:**