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: Light Leak: the At random tick row widens its scale after a shorter setting, so its oldest ticks no longer pile up

matinff5f7a9c79aa
diff --git a/animations/07-ambient-background/light-leak/index.html b/animations/07-ambient-background/light-leak/index.html
index eecee319..3891d2eb 100644
--- a/animations/07-ambient-background/light-leak/index.html
+++ b/animations/07-ambient-background/light-leak/index.html
@@ -420,12 +420,14 @@
}
function placeTicks(){
const W=ticksB.clientWidth;if(!W)return;
- const base=2*dur*(slowTog.checked?3:1)+200,s=.9*(W-8)/(4*(base+maxGap*1000));
+ const base=2*dur*(slowTog.checked?3:1)+200,iv=l=>l.iv??base+(minGap+l.f*(maxGap-minGap))*1000;
+ // Leaks timed at an earlier, longer setting widen the scale, so all five ticks stay in the row
+ const s=.9*(W-8)/Math.max(4*(base+maxGap*1000),rnd.slice(1).reduce((a,l)=>a+iv(l),0));
const put=(row,list)=>{
let x=W-6;
for(let i=4;i>=0;i--){
row[i].style.transform=`translateX(${Math.max(x-2,0)}px) scaleY(${Math.min(list[i].r*intensity/TOP,1)})`;
- x-=(list[i].iv??base+(minGap+list[i].f*(maxGap-minGap))*1000)*s;
+ x-=iv(list[i])*s;
}
};
put(rowA,Array(5).fill({iv:base+(minGap+maxGap)*500,r:EVEN}));put(rowB,rnd);