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: apply Leans at once while paused, close the Pause race, and tidy both pages after review
matin50e5669c15ce
diff --git a/animations/05-text-typography/variable-font-morph/index.html b/animations/05-text-typography/variable-font-morph/index.htmlindex 58cc7b70..3295aa93 100644--- a/animations/05-text-typography/variable-font-morph/index.html+++ b/animations/05-text-typography/variable-font-morph/index.html@@ -161,7 +161,8 @@let timer=0,next=null,due=0,left=0,held=[],paused=false;function wait(fn,ms){clearTimeout(timer);next=fn;if(paused){left=ms;return}due=performance.now()+ms;timer=setTimeout(()=>{next=null;fn()},ms)}function freeze(){paused=true;clearTimeout(timer);if(next)left=Math.max(0,due-performance.now());held=stage.getAnimations({subtree:true}).filter(a=>a.playState==='running');held.forEach(a=>a.pause())}- function thaw(){paused=false;held.forEach(a=>{if(a.playState==='paused')a.play()});held=[];if(next)wait(next,left)}+ // A transition that Pause caught at or past its end is finished, not played: play() would rewind it to the start.+ function thaw(){paused=false;held.forEach(a=>{if(a.playState!=='paused')return;if(a.currentTime>=a.effect.getComputedTiming().endTime)a.finish();else a.play()});held=[];if(next)wait(next,left)}document.addEventListener('hb:pause',e=>e.detail.paused?freeze():thaw());// Applies the next preset, then schedules the step after it. --morph-dur is set fresh on every call, so a@@ -177,12 +178,14 @@wait(step,d+800);}- // Applied to the word on screen at once, so the change shows even while paused.+ // Applied to the word on screen at once, so the change shows even while paused: a tilt that would ease in is+ // finished on the spot, while the held weight transitions stay frozen and Play carries on from there.leanTog.addEventListener('change',()=>{vars.setProperty('--slnt',leanTog.checked?current.slnt:0);+ if(paused)vfText.getAnimations().filter(a=>a.transitionProperty==='transform').forEach(a=>a.finish());});txtIn.addEventListener('input',()=>{- vfText.textContent=txtIn.value||'Type';+ vfText.textContent=txtIn.value.trim()?txtIn.value:'Type';});function choices(id,pick){diff --git a/animations/05-text-typography/wavy-text/README.md b/animations/05-text-typography/wavy-text/README.mdindex bb71ea40..3c2ea895 100644--- a/animations/05-text-typography/wavy-text/README.md+++ b/animations/05-text-typography/wavy-text/README.md@@ -15,7 +15,7 @@ JavaScript splits the string into one `<span>` per character and stamps each wit```js[...str].forEach((ch,i)=>{const s=document.createElement('span');- s.textContent=ch===' '?' ':ch;+ s.textContent=ch;s.style.setProperty('--i',i);wave.appendChild(s);});diff --git a/animations/05-text-typography/wavy-text/index.html b/animations/05-text-typography/wavy-text/index.htmlindex e540b976..6a2a49b2 100644--- a/animations/05-text-typography/wavy-text/index.html+++ b/animations/05-text-typography/wavy-text/index.html@@ -159,7 +159,7 @@wave.textContent='';[...str].forEach((ch,i)=>{const s=document.createElement('span');- s.textContent=ch===' '?' ':ch;+ s.textContent=ch;s.style.setProperty('--i',i);s.setAttribute('aria-hidden','true');wave.appendChild(s);@@ -176,7 +176,7 @@addEventListener('resize',fit);if(document.fonts)document.fonts.ready.then(fit); // the site font can still be loading when fit() first runs- txtIn.addEventListener('input',e=>build(e.target.value||'Wavy'));+ txtIn.addEventListener('input',e=>build(e.target.value.trim()?e.target.value:'Wavy'));function choices(id,pick){const buttons=document.querySelectorAll('#'+id+' button');