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: Text Particles (05.19): only dots under 1.25 CSS px are squares, so 1x windows draw round dots, and the README gives the measured settle figures
matin398c710650df
diff --git a/animations/05-text-typography/text-particles/README.md b/animations/05-text-typography/text-particles/README.mdindex 76afd8f3..f91074e9 100644--- a/animations/05-text-typography/text-particles/README.md+++ b/animations/05-text-typography/text-particles/README.md@@ -32,9 +32,9 @@ vx = (vx + ax) * D; vy = (vy + ay) * D; // D: the share of its speed a dotx += vx; y += vy;```-Because the push grows with the spring `K`, a pointer that holds still opens a gap of the same size at every return speed, its radius about 0.7 of the reach; `K` and `D` only set how quickly the dots come back. A spring changes with the length of its step, so the frame loop adds up the time that has passed (a third of it in slow motion), takes one fixed step per 60th of a second and draws each dot between its last two steps. The motion is then the same on a 60 Hz and a 120 Hz screen, and slow motion stays smooth. A dot that is out of reach, nearly still and within a third of a pixel of home is put there, and a dot at home and out of reach is skipped, so the work follows the dots that move. Once every dot is home the loop stops, so a word at rest costs nothing. Under a pointer that holds still, the spring alone settles slowly: a dot whose home sits near the pointer can land on the far side of the gap and creep around its rim for many seconds. So half a second after the pointer stops, each dot whose home lies inside the reach, and that is itself within 1.3 times the reach of the pointer, moves to its resting place on the line from the pointer through its home, where push and spring balance (at (2.4R + h) / 3.4 from the pointer, for a home h from it). Each step it slides around the pointer by 12% of the angle left, at most 3 px sideways, and closes 12% of the distance left toward or away from the pointer; measured at the far reach, that came to at most about 5 px a step toward or away and about 6 px in all. A dot that has arrived is skipped until the pointer moves again, and the other dots finish springing home. The gap then holds its shape, every other dot is exactly home and the loop stops, 2 to 3 seconds after the pointer does. Show me, a setting and a new word start that half second over, so the dots still spring back first.+Because the push grows with the spring `K`, a pointer that holds still opens a gap of the same size at every return speed, its radius about 0.7 of the reach; `K` and `D` only set how quickly the dots come back. A spring changes with the length of its step, so the frame loop adds up the time that has passed (a third of it in slow motion), takes one fixed step per 60th of a second and draws each dot between its last two steps. The motion is then the same on a 60 Hz and a 120 Hz screen, and slow motion stays smooth. A dot that is out of reach, nearly still and within a third of a pixel of home is put there, and a dot at home and out of reach is skipped, so the work follows the dots that move. Once every dot is home the loop stops, so a word at rest costs nothing. Under a pointer that holds still, the spring alone settles slowly: a dot whose home sits near the pointer can land on the far side of the gap and creep around its rim for many seconds. So half a second after the pointer stops, each dot whose home lies inside the reach, and that is itself within 1.3 times the reach of the pointer, moves to its resting place on the line from the pointer through its home, where push and spring balance (at (2.4R + h) / 3.4 from the pointer, for a home h from it). Each step it slides around the pointer by 12% of the angle left, at most 3 px sideways, and closes 12% of the distance left toward or away from the pointer; measured at the far reach, that came to at most about 6 px a step toward or away and about 7 px in all. A dot that has arrived is skipped until the pointer moves again, and the other dots finish springing home. The gap then holds its shape, every other dot is exactly home and the loop stops, within about 3 seconds of the pointer stopping. Show me, a setting and a new word start that half second over, so the dots still spring back first.-The palette is spread across the word as 32 colors, and each dot takes the color at its home, so it keeps its color as it flies. Each dot is filled as a circle of its own (`beginPath`, `arc`, `fill`): Chrome draws a lone circle with a fast special case on the graphics chip, while one path holding thousands of circles has to be cut into triangles again on every frame. Measured in Chrome, one path per color ran Show me at 43 to 60 frames a second on 2× screens, depending on the run; one circle at a time holds 60. Other browsers take their own fast and slow paths, so measure both ways in the browsers you target. The fast circle has a softer edge, which on a 1× screen fills the gaps between small dots with a haze, so each circle is drawn 0.12 device pixels smaller. A dot that is away from home is drawn brighter and a little larger, in three steps the further it was pushed, so it glows in its own color. On a phone, a dot whose radius is under 2.5 pixels of the canvas (about 1.25 CSS pixels, as a phone's canvas holds two pixels to one; usually the small size, with the phone held upright) is drawn as a square with `fillRect`, which costs even less to paint and still reads as a dot at that size: in Chrome, with the processor slowed four times, circles there ran Show me at about 52 frames a second and squares at 60. Larger dots stay round, as squares that big look like bricks. A new word or dot size samples the word again, and each new dot starts where an old one stands (both taken from left to right), so the dots flow into the new letters. Show me moves a pretend pointer through the word along a wavy path, drawn as a small light with a ring for its reach.+The palette is spread across the word as 32 colors, and each dot takes the color at its home, so it keeps its color as it flies. Each dot is filled as a circle of its own (`beginPath`, `arc`, `fill`): Chrome draws a lone circle with a fast special case on the graphics chip, while one path holding thousands of circles has to be cut into triangles again on every frame. Measured in Chrome, one path per color ran Show me at 43 to 60 frames a second on 2× screens, depending on the run; one circle at a time holds 60. Other browsers take their own fast and slow paths, so measure both ways in the browsers you target. The fast circle has a softer edge, which on a 1× screen fills the gaps between small dots with a haze, so each circle is drawn 0.12 device pixels smaller. A dot that is away from home is drawn brighter and a little larger, in three steps the further it was pushed, so it glows in its own color. On a phone, a dot whose radius is under 1.25 CSS pixels (2.5 pixels of a phone's canvas, which holds two to one; usually the small size, with the phone held upright) is drawn as a square with `fillRect`, which costs even less to paint and still reads as a dot at that size: in Chrome, with the processor slowed four times, circles there ran Show me at about 52 frames a second and squares at 60. Larger dots stay round, as squares that big look like bricks. A new word or dot size samples the word again, and each new dot starts where an old one stands (both taken from left to right), so the dots flow into the new letters. Show me moves a pretend pointer through the word along a wavy path, drawn as a small light with a ring for its reach.## Key parameters| Parameter | Default | Effect |diff --git a/animations/05-text-typography/text-particles/index.html b/animations/05-text-typography/text-particles/index.htmlindex 8a2b25ca..f48f1cbd 100644--- a/animations/05-text-typography/text-particles/index.html+++ b/animations/05-text-typography/text-particles/index.html@@ -243,7 +243,7 @@// Each dot is a circle of its own (Chrome draws these much faster than one path of thousands), 0.12 device pixels smaller for its softer// edge; a phone draws tiny dots as squares. A dot pushed from home is drawn brighter and larger; under reduced motion, those near the pointer.function draw(a){- ctx.clearRect(0,0,W,H);sq=PHONE.matches&&rad*DPR<2.5;+ ctx.clearRect(0,0,W,H);sq=PHONE.matches&&rad<1.25;const red=reduce.matches,l=lightAt,R2=R*R,far2=R*.6,n=[0,0,0,0];for(let i=0;i<N;i++){let v=0;if(!red)v=(Math.abs(px[i]+(x[i]-px[i])*a-hx[i])+Math.abs(py[i]+(y[i]-py[i])*a-hy[i]))/far2;