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: fix the Shared Element Back focus and small notes in the Page Transitions sheet
matin7df2b2519ad6
diff --git a/docs/superpowers/plans/2026-09-29-transitions-content.md b/docs/superpowers/plans/2026-09-29-transitions-content.mdindex 3fcff3cc..1fd6a5f6 100644--- a/docs/superpowers/plans/2026-09-29-transitions-content.md+++ b/docs/superpowers/plans/2026-09-29-transitions-content.md@@ -96,7 +96,7 @@ Eight demos put an element in its starting state with `transition:none` and star- **Stage:**- The mini nav and the page area stay. `.page-area` keeps `view-transition-name:page-content`, and every `::view-transition-*` rule and keyframe stays.- **Special case:** the browser draws the old and new pictures above the whole page, in the top layer. The stage's `overflow:hidden` therefore cannot clip them. The demo's own `::view-transition-group(page-content){overflow:clip}` keeps the slide and zoom inside the page area's box, and `::view-transition-old(root),::view-transition-new(root){animation:none}` keeps the rest of the page still. That group rule also gets `border-radius:0 0 11px 11px`, so the page area keeps the stage's rounded bottom corners mid-transition (the stage's 12px radius inside its 1px border).- - **The site's top bar stays drawn above the transition** (owner decision). The page area's pictures are drawn above everything, so a stage scrolled partly under the sticky top bar would cover the bar for the length of a transition. The page's own `<style>` names the bar and keeps its pictures still: `.hb-bar{view-transition-name:hb-bar}`, `::view-transition-group(hb-bar),::view-transition-old(hb-bar),::view-transition-new(hb-bar){animation:none}` and `::view-transition-old(hb-bar){opacity:0}`. The old picture is hidden because the browser adds the old and new pictures of a name together while both show, which would brighten the bar. The bar paints above the page area (z-index 50), so its group is drawn above the page area's. `page-content` and `hb-bar` are the only two names; the shared page adds none.+ - **The site's top bar stays drawn above the transition** (owner decision). The page area's pictures are drawn above everything, so a stage scrolled partly under the sticky top bar would cover the bar for the length of a transition. The page's own `<style>` names the bar and keeps its pictures still: `.hb-bar{view-transition-name:hb-bar}`, `::view-transition-group(hb-bar),::view-transition-old(hb-bar),::view-transition-new(hb-bar){animation:none}` and `::view-transition-old(hb-bar){opacity:0}`. The old picture is hidden so the bar stays exactly as it looks at rest: with `animation:none` both pictures show at full strength, one over the other, and the bar's slightly see-through background would turn more solid for the length of a transition. The bar paints above the page area (z-index 50), so its group is drawn above the page area's. `page-content` and `hb-bar` are the only two names; the shared page adds none.- The support banner goes (it was in the aside); the fallback stays in the code, and Production notes describe it.- `.pstat b` stays `#58a6ff`.- Unused variables: none.@@ -145,7 +145,7 @@ Eight demos put an element in its starting state with `transition:none` and star- [Zoom Transition](../zoom-transition/) — three ways to zoom between pages- [Shared Element Transition](../shared-element-transition/) — one picture grows into the next page- **README How it works:** unchanged-- **README Production notes:** the support banner is gone, so the first bullet says what browsers without the API see: "the demo does exactly this so unsupported browsers still transition." becomes "the demo does exactly this, so browsers without the API still get a simple 300ms fade (900ms in slow motion), whatever the Transition style and Speed." The rest is unchanged.+- **README Production notes:** the support banner is gone, so the first bullet says what browsers without the API see: "the demo does exactly this so unsupported browsers still transition." becomes "the demo does exactly this, so browsers without the API still get a simple 300ms fade, whatever the Transition style and Speed." The rest is unchanged.- **Category line:** `03.01 · Page Transitions`- **Pager:** Previous: none · Next: Shared Element Transition (`../shared-element-transition/`)@@ -169,13 +169,13 @@ Eight demos put an element in its starting state with `transition:none` and star- **Stage font:** site font.- **Stage:**- The mini nav (Back and the title) and the page area (grid, detail view and the moving copy `#flip-el`) stay.- - **Special case:** the copy is `position:fixed` and moves in viewport coordinates, so the stage's `overflow:hidden` does not clip it. The conversion must not give the stage or any of its ancestors a `transform`, `filter`, `backdrop-filter`, `perspective`, `contain`, `container-type` or `will-change`: any of them would become the copy's containing block and shift or clip it. The copy keeps its own `will-change:transform`.+ - **Special case:** the copy is `position:fixed` and moves in viewport coordinates, so the stage's `overflow:hidden` does not clip it. The conversion must not give the stage or any of its ancestors a `transform`, `filter`, `backdrop-filter`, `perspective`, a `will-change` naming one of these, or `contain` with `layout` or `paint`: any of them would become the copy's containing block and shift or clip it. `container-type` and `contain:size` or `style` do not make one in Chrome; leave them off too, simply because the stage needs no containment. The copy keeps its own `will-change:transform`.- `#flip-el`'s `z-index:100` becomes `40`: above the stage's content, below the site's sticky top bar (50), so a stage scrolled partly under the bar does not draw the copy over it (owner decision).- `.nav-back` becomes 13px text, `min-height:44px` at every size, in `var(--ui-muted)`. `.nav-title` becomes 13px. The unused `.nav-label` rule goes.- **The projects become buttons, so a keyboard can open them.** Today each thumbnail is a `div` with a click listener, which a keyboard cannot reach on a "Click it" page.- Each becomes `<button type="button" class="thumb">`. `.thumb` adds `border:0;font:inherit;color:inherit;text-align:left;cursor:pointer`.- Its two lines become `<span class="thumb-label">` and `<span class="thumb-sub">` with `display:block`, because a button may only hold inline content.- - Hidden controls leave the Tab order. While the detail view is open, the grid gets `inert` (removed when the grid shows again). `.nav-back` adds `visibility:hidden`, with `.nav-back.show{visibility:visible}` and `transition:opacity .2s,visibility .2s`, so the hidden Back button is not an invisible Tab stop in the grid view.+ - Hidden controls leave the Tab order. While the detail view is open, the grid gets `inert` (removed when the grid shows again). `.nav-back` adds `visibility:hidden` and `transition:opacity .2s,visibility 0s .2s`: when hidden it fades out, then leaves the Tab order, so it is not an invisible Tab stop in the grid view. `.nav-back.show` gets `visibility:visible;transition:opacity .2s`, so Back is visible, and can take focus, the moment `show` is added. A visibility transition on showing would keep Back hidden for about two frames, and `focus()` in the same step would silently fail. Under reduced motion that same step is the only chance (checked in Chrome).- Focus follows the view. When the visitor opens a project, by click or by key, focus moves to Back once it shows (`focus({preventScroll:true})`). Back returns focus to that project's button once the grid shows. A mouse click gets no focus ring, because the browser shows the ring only after keyboard use. Show me and Reset move no focus.- `.thumb-sub` goes from `opacity:.5` to `.8`: 3.0:1 becomes 5.1:1 on the thumbnails.- Two thumbnail title colours change so the 11px titles read on their thumbnails, and the detail view's title uses the same colours: Atlas `#79c0ff` becomes `#a5d6ff` (4.49:1 becomes 5.7:1), and Prism `#56d364` becomes `#7ee787` (4.1:1 becomes 5.1:1).@@ -719,7 +719,7 @@ None: leave out the `details.hb-options` block.- **Player bar:** Show me · Reset · Slow motion (page)- **Show me:**- The run goes from Home to Work and holds 1200ms after the transition ends (the `dur+50` timer on the planned path, or the moment the live spring settles), then goes back to Home.- - This takes about 3.1s either way: the planned path's transition lasts 950ms, and at Normal and Medium the live spring settles in about 0.8s after its 100ms start delay.+ - This takes about 3.1s either way: the planned path's bounce lasts 900ms at Normal (its end timer waits 950ms), and at Normal and Medium the live spring settles in about 0.8s after its 100ms start delay.- `hb:input` cancels the way back.- The spring's frame id `rafId` and its 100ms start timer, now kept at page level and started through `later()`, let `settle()` stop a spring under way.- **Reset:** yes. Home at once.@@ -747,7 +747,7 @@ None: leave out the `details.hb-options` block.None: leave out the `details.hb-options` block.-Live-spring damping, measured with the demo's own spring loop. The loop takes one step per frame at 60 frames a second: the first frame has no time step, and the loop stops when position and speed are both under 0.5. A loop that steps once per frame damps much more than the textbook formula predicts, so each value was found by running it. For each speed and size, the whole number shown gives the overshoot nearest the planned path's for the same size (3.6%, 7.2% and 12% of the width); the overshoot it gives is in brackets. The spring settles within 1.3s. Normal and Medium become 180 and 16 (owner decision): today's 20 goes only 1.1% past its place, which barely shows. At 120 frames a second, or in slow motion, the steps are smaller and every bounce is a little larger (up to 6.7%, 10.7% and 13.9%); the three sizes stay apart. Every value lies inside the old sliders' ranges (stiffness 50–500, damping 5–50).+Live-spring damping, measured with the demo's own spring loop. The loop takes one step per frame at 60 frames a second: the first frame has no time step, and the loop stops when position and speed are both under 0.5. A loop that steps once per frame damps much more than the textbook formula predicts, so each value was found by running it. For each speed and size, the whole number shown gives the overshoot nearest the planned path's for the same size (3.6%, 7.2% and 12% of the width); the overshoot it gives is in brackets. The spring settles within 1.3s. Normal and Medium become 180 and 16 (owner decision): today's 20 goes only 1.1% past its place, which barely shows. At 120 frames a second, or in slow motion, the steps are smaller and every bounce is a little larger (up to 6.7%, 10.7% and 13.9%); the three sizes stay apart. At 30 frames a second the steps are larger and Small barely bounces (1.4%, 1.2% and 0%); the README's Production notes say so. Every value lies inside the old sliders' ranges (stiffness 50–500, damping 5–50).| Bounce size | Slow (70) | Normal (180) | Fast (500) ||---|---|---|---|@@ -787,8 +787,8 @@ Live-spring damping, measured with the demo's own spring loop. The loop takes on- **README How it works:**- The first paragraph names the two ways as on the page: "This demo offers two modes. The CSS mode writes" becomes "This demo offers two ways to bounce. The planned path writes"; "with the overshoot amount scaled by a control" becomes "with the overshoot amount set by Bounce size"; and "The JS mode integrates" becomes "The live spring integrates".- In the snippet, `let pos = -100, vel = 0, target = 0; // start off-screen right` becomes `let pos = 100, vel = 0, target = 0; // start off-screen right`, as in the demo.- - In the last paragraph, the sentence "Recorded positions are plotted to a small canvas so the overshoot-and-settle curve is visible." is replaced by: "On the demo page, Speed and Bounce size set both ways of bouncing: the planned path's length (1400, 900 or 550ms) and overshoot (30, 60 or 100), or the live spring's stiffness (70, 180 or 500) and damping. The damping values were found by running this loop at 60 frames a second, so the spring goes about as far past its place as the planned path does (about 3.6%, 7.2% and 12% of the width). A loop that steps once per frame damps more than the textbook spring formula predicts, so the values were measured rather than calculated."-- **README Production notes:** unchanged+ - In the last paragraph, the sentence "Recorded positions are plotted to a small canvas so the overshoot-and-settle curve is visible." is replaced by: "On the demo page, Speed and Bounce size set both ways of bouncing: the planned path's length (1400, 900 or 550ms) and overshoot (30, 60 or 100), or the live spring's stiffness (70, 180 or 500) and damping. The damping values were found by running this loop at 60 frames a second, so the spring goes about as far past its place as the planned path does (about 3.6%, 7.2% and 12% of the width). Moving the spring one step per frame calms it more than the usual spring formula expects, so the values were measured rather than worked out."+- **README Production notes:** a bullet goes in after "**Clamp the time step.**": "**Frame rate.** The demo moves its spring one step per frame, so how far it bounces depends on the frame rate: at 30 frames a second the small bounce hardly shows, and at 120 it is a little larger. A spring that steps by time instead — fixed small steps, as many as the time that has passed needs — bounces the same at any frame rate." The rest is unchanged.- **Category line:** `03.09 · Page Transitions`- **Pager:** Previous: Blur Transition (`../blur-transition/`) · Next: Portal / Tunnel Zoom (`../portal-zoom/`)@@ -976,14 +976,18 @@ Live-spring damping, measured with the demo's own spring loop. The loop takes on- Toolbar labels become plain words: "Shuffle", "Sort by color", "Sort by size", "3 columns", "2 columns", "List" (were "⟳ Shuffle", "3 cols", "2 cols"). The six fit on one line on computers and tablets and on two lines on 375px and 320px phones (measured).- `.card-meta` goes from `opacity:.5` to `.8`: 3.0:1 becomes 5.1:1 on the cards. `.card-num`, the large faint number, is decoration and stays.- **The cards get shorter** so the default layout fits the laptop's first screen: in `renderCards()`, 110px for tall cards and 86px for short ones (were 140px and 110px); list rows stay 56px.- - `#card-grid` gets `min-height:230px`, the height of the three-column grid, so a new order in three columns never changes the stage height.+ - `#card-grid` gets `min-height:230px`, the height of the three-column grid, so a new order in three columns never changes the stage height. It also gets `align-content:start`. Without it the grid spreads any extra height over its rows. In a scratch grid in headless Chrome, a 440px min-height moved the second row from 120px down to 225px. Then Sort by size would space the rows apart, and the hold below would glide the cards to stretched rows and make them jump when it is released.- **`hb-grow` on the stage**, which replaces the old phone rule `.stage{height:auto;min-height:var(--stage-h)}`. 2 columns (350px of cards) and List (386px) are taller than any shared stage, so the stage grows while they are shown; the default three columns need 329px on a laptop. At 1366×657 that puts the player bar's bottom at about 651px, inside the 657px screen (measured with the shared stage).- **The grid keeps its height until a glide ends.** Otherwise a layout that gets shorter shrinks the stage at once (by 120px measured), and `.page-area{overflow:hidden}` clips the cards that start from the old lower rows:- - 2 columns to 3: cards 5 and 6 start 80–110px below the edge;+ - 2 columns to 3: cards 5 and 6 start with 80 of their 86px and 104 of their 110px below the edge;- List to 3 columns: two cards start fully hidden;- - List to 2 columns: one card starts 20px hidden.+ - List to 2 columns: the last card starts 74px hidden, because each card is drawn at its new size (here 110px) from its old list row.++ The hold is set in two steps:+ - In `doFlip()`, before `renderCards()`, set `grid.style.minHeight` to the grid's current height (`grid.offsetHeight + 'px'`), so the page never gets shorter mid-change.+ - After the Last measurements, raise it to the lowest point any card starts its glide from, if that is lower: the card's old top (from First, measured from the grid's top) plus its new height. List to 3 or 2 columns needs 440px, 54px more than the list; with the current height alone the last card would lose 38px for a few frames.- In `doFlip()`, before `renderCards()`, set `grid.style.minHeight` to the grid's current height (`grid.offsetHeight + 'px'`). Clear it (`grid.style.minHeight=''`, back to the stylesheet's 230px) in the `dur+50` timer, in `settle()`, in Reset, and straight after `renderCards()` in the reduced-motion branch, where the cards jump at once. A layout that gets taller grows the stage at once, as before, so nothing is clipped; a shorter one keeps the stage's height until the cards have landed, then the stage shrinks.+ With `align-content:start`, neither step moves a card. Clear the hold (`grid.style.minHeight=''`, back to the stylesheet's 230px) in the `dur+50` timer, in `settle()`, in Reset, and straight after `renderCards()` in the reduced-motion branch, where the cards jump at once. A layout that gets taller grows the stage at once, as before. A shorter one keeps the stage's height, or grows it for the glide, until the cards have landed, then the stage shrinks. Nothing is clipped at any point.- Unused variables: none.**Main settings**