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: bring the 3D Model Orbit and Canvas Particle Effect sheet sections in line with the fixes
matinb82916c6f7d1
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.mdindex 02476a21..18a5025d 100644--- a/docs/superpowers/plans/2026-09-29-3d-content.md+++ b/docs/superpowers/plans/2026-09-29-3d-content.md@@ -139,12 +139,12 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a- **Watch it help line:** default- **Player bar:** Pause (page) · Slow motion (page)- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame:- - with Movement on Spins, `ry += SY*.01` and `rx += SX*.01*(Math.sin(ts*.0003)*.5+.5)`, as today (the forward roll speeds up and slows down over about 21 seconds);+ - with Movement on Spins, `ry += SY*.01*k` and `rx += SX*.01*k*(Math.sin(clock*.0003)*.5+.5)`, where `k` is 1, or a third while Slow motion is on, and `clock` is the page's own clock (in place of today's `ts`, see the preamble), which adds `Math.min(dt,50)*k` for each drawn frame; the forward roll speeds up and slows down over about 21 seconds;- with Follows the pointer, `rx = mouseNY*1.2` and `ry = mouseNX*1.5`;- then `draw()`.**The first picture:** `draw()` runs once at load, after `init()` and `resize()`. **While paused,** every setting and a resize call `draw()` (today's `if(gl&&!raf)draw()` calls, which are now true only while paused).-- **Slow motion:** while the switch is on, both spin steps are divided by 3, from the next frame. Following the pointer is not slowed.+- **Slow motion:** while the switch is on, both spin steps are divided by 3 and the page's clock adds a third of each frame's time, so the roll's speed wave takes three times as long too, from the next frame. Following the pointer is not slowed.- **Reduced motion:** `motionOk` goes, with its one-frame branch at load and the "still follows the pointer" line in the `pointermove` handler (see the preamble).- **Stage font:** no text on the stage; the WebGL message uses the site font.- **Stage:** only the canvas. The fps and shape badges (`.hud`) go. `hb-dots`: no (the canvas clears to its own dark blue). Default height. `touch-action:pan-y` stays.@@ -155,7 +155,7 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo ||---|---|---|---|---|---|-| Shape | Choice buttons | Cube · Sphere · Ring · Pyramid | Cube | The object that is drawn and lit. | `loadGeometry('cube' / 'sphere' / 'torus' / 'tetra')`, then `rx=ry=0` (today's menu handler) |+| Shape | Choice buttons | Cube · Sphere · Ring · Pyramid | Cube | The object that is drawn and lit. | `loadGeometry('cube' / 'sphere' / 'torus' / 'tetra')`, then `rx = .3` (the tilt it starts with) and `ry = 0`, so a ring opens up instead of showing edge-on and the shapes turn visibly (a plain sphere looks much the same from every side); today's menu handler set both to 0 || Movement | Choice buttons | Spins · Follows the pointer | Spins | Or it turns to face your pointer or finger. | `MODE`: `'orbit'` / `'mouse'`; also shows Speed and Tumbles as it spins only with Spins || Speed | Choice buttons; shown only when Movement is Spins | Slow · Normal · Fast | Normal | How fast it spins. | `SY`: 0.5 / 0.8 / 1.3 and `SX`: 0.12 / 0.2 / 0.32 (`SX` stays 0 while Tumbles as it spins is off) |@@ -202,7 +202,7 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a- [Scroll-Driven 3D Rotation](../scroll-driven-3d-rotation/) — scrolling turns the object instead of time- [Parallax 3D Tilt](../parallax-3d-tilt/) — a flat card leans in 3D toward the pointer- [WebGL Shader Animation](../webgl-shader-animation/) — the same WebGL setup, painting a pattern instead of a shape-- **README How it works:** unchanged+- **README How it works:** unchanged, except the fragment shader's view vector line, which becomes `vec3 V = normalize(-vP);` as on the page (`vP` is already in camera space, so the camera is at the origin)- **README Production notes:** unchanged- **Category line:** `06.01 · 3D & Advanced`- **Pager:** Previous: none · Next: Scroll-Driven 3D Rotation (`../scroll-driven-3d-rotation/`)@@ -358,13 +358,13 @@ None: leave out the `details.hb-options` block.- **Player bar:** Pause (page) · Slow motion (page)- **Sequence:** the canvas loop as in the preamble (`loop(t)`, 16ms gate). Each drawn frame runs `update()` on every particle (the pointer's push or pull within 120px, the speed cap, the move, the bounce), then `draw()`.- **The links in six batches:** `draw()` puts every link into one of six paths by its opacity step and strokes each path once, in place of one `stroke()` per link. For a pair closer than Link distance, `k = Math.min(5, Math.floor((1 - d2/d2max) * 6))` picks the path, and path k is stroked at opacity `(k + 0.5) / 6 * 0.4` (today's opacity, `(1 - d2/d2max) * 0.4`, in six steps). `ctx.lineWidth=.5` stays, set once before the six strokes. The dots are drawn as today.- - **The first picture:** `draw()` runs at load, after `spawn()`. **While paused,** every setting and a resize call `draw()` (today's `if(paused)draw()` calls).+ - **The first picture:** `draw()` runs at load, after `spawn()`. **While paused,** every setting and a resize call `redraw()`, which clears the canvas and then calls `draw()` (today's `if(paused)draw()` calls). With Trails on, `draw()` only lays a 15% wash over what is already there, so without the clearing a new Link distance, number of dots or color would show on top of the old picture.- **The resize handler** returns at once when the stage's size has not changed (`if(stage.clientWidth===W&&stage.clientHeight===H)return;`, as on Cloth / Soft-Body Simulation), so a phone's address bar showing or hiding does not scatter the dots again.- **Slow motion:** while the switch is on, `update()` moves each particle by a third of its velocity (`this.x += this.vx/3`, and the same for y), and the pointer's push or pull adds a third of today's amount, from the next frame. The speed cap stays.- **Reduced motion:** the page's reduced-motion branch (paused at load with one frame drawn) goes (see the preamble).- **Stage font:** no text on the stage.- **Stage:** only the canvas. The fps badge goes. `hb-dots`: no (its dots would mix with the particles). Default height.-- **Phone fallback:** the number of dots depends on the screen's width, checked at each `spawn()` (today's `innerWidth<=600` test only lowered the default to 250): up to 600px (phones) 30 · 45 · 60; up to 1024px (tablets) 60 · 90 · 120; wider 250 · 500 · 800. Measured with the batched links on the throttled phone (see the preamble): 40 or 60 dots draw close to a full 60 frames a second with Medium links (159 to 181 frames in 3 s), at 1.7–2.4ms of script a frame, where today's 250 took 140ms; from 80 dots on, the browser's drawing falls to about 28 frames a second, which is why Many stops at 60 on phones. Long links cost more (60 dots: 114–131 frames in 3 s). On a tablet stage, 60, 90 and 120 dots drew 180, 122 and 111 frames in 3 s, at 2–3ms of script a frame.+- **Phone fallback:** the number of dots depends on the size of the screen, checked at each `spawn()` (today's `innerWidth<=600` test only lowered the default to 250): up to 600px wide, or up to 500px tall (a phone held sideways), 30 · 45 · 60; otherwise up to 1024px wide (tablets) 60 · 90 · 120; wider 250 · 500 · 800. Measured with the batched links on the throttled phone (see the preamble): 40 or 60 dots draw close to a full 60 frames a second with Medium links (159 to 181 frames in 3 s), at 1.7–2.4ms of script a frame, where today's 250 took 140ms; from 80 dots on, the browser's drawing falls to about 28 frames a second, which is why Many stops at 60 on phones. Long links cost more (60 dots: 114–131 frames in 3 s). On a tablet stage, 60, 90 and 120 dots drew 180, 122 and 111 frames in 3 s, at 2–3ms of script a frame. On a phone held sideways (812×375, wider than 600px) the tablet counts drew the default 90 dots in about 87 to 128 frames in 3 s, and the phone counts draw 179 to 182 frames for all three choices, at 1.2–2ms of script a frame.- **Touch:** `touchstart` also sets the pointer's position (today only `touchmove` does), so a finger resting on the stage pushes the dots too. `touchend` and `touchcancel` still clear it.**Main settings**@@ -372,7 +372,7 @@ None: leave out the `details.hb-options` block.| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo ||---|---|---|---|---|---|| Pointer effect | Choice buttons | Push · Pull · None | Push | What your pointer or finger does to nearby dots. | `FORCE`: −0.5 / 0.5 / 0 |-| Number of particles | Choice buttons | Few · Medium · Many | Medium | More dots make more links; phones and tablets draw fewer. | `COUNT`: 250 / 500 / 800 on screens wider than 1024px, 60 / 90 / 120 up to 1024px, 30 / 45 / 60 up to 600px (the width is checked at each `spawn()`), then `spawn()` |+| Number of particles | Choice buttons | Few · Medium · Many | Medium | More dots make more links; phones and tablets draw fewer. | `COUNT`: 250 / 500 / 800 on screens wider than 1024px, 60 / 90 / 120 up to 1024px, 30 / 45 / 60 up to 600px wide or up to 500px tall (the size is checked at each `spawn()`), then `spawn()` || Link distance | Choice buttons | None · Short · Medium · Long | Medium | How close two dots must be to join with a line. | None: `CONNECTIONS` false; Short · Medium · Long: `CONNECTIONS` true and `DIST` 70 / 100 / 150 |**More options**@@ -442,7 +442,7 @@ None: leave out the `details.hb-options` block."Stroking each link on its own costs one draw call per line, thousands a frame; grouping the links into six opacity steps draws them all in six calls, with no visible difference."- **README Production notes:**- The `ctx.clearRect` bullet's "(enable "trails" toggle in the demo)" becomes "(turn on Trails in the demo)".- - Add a bullet after "O(n²) limit": "**Phones and tablets**: the demo draws 30 to 60 dots on screens 600px wide or less and 60 to 120 up to 1024px, and strokes the links in six batches instead of one call per line."+ - Add a bullet after "O(n²) limit": "**Phones and tablets**: the demo draws 30 to 60 dots on phones (screens 600px wide or less, or 500px tall or less when held sideways) and 60 to 120 on other screens up to 1024px wide, and strokes the links in six batches instead of one call per line."- The rest is unchanged.- **Category line:** `06.04 · 3D & Advanced`- **Pager:** Previous: Parallax 3D Tilt (`../parallax-3d-tilt/`) · Next: Fluid / Liquid Simulation (`../fluid-simulation/`)