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: the home Flow Field card shows a still of short trails under reduced motion

matin64b4c439a4b7
diff --git a/index.html b/index.html
index 0baf5414..caf6b9ca 100644
--- a/index.html
+++ b/index.html
@@ -1311,8 +1311,9 @@ function flowEngine(pv){
const c=document.createElement('canvas');pv.appendChild(c);const ctx=c.getContext('2d');
let w,h,ps,raf=null,last=null,fa=0,cs=0;const D=devicePixelRatio;
function ang(x,y){return (Math.sin(x*0.9+y*0.6)+Math.cos(y*1.1-x*0.5))*Math.PI;}
+ // with reduced motion the card never plays, so size() also draws a still of short trails
function size(){const r=pv.getBoundingClientRect();w=c.width=r.width*D;h=c.height=r.height*D;
- ps=Array.from({length:55},()=>({x:Math.random()*w,y:Math.random()*h}));ctx.fillStyle='#05060a';ctx.fillRect(0,0,w,h);}
+ ps=Array.from({length:55},()=>({x:Math.random()*w,y:Math.random()*h}));ctx.fillStyle='#05060a';ctx.fillRect(0,0,w,h);if(reduce)for(let i=0;i<40;i++)draw(1);}
function draw(steps){if(!steps)return;
const whole=Math.max(1,Math.round(steps));fa+=Math.abs(steps-whole)<.05?whole:steps;const nf=Math.round(fa+.05);
if(!nf){cs+=steps;return;}