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: show the whole Morphing Blob on wide stages
matin8dc522ee5354
diff --git a/animations/06-3d-advanced/morphing-blob/README.md b/animations/06-3d-advanced/morphing-blob/README.mdindex 02ab23f6..19971fd9 100644--- a/animations/06-3d-advanced/morphing-blob/README.md+++ b/animations/06-3d-advanced/morphing-blob/README.md@@ -54,6 +54,14 @@ forgets the time of the last frame, so the first frame after it adds nothing.Slow motion adds a third of the phase and lets the droplet close 0.03 of the gapinstead of 0.09.+The pointer's position is turned into the drawing's own units with the SVG's screen+matrix (`svg.getScreenCTM().inverse()`), so the droplet stays under the pointer+however the SVG is scaled and centred, also beside the drawing on a wide stage. The+`viewBox` is a 340-unit box around the blob's middle (`30 30 340 340`) with+`preserveAspectRatio="xMidYMid meet"`: the circles wander up to about 190 units from+the middle, so the box shows them almost always, and the whole box fits whatever the+shape of the stage.+## Key parameters| Parameter | Default | Effect ||-----------|---------|--------|diff --git a/animations/06-3d-advanced/morphing-blob/index.html b/animations/06-3d-advanced/morphing-blob/index.htmlindex c390aceb..3383e7a9 100644--- a/animations/06-3d-advanced/morphing-blob/index.html+++ b/animations/06-3d-advanced/morphing-blob/index.html@@ -47,7 +47,9 @@<div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself, and one drop follows your pointer or finger. Pause it to look closely, or turn on slow motion.</p></div></div><div class="stage" id="stage">- <svg id="svg" viewBox="0 0 400 400" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Soft purple and blue circles drifting and melting into one liquid shape, with one drop that follows the pointer">+ <!-- The circles wander up to about 190 units from the middle (200, 200); this 340-unit box holds them nearly always,+ and "meet" fits the whole box into any stage, so the blob is never cut. Beside the box the stage is still drawn. -->+ <svg id="svg" viewBox="30 30 340 340" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Soft purple and blue circles drifting and melting into one liquid shape, with one drop that follows the pointer"><defs><!-- The "goo": blur spreads the circles, then the alpha channel ispushed through a steep contrast curve so soft edges snap back to a@@ -223,15 +225,15 @@ document.addEventListener('hb:pause',e=>{else start();});-// Pointer Events cover mouse, pen and touch with one code path. While paused the position is only recorded:-// nothing moves until Play, and then the drop catches up.+// Pointer Events cover mouse, pen and touch with one code path. The SVG's own screen matrix turns the pointer into drawing+// units, so the drop stays under the pointer wherever the SVG is scaled and centred, also beside the box on a wide stage.+// While paused the position is only recorded: nothing moves until Play, and then the drop catches up.function toViewBox(e){- const r=svg.getBoundingClientRect();- // slice-scaled square viewBox: map to the larger dimension, centre the shorter- const side=Math.max(r.width,r.height);- const ox=(r.width-side)/2, oy=(r.height-side)/2;- pointer.x=((e.clientX-r.left-ox)/side)*400;- pointer.y=((e.clientY-r.top-oy)/side)*400;+ const m=svg.getScreenCTM();+ if(!m)return;+ const p=new DOMPoint(e.clientX,e.clientY).matrixTransform(m.inverse());+ pointer.x=p.x;+ pointer.y=p.y;}stage.addEventListener('pointermove',toViewBox);stage.addEventListener('pointerdown',toViewBox);diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.mdindex 413cc97b..a7721bcd 100644--- a/docs/superpowers/plans/2026-09-29-3d-content.md+++ b/docs/superpowers/plans/2026-09-29-3d-content.md@@ -1411,9 +1411,9 @@ None: leave out the `details.hb-options` block.- **Slow motion:** while the switch is on, `phase` adds a third (`dt*speed/3`) and the drop closes 0.03 of the gap each frame in place of 0.09, from the next frame.- **Reduced motion:** `reduce` goes, with `speed=0` and `paintStatic()`; the `.tip` rule goes with the tip (see the preamble).- **Stage font:** no text on the stage.-- **Stage:** the SVG only; the "Move your pointer" tip goes. The stage keeps its radial gradient, `touch-action:none` and `cursor:crosshair`. `:root` gets `--ui-accent:#3fd6c4`; `--accent` and `--accent2` go with the panel, and `--stage` stays (the gradient uses it). `hb-dots`: no (it would replace the gradient). Default height.+- **Stage:** the SVG only; the "Move your pointer" tip goes. The stage keeps its radial gradient, `touch-action:none` and `cursor:crosshair`. `:root` gets `--ui-accent:#3fd6c4`; `--accent` and `--accent2` go with the panel, and `--stage` stays (the gradient uses it). `hb-dots`: no (it would replace the gradient). Default height. **The whole blob shows on every stage:** the SVG keeps its drawing coordinates (every formula, and the drop starting at (200, 200)) but becomes `viewBox="30 30 340 340"` with `preserveAspectRatio="xMidYMid meet"`, in place of the full 400 square sliced to fill the stage. Sliced, a stage as wide as the laptop ones showed only a horizontal band of the blob: measured on the page, 57% of each circle's box at 1280×590 (a 958×258 stage), 70% at 1366×657, 77% at 1280×800 and 72% on a sideways phone, and 57% to 71% in the paused first pictures. Now the box is as tall as the stage on a wide stage, and the stage beside it is drawn too. The circles reach at most about 194 units from the middle (about 160 at the extremes of a typical build, and 176 or less in nine builds of ten), so the 340-unit box keeps 99.9% or more of every circle in view on average with 4, 6 and 9 circles and cuts one, briefly and slightly, in about 1 to 3% of moments (the 300-unit box first tried cut one in 16% to 26% of moments). The drop is 52 to 88px wide on the shared stages, and on the phone stage the picture is almost as before (drawing scale 0.876, was 0.8575).- **Phone fallback:** none needed. Measured on the throttled phone: 0.5 to 0.8ms a frame and a full 60 frames a second with the filter, at 4, 6 and 9 blobs.-- **Touch:** as today: `pointerdown` and `pointermove` set the drop's target, and the stage's `touch-action:none` lets a finger drag it.+- **Touch:** as today: `pointerdown` and `pointermove` set the drop's target, and the stage's `touch-action:none` lets a finger drag it. The position is turned into drawing units through the SVG itself, `new DOMPoint(e.clientX, e.clientY).matrixTransform(svg.getScreenCTM().inverse())`, so the drop stays under the pointer or finger anywhere on the stage, also beside the box on a wide stage.**Main settings**