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: add the focusin rule, Reset's cancelled animations, the short-window spacing and hidden pages to the Page Transitions sheet's preamble
matin783f2e691eac
diff --git a/docs/superpowers/plans/2026-09-29-transitions-content.md b/docs/superpowers/plans/2026-09-29-transitions-content.mdindex 1d35903b..ceb0b380 100644--- a/docs/superpowers/plans/2026-09-29-transitions-content.md+++ b/docs/superpowers/plans/2026-09-29-transitions-content.md@@ -32,8 +32,8 @@ This sheet decides, page by page, how the twelve Page Transitions pages present2. It goes to the next page, `(current + 1) % 3`, through the same `navigate()` a click on that page's name runs. It passes a callback that runs when this transition has ended, at the point where the page's code sets `animating=false` today. Under reduced motion the page swaps with no movement, and the callback runs straight away. Keep the callback in one page-level variable (for example `afterMove`): the transition's end code runs it once and clears it, and `settle()` and `hb:input` clear it too.3. That callback schedules the way back with `later()` 1200ms later: `navigate()` to the page the run started from. This hold is not stretched by Slow motion.Shared Element Transition and FLIP Technique follow the same three steps with their own transitions (see their sections).-- **`hb:input` stops a run under way.** It fires when the visitor presses, types, scrolls or touches inside the stage. It cancels the step not yet started: the end-of-transition callback and the 1200ms timer of the way back. A transition already moving finishes normally and nothing follows, so the visitor is in control. A click on a page name during the hold therefore cancels the way back and plays the visitor's own transition. One gesture can send `hb:input` more than once (a touch sends `touchstart` and `pointerdown`), so the handler does nothing but clear `afterMove` and the way-back timer: running it twice is harmless. It never calls `settle()` and never touches the View Transitions run counter, which only `settle()` advances.-- **Reset** calls `settle()`, then shows the demo's first state at once, with no transition (for the page-change demos: the first page, Home, with its name highlighted, the other pages hidden, and their inline transition, transform, filter, clip-path and animation styles cleared). The old "← Return to Home" did the same but ignored clicks during a transition; Reset works at any moment.+- **`hb:input` stops a run under way.** It fires when the visitor presses, types, scrolls or touches inside the stage. It cancels the step not yet started: the end-of-transition callback and the 1200ms timer of the way back. A transition already moving finishes normally and nothing follows, so the visitor is in control. A click on a page name during the hold therefore cancels the way back and plays the visitor's own transition. One gesture can send `hb:input` more than once (a touch sends `touchstart` and `pointerdown`), so the handler does nothing but clear `afterMove` and the way-back timer: running it twice is harmless. It never calls `settle()` and never touches the View Transitions run counter, which only `settle()` advances. **A run that hides or swaps what a keyboard can reach also stops when the visitor tabs into the stage** (Shared Element Transition hides Back at the end of its run; Portal / Tunnel Zoom swaps the pages and moves focus to the new page's portal). A trusted `focusin` inside the stage that the page did not cause does what `hb:input` does, clearing `afterMove` and the way-back or close timer, so the visitor's focus stays where they put it instead of being dropped to `<body>` or moved to another control. The page's own `focus()` calls must not count, because a programmatic focus is a trusted `focusin` too: each is wrapped in a flag, `{ownFocus=true;….focus({preventScroll:true});ownFocus=false}`, and the listener does nothing while the flag is set. The other page-name demos need no such rule (checked on Crossfade).+- **Reset** calls `settle()`, then shows the demo's first state at once, with no transition (for the page-change demos: the first page, Home, with its name highlighted, the other pages hidden, and their inline transition, transform, filter, clip-path and animation styles cleared). The old "← Return to Home" did the same but ignored clicks during a transition; Reset works at any moment. Reset also cancels the animations still running on the elements it resets (`getAnimations()`, then `cancel()`): a fade already heading for the resting value keeps going when its inline `transition` is cleared, so without this it would run on after Reset (measured on Shared Element Transition and on the View Transitions API page without the API; the other ten pages already cancel).- **A click on the page already shown does nothing,** as today. Clicks during a transition are still ignored (`animating`), as today.### Starting a transition (no double requestAnimationFrame)@@ -48,7 +48,7 @@ Eight demos put an element in its starting state with `transition:none` and star- The aside goes entirely: the note, the State readouts, the live value readouts and the frame loops that updated them, the History log, and "← Return to Home" / "← Return to Grid" / "Reset layout", which the player bar's Reset replaces. The injected `.ah-bar`, its `ah-inject` style and its copy script go, as in "How to convert a page".- `.stage` keeps the demo's own `display:flex;flex-direction:column;overflow:hidden;background:var(--bg)`. It drops `flex:1`, `min-width:0`, `height:var(--stage-h)`, `border` and `border-radius`, because the shared stylesheet owns the stage's size, border and corners. `--stage-h` goes, and so does the old phone block (stacking, `--stage-h:480px`, button heights). `hb-dots`: no, on every page: the mini nav and the pages fill the stage.-- **Height:** the default height fits every page-change demo. This was measured with a scratch copy of the mini pages on the shared stage: the page area is 313px tall at 1280×800, 260px at 1366×657 and 233px on a 375px or 320px phone, and the tallest mini page, Work, ends inside it on every size (at 253px, 226px and 205px). Portal / Tunnel Zoom sets a phone height, and FLIP Technique uses `hb-grow`; see their sections.+- **Height:** the default height fits every page-change demo. This was measured with a scratch copy of the mini pages on the shared stage: the page area is 313px tall at 1280×800, 260px at 1366×657 and 233px on a 375px or 320px phone, and the tallest mini page, Work, ends inside it on every size (at 253px, 226px and 205px). **Short windows** (1280×590 and 812×375, where the stage is 260px and the page area 193px) get a spacing rule on every page-change page, `@media(max-height:640px){.pc{gap:8px}.gi{padding:12px}}` (Flash adds `.pp{line-height:1.5}.pgrid,.pstat{margin-top:0}`), which keeps at least 11px above and below every mini page at a 193px page area. Portal / Tunnel Zoom sets a phone height, and FLIP Technique uses `hb-grow`; see their sections.- `:root` keeps `--bg`, `--ui-bg`, `--ui-border`, `--ui-accent:#b98cff`, `--ui-text`, `--ui-muted` and the demo variables its CSS reads. `--disp`, `--mono`, `--stage-h` and the variables nothing reads (each section names them) go. `--ui-muted` becomes `#8a8a92`: the old `#77777e` is 4.2:1 on the nav's `#111114`, and the new one is 5.5:1.- **Site font:** remove `font-family` from `.nav-btn`, `.tb-btn` and `.nav-back`; the other rules that set it (`body`, `select`) go with the old layout. Stage text inherits Schibsted Grotesk.- **Mini nav** (the ten page-change demos):@@ -58,6 +58,7 @@ Eight demos put an element in its starting state with `transition:none` and star- **Mini pages** (Home, Work or Gallery, About):- Each page's `<h2 class="ph">` becomes `<p class="ph">`, so the demo's sample headings do not join the page's outline of steps. `.ph` keeps its size and `font-weight:bold`.- `.pe` and `.pstat span` go from `opacity:.4` to `.6`: 3.4:1 becomes 5.7:1 on the pages' backgrounds. `.pp` stays at `.6` (5.7:1), or `.55` on Flash (5.7:1).+ - **Pages not on show are out of the accessibility tree,** so a screen reader does not read Home, Work and About as one page: a hidden page is `inert` (Flash and Portal / Tunnel Zoom use `visibility:hidden` on the page instead), set together with the `active` class or in the code that shows a page. The shown page's name carries `aria-current="page"` and the other names `"false"`, as on Dissolve (`updateNav`).- **Timers:** every timer goes through `later()`, and `settle()` clears them all.### Settings