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: Pause stops at once on the page loops (owner decision)
matincb740df2ab6e
diff --git a/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md b/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.mdindex 24d879d3..be3c6174 100644--- a/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md+++ b/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md@@ -558,7 +558,7 @@ Each of Tasks 4–10 converts two pages. For each page, follow its section of th5. **Script:** rewrite the page's script so that:- **plays once:** the Replay button (`id="btn-play"`, `data-hb-replay`) plays from the start and keeps looping when Loop is on; switching Loop off lets the current cycle finish with the text shown (Rotate In's `cycle()`/`play()` pattern); Slow motion multiplies the sheet's durations and the timers that wait for them by 3 (not the pauses), taking effect on the next play; every play restarts the animated pieces themselves (rebuild or reset them hidden, `void el.offsetWidth`, then show them). The shared script replays after every setting change and turns Loop on at arrival; the page's script must not do either itself.- **loop, Pause "css":** the looping CSS animations run from page load with no Replay, Loop or autoplay code. If the page also has timers (for example random glitches), it stops them on `document`'s `hb:pause` event when `e.detail.paused` is true and starts them again when it is false.- - **loop, Pause "page":** the page starts its loop at load and listens for `hb:pause`: paused → clear its timers or cancel its animation frame; not paused → carry on from where it is. With Slow motion "page", the durations of movements and the timers that wait for a movement to finish are multiplied by 3 while the switch is on; holds between movements keep their length, as on plays-once pages. A `change` on the switch takes effect from the next step at the latest.+ - **loop, Pause "page":** the page starts its loop at load and listens for `hb:pause`: paused → freeze at once (cancel its animation frame, or stop its one pending timer keeping the time it had left and pause the stage's running transitions — the owner's decision "Pause stops at once"; the content sheet's preamble has the helper); not paused → carry on from exactly where it stopped. With Slow motion "page", the durations of movements and the timers that wait for a movement to finish are multiplied by 3 while the switch is on; holds between movements keep their length, as on plays-once pages. A `change` on the switch takes effect from the next step at the latest.- **every loop:** changing a setting while paused shows the new setting without starting the loop again (for "css" pages the shared class already holds new animations). Register the `hb:pause` listener at the top level of the page's inline script: the shared script runs after it and may pause the loop on arrival, so a listener added later (for example in a `DOMContentLoaded` handler) would miss that.- **every page:** the page's script reaches the player controls by their ids (`btn-play`, `loop-tog`, `slow-tog`, `btn-pause`), never by their `data-hb-*` attributes: the page checks count those attribute names anywhere in the file.- every setting sets what its "Sets in the demo" column says; choice buttons toggle `.on` and `aria-pressed` (Rotate In's `choices()` helper); sliders update their `output.hb-value` with the plain value; swatches toggle `aria-pressed`; typed text is added with `textContent` or `createTextNode`, never as HTML, and text split into letters keeps each word's letters in one `span` that cannot break (Task 1's `.unit-word` pattern, with one normal space between words);diff --git a/docs/superpowers/plans/2026-09-28-text-typography-content.md b/docs/superpowers/plans/2026-09-28-text-typography-content.mdindex 0354da1b..e8165a9e 100644--- a/docs/superpowers/plans/2026-09-28-text-typography-content.md+++ b/docs/superpowers/plans/2026-09-28-text-typography-content.md@@ -15,6 +15,18 @@ How to read a section:- **Stage text** drops Georgia, Arial Narrow and italics, so it uses the site font. Phrases and sentences get `font-weight:700`, as on the Entrance & Exit text stages. Single display words get `800`, unless the section says otherwise. Small grey stage text uses `#8a8a92`, which is 5.9:1 on the stages' `#04060c`. The old `#77777e` is 4.6:1 there, but only 4.0:1 over the `hb-dots` dots.- **`hb-dots`** is left off where the stage has its own radial gradient, because `hb-dots` replaces the stage's background image.- **Category line:** the pages have none today. NN is the page's position on the home page, which its card already shows (05.01 Kinetic Typography to 05.14 Wavy Text). This is how the Entrance & Exit pages are numbered.+- **Pause stops at once (owner decision, 2026-09-28).** On the page loops (Rotate Word Carousel, Text Morphing, Variable Font Morph), Pause freezes the loop exactly where it is, even halfway through a change, and Play continues from that point. This replaces "a step under way finishes" and the `sliding` / `morphing` "under way" flags in those sections. Each page keeps one pending timer at a time and freezes it with the time it had left, and freezes the stage's running transitions:++ ```js+ // Pause freezes the step under way: its transitions stop where they are and its timer keeps the time it had left.+ let timer=0, next=null, due=0, left=0, held=[], paused=false;+ function wait(fn,ms){ clearTimeout(timer); next=fn; if(paused){ left=ms; return; } due=performance.now()+ms; timer=setTimeout(()=>{ next=null; fn(); },ms); }+ function freeze(){ paused=true; clearTimeout(timer); if(next) left=Math.max(0,due-performance.now()); held=stage.getAnimations({subtree:true}).filter(a=>a.playState==='running'); held.forEach(a=>a.pause()); }+ function thaw(){ paused=false; held.forEach(a=>{ if(a.playState==='paused') a.play(); }); held=[]; if(next) wait(next,left); }+ document.addEventListener('hb:pause',e=>e.detail.paused?freeze():thaw());+ ```++ Every timer of the loop goes through `wait()`, so there is always exactly one chain and Play can never start a second one. A setting or typed text that restarts the loop while paused (`start()`) clears `timer` and `next`, shows the first word at rest, and schedules the next step with `wait()`, which only records it; Play then continues from there. `stage` is the page's `.hb-page .stage`.---