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: keep words whole and spaces even on the Entrance & Exit text pages
matin4296dbfa95ee
diff --git a/animations/02-entrance-and-exit/letter-by-letter-stagger/README.md b/animations/02-entrance-and-exit/letter-by-letter-stagger/README.mdindex 2042e27f..d9f0bcb7 100644--- a/animations/02-entrance-and-exit/letter-by-letter-stagger/README.md+++ b/animations/02-entrance-and-exit/letter-by-letter-stagger/README.md@@ -17,7 +17,7 @@ Each character is wrapped in its own `<span class="char">` and given a custom pr[...text].forEach((c,i)=>{const s=document.createElement('span');s.className='char';s.style.setProperty('--i',i);- s.textContent=c===' '?' ':c; // a lone plain space would collapse inside its inline-block+ s.textContent=c===' '?'\u00a0':c; // a lone plain space would collapse inside its inline-blocktarget.appendChild(s);});```diff --git a/animations/02-entrance-and-exit/split-text-reveal/README.md b/animations/02-entrance-and-exit/split-text-reveal/README.mdindex ea64dd35..25ad1ea7 100644--- a/animations/02-entrance-and-exit/split-text-reveal/README.md+++ b/animations/02-entrance-and-exit/split-text-reveal/README.md@@ -27,13 +27,18 @@ JavaScript splits the text and gives each unit an `--i` index custom property. CThe split assigns the index as it builds the spans:```js-[...text].forEach(c => {- if (c === ' ') { target.appendChild(document.createTextNode(' ')); return; }- const s = document.createElement('span');- s.className = 'unit';- s.style.setProperty('--i', unitIdx++); // drives its transition-delay- s.textContent = c;- target.appendChild(s);+text.split(/\s+/).filter(Boolean).forEach((word, wi, all) => {+ const w = document.createElement('span');+ w.className = 'unit-word'; // keeps the word's letters on one line+ [...word].forEach(c => {+ const s = document.createElement('span');+ s.className = 'unit';+ s.style.setProperty('--i', unitIdx++); // drives its transition-delay+ s.textContent = c;+ w.appendChild(s);+ });+ target.appendChild(w);+ if (wi < all.length - 1) target.appendChild(document.createTextNode(' '));});```diff --git a/animations/02-entrance-and-exit/split-text-reveal/index.html b/animations/02-entrance-and-exit/split-text-reveal/index.htmlindex e6ed5ed4..13cf93c0 100644--- a/animations/02-entrance-and-exit/split-text-reveal/index.html+++ b/animations/02-entrance-and-exit/split-text-reveal/index.html@@ -40,8 +40,8 @@[data-mode="lines"] .unit-inner{display:block;transform:translateY(100%);transition:transform var(--dur) var(--ease) calc(var(--i)*var(--stagger))}.splitting.in[data-mode="lines"] .unit-inner{transform:none}[data-mode="lines"] .unit{opacity:1}- /* word spacing */- [data-mode="words"] .unit{margin-right:0.28em}+ /* Letters mode: the letters of one word sit in one box that never breaks, so lines break only between words */+ .unit-word{display:inline-block;white-space:nowrap}[data-mode="chars"] .unit{margin-right:0.01em}@media(prefers-reduced-motion:reduce){.unit,.unit-inner{transition:opacity 300ms linear!important;transform:none!important}[data-mode="lines"] .unit{opacity:0}.splitting.in .unit{opacity:1}}</style>@@ -201,10 +201,14 @@target.innerHTML='';if(mode==='chars'){let unitIdx=0;- [...text].forEach(c=>{- if(c===' '){target.appendChild(document.createTextNode(' '));return;}- const s=document.createElement('span');s.className='unit';s.style.setProperty('--i',unitIdx++);- s.textContent=c;target.appendChild(s);+ text.split(/\s+/).filter(Boolean).forEach((word,wi,all)=>{+ const w=document.createElement('span');w.className='unit-word';+ [...word].forEach(c=>{+ const s=document.createElement('span');s.className='unit';s.style.setProperty('--i',unitIdx++);+ s.textContent=c;w.appendChild(s);+ });+ target.appendChild(w);+ if(wi<all.length-1)target.appendChild(document.createTextNode(' '));});} else {let units=[];diff --git a/animations/02-entrance-and-exit/word-by-word-reveal/README.md b/animations/02-entrance-and-exit/word-by-word-reveal/README.mdindex 09db833b..492f68d8 100644--- a/animations/02-entrance-and-exit/word-by-word-reveal/README.md+++ b/animations/02-entrance-and-exit/word-by-word-reveal/README.md@@ -25,7 +25,7 @@ words.forEach((w,wi)=>{``````css-.word{display:inline-block;margin-right:0.28em;opacity:0;+.word{display:inline-block;opacity:0;transition:opacity var(--dur) var(--ease) calc(var(--i)*var(--stagger)),transform var(--dur) var(--ease) calc(var(--i)*var(--stagger))}[data-anim="fade-up"] .word{transform:translateY(0.4em)}diff --git a/animations/02-entrance-and-exit/word-by-word-reveal/index.html b/animations/02-entrance-and-exit/word-by-word-reveal/index.htmlindex 1852c001..d078849e 100644--- a/animations/02-entrance-and-exit/word-by-word-reveal/index.html+++ b/animations/02-entrance-and-exit/word-by-word-reveal/index.html@@ -25,7 +25,7 @@*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}.stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0b0b0d;padding:clamp(20px,4vw,48px)}#text-target{font-size:clamp(18px,3vw,28px);font-weight:bold;text-align:center;line-height:1.55;max-width:520px}- .word{display:inline-block;margin-right:0.28em;+ .word{display:inline-block;opacity:0;transition:opacity var(--dur) var(--ease) calc(var(--i)*var(--stagger)),transform var(--dur) var(--ease) calc(var(--i)*var(--stagger)),filter var(--dur) var(--ease) calc(var(--i)*var(--stagger))}[data-anim="fade-up"] .word{transform:translateY(0.4em)}[data-anim="blur"] .word{filter:blur(8px);transform:none}