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
fix: reset Scroll Image Sequence at once after a jump
matin4d465b420866
diff --git a/animations/01-scroll-based/scroll-image-sequence/README.md b/animations/01-scroll-based/scroll-image-sequence/README.mdindex 9b4122c1..c22b7fa1 100644--- a/animations/01-scroll-based/scroll-image-sequence/README.md+++ b/animations/01-scroll-based/scroll-image-sequence/README.md@@ -10,7 +10,7 @@ A scroll image sequence plays a series of still pictures as you scroll, like fli- Any "cinematic" scroll moment where you want frame-accurate control instead of CSS transitions## How it works-A tall track element provides the scroll budget; a child pins itself with `position: sticky`. On every scroll event you convert the track's position into a `0 → 1` progress value, multiply by the frame count, and draw that frame. This demo has no image assets, so each frame is generated procedurally — but the scrubbing logic is identical to the production version.+A tall track element provides the scroll budget; a child pins itself with `position: sticky`. On every scroll event you convert the track's position into a `0 → 1` progress value and multiply it by the frame count; a frame loop draws that frame. This demo has no image assets, so each frame is generated procedurally — but the scrubbing logic is identical to the production version.```jsfunction updateTarget(){@@ -30,7 +30,7 @@ const index = Math.round(shownFrame);if (index !== drawn) { drawFrame(index); drawn = index; } // skip a picture that is already on the canvas```-`drawFrame(index)` is a pure function of the index — same index, same picture — which is exactly why reverse scrubbing rewinds cleanly. It is also why the loop can skip a picture that is already on the canvas, which keeps the page cheap on phones.+`drawFrame(index)` is a pure function of the index — same index, same picture — which is exactly why reverse scrubbing rewinds cleanly. It is also why the loop can skip a picture that is already on the canvas, which keeps the page cheap on phones. Back to top, and Play starting again from the top, move the box in one jump; a click on either button sets the shown frame to the target at once, so the picture does not play backwards.## Key parameters| Parameter | Default | Effect |diff --git a/animations/01-scroll-based/scroll-image-sequence/index.html b/animations/01-scroll-based/scroll-image-sequence/index.htmlindex e2c9e41c..6bc23643 100644--- a/animations/01-scroll-based/scroll-image-sequence/index.html+++ b/animations/01-scroll-based/scroll-image-sequence/index.html@@ -212,6 +212,8 @@ choices('frames-seg',d=>{updateTarget();});stage.addEventListener('scroll',updateTarget,{passive:true}); // scroll fires for wheel AND touch+// Back to top, and Play starting again from the top, jump the box: the picture jumps with it instead of playing backwards+document.addEventListener('click',e=>{if(e.target.closest('#btn-top,#btn-scroll')){updateTarget();shownFrame=targetFrame}});addEventListener('resize',()=>{resize();updateTarget();});reduceMQ.addEventListener('change',e=>{reduce=e.matches});document.addEventListener('visibilitychange',()=>{drawn=-1}); // a browser may drop a hidden canvas's pixelsdiff --git a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md b/docs/superpowers/plans/2026-09-29-scroll-content-part2.mdindex 5d125c41..08da71df 100644--- a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md+++ b/docs/superpowers/plans/2026-09-29-scroll-content-part2.md@@ -587,7 +587,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:** a wireframe cube with a smaller shape inside it, drawn on a canvas that holds still while the box scrolls. Each scroll position shows one frame of a sequence: scrolling down turns the cube one and a half times while it opens out and closes again, and scrolling up plays it backwards. With few frames the steps between pictures are easy to see.-- **Scroll distance and Play:** the track is 340cqh with its sticky frame 100cqh tall: 2.4 box heights of scrolling, the same proportion as today's 340vh track in a 100vh window. Play plays the whole sequence (120 frames at the default) in six seconds. Back to top, and Play restarting from the top, are instant jumps (rule B8): with Glides between frames on, the picture then eases from the frame it showed back to the first one, as it does after any fast scroll; with it off, the picture jumps too.+- **Scroll distance and Play:** the track is 340cqh with its sticky frame 100cqh tall: 2.4 box heights of scrolling, the same proportion as today's 340vh track in a 100vh window. Play plays the whole sequence (120 frames at the default) in six seconds. Back to top, and Play restarting from the top, are instant jumps (rule B8), and the picture jumps with them, with or without Glides between frames (a click on either button sets the shown frame at once).- **Reduced motion:** nothing scrolls by itself. As today, the picture jumps straight to the frame for each position, with no easing (`smoothing` is false under reduced motion).- **Stage font:** no text stays on the stage.- **Stage (rebuilt):**@@ -658,6 +658,7 @@ None: leave out the `details.hb-options` block.- **README Production notes:** unchanged- **Category line:** `01.20 · Scroll-Based`- **Pager:** Previous: Zoom Into Image (`../zoom-into-image/`) · Next: Smooth (Inertia) Scroll (`../smooth-scroll/`)+- **Final fix wave (Scroll-Based final review, 2026-09-30).** A `click` listener on the document, for `#btn-top` and `#btn-scroll` (by id, as Velocity Skew and SVG Line Draw do), runs `updateTarget(); shownFrame=targetFrame`, so the picture stands at the frame for the box's new position in the same click instead of playing backwards through the exploded frames. The shared script has already moved the box when the click reaches the document. README How it works: "…multiply by the frame count, and draw that frame" becomes "…and multiply it by the frame count; a frame loop draws that frame" (the scroll handler only sets the target frame; the loop draws), and a sentence says a click on either button sets the shown frame to the target at once.---