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.

fix: Text Particles draws smaller squares on phones, so they read as dots

matin8ada8bb4df48
diff --git a/animations/05-text-typography/text-particles/README.md b/animations/05-text-typography/text-particles/README.md
index 5b79abfd..803f808f 100644
--- a/animations/05-text-typography/text-particles/README.md
+++ b/animations/05-text-typography/text-particles/README.md
@@ -34,7 +34,7 @@ x += vx; y += vy;
Because the push grows with the spring `K`, a pointer that holds still opens a gap of the same size, about 0.7 of the reach, at every return speed; `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. Once the pointer has gone and every dot is within a third of a pixel of home, the dots are put home and the loop stops, so a word at rest costs nothing.
-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. The dots come out from left to right, so the dots of one color follow each other: each color is one path of circles, filled once. A dot that is away from home is drawn again on top with the `lighter` blend, a little larger and brighter the further it was pushed, so it glows in its own color. Phones draw each dot as a small square of the same area with `fillRect`, which costs far less to paint than a path of circles. 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. The dots come out from left to right, so the dots of one color follow each other: each color is one path of circles, filled once. A dot that is away from home is drawn again on top with the `lighter` blend, a little larger and brighter the further it was pushed, so it glows in its own color. Phones draw each dot as a small square with `fillRect`, which costs far less to paint than a path of circles and looks much the same at that size. 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.html
index 0e3e37c9..3d6e4d6e 100644
--- a/animations/05-text-typography/text-particles/index.html
+++ b/animations/05-text-typography/text-particles/index.html
@@ -257,7 +257,7 @@
for(let k=0;k<n;k++){
const i=list?list[k]:k,X=px[i]+(x[i]-px[i])*a,Y=py[i]+(y[i]-py[i])*a;
if(bk[i]!==c){if(c>=0&&!sq)ctx.fill();c=bk[i];ctx.fillStyle=cols[c];ctx.beginPath();}
- if(sq)ctx.fillRect(X-s*.89,Y-s*.89,s*1.77,s*1.77);else{ctx.moveTo(X+s,Y);ctx.arc(X,Y,s,0,TAU);}
+ if(sq)ctx.fillRect(X-s*.75,Y-s*.75,s*1.5,s*1.5);else{ctx.moveTo(X+s,Y);ctx.arc(X,Y,s,0,TAU);}
}
if(c>=0&&!sq)ctx.fill();
}