Skip to content

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.

docs: tighten the Canvas Particle and GPGPU READMEs' wording on the wash count

matin844655353b36
diff --git a/animations/06-3d-advanced/canvas-particle-effect/README.md b/animations/06-3d-advanced/canvas-particle-effect/README.md
index 2a1c12f3..aecf33ed 100644
--- a/animations/06-3d-advanced/canvas-particle-effect/README.md
+++ b/animations/06-3d-advanced/canvas-particle-effect/README.md
@@ -40,7 +40,7 @@ let owed = 0; // steps of Trails wash not laid yet: 0 to start w
function frame(elapsed) { // called for every frame the screen offers; elapsed: ms since the last frame that was drawn
const steps = Math.min(elapsed, 50) / (1000 / 60); // a long gap counts for at most 50 ms
const whole = Math.max(1, Math.round(steps));
- const due = Math.abs(steps - whole) < 0.05 ? whole : steps; // within 5% of a whole number counts as that number
+ const due = Math.abs(steps - whole) < 0.05 ? whole : steps; // within 0.05 of a whole number counts as that number
if (Math.round(owed + due + 0.05) < 1) return; // no wash due: draw nothing and change nothing, the time waits for the next frame
const k = steps * (slow ? 1 / 3 : 1);
@@ -52,7 +52,7 @@ function frame(elapsed) { // called for every frame the screen offers; elaps
}
```
-The wash count is worked out apart from the movement so that a screen a little off 60 Hz (59.94 or 60.06), or one whose frames arrive a little unevenly, still washes exactly once a frame. The 0.05 added before rounding keeps half a step, which is what a frame is at exactly 120 or 240 Hz, from sitting on a tie that timestamp noise could decide either way. A frame that comes before a wash is due draws nothing, which also keeps the drawing near 60 pictures a second on a faster screen.
+The wash count is worked out apart from the movement so that a screen a little off 60 Hz (59.94 or 60.06), or one whose frames arrive a little unevenly, still washes exactly once a frame. The 0.05 added before rounding keeps the half step of carried time that sits at the draw decision on exact 120 and 240 Hz screens from sitting on a tie that timestamp noise could decide either way. A frame that comes before a wash is due draws nothing (with Trails off too, since the same count sets the pace), which also keeps the drawing near 60 pictures a second on a faster screen.
**Connections** — O(n²) distance check per frame:
diff --git a/animations/06-3d-advanced/gpgpu-particle-system/README.md b/animations/06-3d-advanced/gpgpu-particle-system/README.md
index 7e1e4d6a..a78a6851 100644
--- a/animations/06-3d-advanced/gpgpu-particle-system/README.md
+++ b/animations/06-3d-advanced/gpgpu-particle-system/README.md
@@ -50,7 +50,7 @@ void main() {
}
```
-**Time step** — every physics pass moves the particles by exactly one 60 Hz step: `uStep` is 1 (a third of that in slow motion), on every screen. The page looks at every frame the screen offers and measures the time since the last drawn one in steps of 1/60 s (a gap counts for at most 50 ms, and a value within 5% of a whole number of steps counts as that number, so a screen a little off 60 Hz, such as 59.94 or 119.88 Hz, still runs exactly one pass a frame). It runs one pass for every whole step it has added up (allowing 1 ms of slack, and at most three passes a frame) and carries the rest over: one pass a frame on a 60 Hz screen, two on a 30 Hz one, and none on a frame that comes too soon, which changes nothing and draws nothing, so the drawing stays near 60 pictures a second on a faster screen. The particles move at the same speed on every screen, and the attractor, which pulls hard near the middle and settles differently for a longer or a shorter step, looks the same too. A drawn frame lays the trail fade over the picture once for every pass it ran, after the passes, each time 12% of the old picture; slow motion still runs 60 passes a second, so it slows the particles but not the fade. One smaller fade would fade the same amount, but an 8-bit canvas rounds it differently, and the faint leftovers of a trail would end up another color.
+**Time step** — every physics pass moves the particles by exactly one 60 Hz step: `uStep` is 1 (a third of that in slow motion), on every screen. The page looks at every frame the screen offers and measures the time since the last drawn one in steps of 1/60 s (a gap counts for at most 50 ms, and a value within 0.05 of a whole number of steps counts as that number, so a screen a little off 60 Hz, such as 59.94 or 119.88 Hz, still runs exactly one pass a frame). It runs one pass for every whole step it has added up (allowing 1 ms of slack, and at most three passes a frame) and carries the rest over: one pass a frame on a 60 Hz screen, two on a 30 Hz one, and none on a frame that comes too soon, which changes nothing and draws nothing, so the drawing stays near 60 pictures a second on a faster screen. The particles move at the same speed on every screen, and the attractor, which pulls hard near the middle and settles differently for a longer or a shorter step, looks the same too. A drawn frame lays the trail fade over the picture once for every pass it ran, after the passes, each time 12% of the old picture; slow motion still runs 60 passes a second, so it slows the particles but not the fade. One smaller fade would fade the same amount, but an 8-bit canvas rounds it differently, and the faint leftovers of a trail would end up another color.
**Texture ping-pong** — alternate which texture is the read source each pass: