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: let Image Distortion on Hover settle soon after the run
matin50e58f0f9ac1
diff --git a/animations/06-3d-advanced/image-distortion-hover/README.md b/animations/06-3d-advanced/image-distortion-hover/README.mdindex b17254a4..8d364db7 100644--- a/animations/06-3d-advanced/image-distortion-hover/README.md+++ b/animations/06-3d-advanced/image-distortion-hover/README.md@@ -58,7 +58,7 @@ In the demo the pattern stands still, as a real image would: its time value stay| Effect | Ripple | Ripple sends rings out from the pointer; Push bulges the picture outward; Liquid swirls it; Pixels breaks it into squares || Strength | Medium | How far the picture bends: gentle is 4, medium 8 and strong 14; stronger looks more dramatic but harder to read || Size | Medium | How wide an area bends: small is 15%, medium 25% and large 40% of the picture's height |-| Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about a quarter of its strength at slow, two fifths at normal and half at fast |+| Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, three quarters at normal and nine tenths at fast || Moving ripples | on | With Ripple, the rings keep moving outward while the pointer rests; off, they stand still |## Production notesdiff --git a/animations/06-3d-advanced/image-distortion-hover/index.html b/animations/06-3d-advanced/image-distortion-hover/index.htmlindex 882cec7a..b376904e 100644--- a/animations/06-3d-advanced/image-distortion-hover/index.html+++ b/animations/06-3d-advanced/image-distortion-hover/index.html@@ -96,9 +96,9 @@<div class="hb-setting"><p class="hb-setting-name" id="dec-lbl">Fade-out speed</p><div class="seg" id="dec-seg" role="group" aria-labelledby="dec-lbl">- <button type="button" data-decay="0.3" aria-pressed="false">Slow</button>- <button type="button" data-decay="0.5" class="on" aria-pressed="true">Normal</button>- <button type="button" data-decay="0.8" aria-pressed="false">Fast</button>+ <button type="button" data-decay="0.9" aria-pressed="false">Slow</button>+ <button type="button" data-decay="1.5" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-decay="2.4" aria-pressed="false">Fast</button></div><p class="hb-hint">How fast the picture settles after the pointer leaves.</p></div>@@ -194,7 +194,7 @@ void main(){const stage=document.getElementById('stage'),cvs=document.getElementById('cvs');const RUN_MS=3000;let W=0,H=0,gl,prog,U={},raf=null,lastT=0,startT=0,wasPhone=false,glErr='';-let TYPE=0,STR=8,RAD=0.25,DECAY=0.5,ANIMATE=true;+let TYPE=0,STR=8,RAD=0.25,DECAY=1.5,ANIMATE=true;// The distortion is centred on (mouseX, mouseY), in canvas pixels. It is drawn at full strength while active (the pointer is on// the picture or Show me is running) and fades by DECAY once it is not. demoStart is when the Show me run began, 0 when none is.let mouseX=-999,mouseY=-999,phase=0,amp=0,active=false,demoStart=0;@@ -259,7 +259,7 @@ function render(ts){point(W*(.2+.6*p),H*(.5+.18*Math.sin(2*Math.PI*p)));if(p>=1){demoStart=0;active=false;}}- if(!active){amp*=Math.max(0,1-DECAY*dt/1000);if(amp<.005){amp=0;mouseX=mouseY=-999;}}+ if(!active){amp*=Math.max(0,1-DECAY*dt/1000);if(amp<.01){amp=0;mouseX=mouseY=-999;}}draw();}raf=(active||amp>0||demoStart)?requestAnimationFrame(render):null;diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.mdindex 12194bc5..f3cdcae1 100644--- a/docs/superpowers/plans/2026-09-29-3d-content.md+++ b/docs/superpowers/plans/2026-09-29-3d-content.md@@ -1181,7 +1181,8 @@ None: leave out the `details.hb-options` block.- **The render loop runs only while something moves.** After drawing a frame, `render()` requests the next one only while the pointer is on the picture (`active`), the distortion is still fading (`amp > 0`) or a Show me run is under way (`demoStart` set); otherwise it sets `raf = null` and stops, so a picture at rest is not redrawn 60 times a second. A frame skipped by today's 15ms gate still requests the next one. `wake()` starts the loop again when it has stopped (it sets `lastT` and `startT` to `performance.now()`, so `phase` does not jump, then requests a frame); `track()` and Show me call it.- **The first picture:** `draw()` at load. While the loop is stopped, a resize and every setting call `draw()` once (a resize clears the canvas).- **The picture stands still:** the shader's `uT` stays 0. Today the pattern drifts slowly by itself; a real image would not, and a do-it page moves only when the visitor or Show me moves it.- - `phase` and the fade (`amp`) run as today while the loop runs.+ - `phase` and the fade (`amp`) run as today while the loop runs, with one change: the fade ends, and the loop stops, when `amp` falls below `.01` (today `.005`), about half a second sooner. The last frame then differs from the picture at rest by at most 6 (of 255) in any pixel at the default settings, and by at most 18 at any strength and size with Ripple, Push or Liquid; Pixels changes by about 30 in a few pixels, as it did with `.005`, because its cell size settles to its rest value at any strength.+ - **The fade is quicker than today's.** Today's default (Decay Speed 5, `DECAY` 0.5) took about 10.5 seconds to stop after the pointer let go, so a Show me run (3 seconds) was not back at rest until about 13.5 seconds after the press, against the "2.5 to 3 seconds ... returns the demo to rest" above, and the browser check (which looks for a still stage about 4.5 seconds after the arrival run) failed. Fade-out speed is now Slow · Normal · Fast = `DECAY` 0.9 / 1.5 / 2.4, and the default is 1.5. The fade law (`amp *= 1 - DECAY*dt/1000`) is unchanged. The loop now stops about 5, 3 and 2 seconds after the pointer lets go, so at Normal the picture is at rest about 6 seconds after Show me is pressed, and at Medium strength the last half second of the fade is under a pixel of movement.- **Reduced motion:** the page's reduced-motion branch goes. With the picture still, nothing on the stage moves until the visitor or Show me does.- **Stage font:** no text on the stage; `.fallback` uses the site font.- **Stage:** only the canvas. The fps badge and the shader source panel go. `touch-action:none` on the canvas stays. `hb-dots`: no. Default height.@@ -1200,7 +1201,7 @@ None: leave out the `details.hb-options` block.| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo ||---|---|---|---|---|---|-| Fade-out speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the picture settles after the pointer leaves. | `DECAY`: 0.3 / 0.5 / 0.8 |+| Fade-out speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the picture settles after the pointer leaves. | `DECAY`: 0.9 / 1.5 / 2.4 || Moving ripples | Switch; shown only when Effect is Ripple | on / off | on | The rings keep moving outward. | `ANIMATE` true / false |- **Removed:**@@ -1228,7 +1229,7 @@ None: leave out the `details.hb-options` block.| Effect | Ripple | Ripple sends rings out from the pointer; Push bulges the picture outward; Liquid swirls it; Pixels breaks it into squares || Strength | Medium | How far the picture bends: gentle is 4, medium 8 and strong 14; stronger looks more dramatic but harder to read || Size | Medium | How wide an area bends: small is 15%, medium 25% and large 40% of the picture's height |- | Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about a quarter of its strength at slow, two fifths at normal and half at fast |+ | Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, three quarters at normal and nine tenths at fast || Moving ripples | on | With Ripple, the rings keep moving outward while the pointer rests; off, they stand still |- **README See also:**