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: tidy Entrance & Exit content, contrast and phone layout

matin57e4e56f0120
diff --git a/animations/02-entrance-and-exit/blur-in/README.md b/animations/02-entrance-and-exit/blur-in/README.md
index 2fafee03..5aa9cdb3 100644
--- a/animations/02-entrance-and-exit/blur-in/README.md
+++ b/animations/02-entrance-and-exit/blur-in/README.md
@@ -51,6 +51,6 @@ The Blur only and Fade only choices of What changes exist to show that the two c
- **Motion One / GSAP**: both animate the `filter` string directly; GSAP needs no plugin for CSS filters.
## See also
-- [Fade In / Out](../fade-in-out/) — the fade on its own, with no blur
-- [Scale In](../scale-in/) — grows from smaller to full size
+- [Fade In / Fade Out](../fade-in-out/) — the fade on its own, with no blur
+- [Scale In / Zoom In](../scale-in/) — grows from smaller to full size
- [Flip In](../flip-in/) — swings in like a card turning over
diff --git a/animations/02-entrance-and-exit/blur-in/index.html b/animations/02-entrance-and-exit/blur-in/index.html
index f64ce58e..eb384c1c 100644
--- a/animations/02-entrance-and-exit/blur-in/index.html
+++ b/animations/02-entrance-and-exit/blur-in/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Blur In", "name": "Blur In", "description": "Comes into focus from a blur, like a camera. Best for featured cards and photos.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/blur-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Blur In"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:700ms;--ease:ease-out;--blur-start:20px;--ty:-8px}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:700ms;--ease:ease-out;--blur-start:20px;--ty:8px}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d}
.card{background:#161b22;border:1px solid #30363d;border-radius:14px;padding:clamp(28px,5vw,48px);text-align:center;max-width:320px;
@@ -38,8 +38,8 @@
.card[data-mode="fade-only"].in{opacity:1}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important;filter:none!important;transform:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
@@ -176,7 +176,7 @@
vars.setProperty('--dur',dur()+'ms');
vars.setProperty('--ease',ease);
vars.setProperty('--blur-start',blurStart);
- vars.setProperty('--ty',driftTog.checked?'-8px':'0px');
+ vars.setProperty('--ty',driftTog.checked?'8px':'0px');
}
function later(fn,wait){timers.push(setTimeout(fn,wait))}
function blurIn(){
diff --git a/animations/02-entrance-and-exit/bounce-in/README.md b/animations/02-entrance-and-exit/bounce-in/README.md
index 84760d54..36157b8e 100644
--- a/animations/02-entrance-and-exit/bounce-in/README.md
+++ b/animations/02-entrance-and-exit/bounce-in/README.md
@@ -49,6 +49,6 @@ The generated CSS is injected into a live `<style>` tag, so changing Bounce stre
- **GSAP**: `Bounce.out` / `Elastic.out` eases, or a `.fromTo()` with overshoot values, cover this without a manual keyframe block.
## See also
-- [Scale In](../scale-in/) — grows into place without the bounce
+- [Scale In / Zoom In](../scale-in/) — grows into place without the bounce
- [Rotate In](../rotate-in/) — spins into place while it grows
- [Slide In](../slide-in/) — travels into place from one edge
diff --git a/animations/02-entrance-and-exit/bounce-in/index.html b/animations/02-entrance-and-exit/bounce-in/index.html
index 4c4bdb2f..2d6c44bf 100644
--- a/animations/02-entrance-and-exit/bounce-in/index.html
+++ b/animations/02-entrance-and-exit/bounce-in/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Bounce In", "name": "Bounce In", "description": "Lands with a springy bounce. Best for badges and success messages.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/bounce-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Bounce In"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:1100ms}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:1100ms}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d}
.card{background:#161b22;border:1px solid #30363d;border-radius:14px;padding:clamp(28px,5vw,48px);text-align:center;max-width:300px;
@@ -35,8 +35,8 @@
@media(prefers-reduced-motion:reduce){.card.in{animation:none!important;opacity:1;transform:none}.card.out{animation:none!important;opacity:0}}
</style>
<style id="kf-style"></style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/clip-path-reveal/index.html b/animations/02-entrance-and-exit/clip-path-reveal/index.html
index 48303aaf..dbd5d52e 100644
--- a/animations/02-entrance-and-exit/clip-path-reveal/index.html
+++ b/animations/02-entrance-and-exit/clip-path-reveal/index.html
@@ -30,12 +30,12 @@
.surface-bg{position:absolute;inset:0;background:linear-gradient(135deg,#1a2a4a 0%,#0d3a5c 40%,#1a4a3a 70%,#2a3a1a 100%)}
.surface-grid{position:absolute;inset:0;background-image:linear-gradient(rgba(88,166,255,.08) 1px,transparent 1px),linear-gradient(90deg,rgba(88,166,255,.08) 1px,transparent 1px);background-size:40px 40px}
.surface-text{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center}
- .surface-label{font-size:10px;text-transform:uppercase;letter-spacing:3px;opacity:.5}
+ .surface-label{font-size:10px;text-transform:uppercase;letter-spacing:3px;opacity:.7}
.surface-title{font-size:clamp(22px,4vw,36px);font-weight:bold}
@media(prefers-reduced-motion:reduce){.surface{opacity:0;transition:opacity 400ms linear!important;clip-path:none!important}.surface.in{opacity:1}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/curtain-reveal/index.html b/animations/02-entrance-and-exit/curtain-reveal/index.html
index 48c49433..07ae195a 100644
--- a/animations/02-entrance-and-exit/curtain-reveal/index.html
+++ b/animations/02-entrance-and-exit/curtain-reveal/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Curtain Reveal", "name": "Curtain Reveal", "description": "A colored panel covers it, then slides away. Best for intros and logos.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/curtain-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Curtain Reveal"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--curtain-color:#111827}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--curtain-color:#111827}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0a0f18;position:relative}
.content{display:flex;flex-direction:column;align-items:center;gap:16px;text-align:center;padding:24px;z-index:1}
@@ -38,8 +38,8 @@
.curtain.c-out,.curtain-b.c-out{transform:var(--to)}
@media(prefers-reduced-motion:reduce){.curtain,.curtain-b{transition:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/fade-in-out/index.html b/animations/02-entrance-and-exit/fade-in-out/index.html
index a48d890f..d1b51871 100644
--- a/animations/02-entrance-and-exit/fade-in-out/index.html
+++ b/animations/02-entrance-and-exit/fade-in-out/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Fade In / Fade Out", "name": "Fade In / Fade Out", "description": "Fades in to appear and fades out to leave. Best for pop-ups and tooltips.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/fade-in-out/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Fade In / Fade Out"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:600ms;--ease:ease-out}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:600ms;--ease:ease-out}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d}
.card{background:#161b22;border:1px solid #30363d;border-radius:12px;padding:clamp(28px,5vw,48px);text-align:center;max-width:320px;
@@ -32,8 +32,8 @@
.card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/flip-in/README.md b/animations/02-entrance-and-exit/flip-in/README.md
index ff4690bb..b9d2b309 100644
--- a/animations/02-entrance-and-exit/flip-in/README.md
+++ b/animations/02-entrance-and-exit/flip-in/README.md
@@ -2,7 +2,7 @@
## What it is
-Flip In swings an element from edge-on into full view in 3D, like a hinged panel turning toward you. The key detail is that the 3D perspective is set on the element's container, not on the card itself; without it, the turn collapses into a flat squash with no sense of depth.
+Flip In swings an element from a turned-away angle into full view in 3D, like a hinged panel turning toward you. The key detail is that the 3D perspective is set on the element's container, not on the card itself; without it, the turn collapses into a flat squash with no sense of depth.
## When to use it
- Card entrances in dashboards, galleries, and onboarding flows
@@ -55,6 +55,6 @@ The Hinge setting moves transform-origin to an edge (top, bottom, left) so the c
- **GSAP**: set `transformPerspective` (or `perspective` on the container) and tween `rotationY`; GSAP's 3D handling is built in.
## See also
-- [Scale In](../scale-in/) — grows into place, flat on the page
+- [Scale In / Zoom In](../scale-in/) — grows into place, flat on the page
- [Rotate In](../rotate-in/) — spins flat instead of turning in 3D
- [Blur In](../blur-in/) — sharpens from a blur as it fades in
diff --git a/animations/02-entrance-and-exit/flip-in/index.html b/animations/02-entrance-and-exit/flip-in/index.html
index ee8eff04..a5883b2a 100644
--- a/animations/02-entrance-and-exit/flip-in/index.html
+++ b/animations/02-entrance-and-exit/flip-in/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Flip In", "name": "Flip In", "description": "Swings into view in 3D, like a card turning over. Best for cards and tiles.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/flip-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Flip In"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:600ms;--ease:ease-out;--persp:1000px;--rot-y:90deg;--rot-x:0deg;--origin:center}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:600ms;--ease:ease-out;--persp:1000px;--rot-y:90deg;--rot-x:0deg;--origin:center}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d;perspective:var(--persp)}
.card{background:#161b22;border:1px solid #30363d;border-radius:14px;padding:clamp(28px,5vw,48px);text-align:center;width:clamp(220px,50%,280px);
@@ -33,8 +33,8 @@
.card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important;transform:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
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.md
index 6c74d06b..2042e27f 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
@@ -2,7 +2,7 @@
## What it is
-A letter-by-letter stagger animates each character a moment after the previous one, so a phrase assembles as a cascade instead of appearing all at once. The demo shows two versions: a cascade where every letter plays a small entrance, and a typewriter that reveals letters one at a time behind a blinking cursor.
+A letter-by-letter stagger animates each character a moment after the previous one, so a phrase assembles as a cascade instead of appearing all at once. The demo shows two versions: a cascade where every letter plays a small entrance, and a typewriter that reveals letters one at a time, with an optional blinking cursor.
## When to use it
- Hero headlines and landing-page titles where the text is the focal point
@@ -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;
+ s.textContent=c===' '?' ':c; // a lone plain space would collapse inside its inline-block
target.appendChild(s);
});
```
diff --git a/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html b/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
index 6ca031d9..278b3f46 100644
--- a/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
+++ b/animations/02-entrance-and-exit/letter-by-letter-stagger/index.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Letter-by-Letter Stagger — Animation Handbook</title>
- <meta name="description" content="A phrase appears letter by letter, or is typed out. Best for short headlines.">
+ <meta name="description" content="A phrase appears letter by letter or typewriter-style. Best for short headlines.">
<link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/letter-by-letter-stagger/">
<link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
<link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
@@ -12,19 +12,18 @@
<meta property="og:type" content="article">
<meta property="og:site_name" content="Animation Handbook">
<meta property="og:title" content="Letter-by-Letter Stagger — Animation Handbook">
- <meta property="og:description" content="A phrase appears letter by letter, or is typed out. Best for short headlines.">
+ <meta property="og:description" content="A phrase appears letter by letter or typewriter-style. Best for short headlines.">
<meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/letter-by-letter-stagger/">
<meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Letter-by-Letter Stagger — Animation Handbook">
- <meta name="twitter:description" content="A phrase appears letter by letter, or is typed out. Best for short headlines.">
+ <meta name="twitter:description" content="A phrase appears letter by letter or typewriter-style. Best for short headlines.">
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Letter-by-Letter Stagger", "name": "Letter-by-Letter Stagger", "description": "A phrase appears letter by letter, or is typed out. Best for short headlines.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/letter-by-letter-stagger/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Letter-by-Letter Stagger"}</script>
+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Letter-by-Letter Stagger", "name": "Letter-by-Letter Stagger", "description": "A phrase appears letter by letter or typewriter-style. Best for short headlines.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/letter-by-letter-stagger/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Letter-by-Letter Stagger"}</script>
<style>
- :root{--ui-accent:#5fd88a;--dur:400ms;--ease:ease-out;--stagger:35ms;--hb-stage-h:auto;--hb-stage-h-phone:auto}
+ :root{--ui-accent:#5fd88a;--dur:400ms;--ease:ease-out;--stagger:35ms}
*,*::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);
- min-height:clamp(300px,calc(100vh - 420px),440px);min-height:clamp(300px,calc(100svh - 420px),440px)}
+ .stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0b0b0d;padding:clamp(20px,4vw,48px)}
#text-target{font-size:clamp(26px,5vw,56px);font-weight:bold;text-align:center;line-height:1.2;max-width:560px;word-break:break-word;position:relative}
/* cascade mode */
.char{display:inline-block}
@@ -40,11 +39,10 @@
.cursor{display:inline-block;width:3px;height:0.85em;background:var(--ui-accent);vertical-align:text-bottom;margin-left:2px;animation:blink 1s step-end infinite}
.cursor.hidden{display:none}
@keyframes blink{0%,50%{opacity:1}51%,100%{opacity:0}}
- @media(max-width:600px){.stage{min-height:300px}}
@media(prefers-reduced-motion:reduce){.char{transition:none!important;opacity:1!important;transform:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
@@ -55,7 +53,7 @@
<header class="hb-head">
<p class="hb-cat">02.08 · Entrance &amp; Exit</p>
<h1>Letter-by-Letter Stagger</h1>
- <p class="hb-lede">A phrase appears letter by letter, or is typed out. Best for short headlines.</p>
+ <p class="hb-lede">A phrase appears letter by letter or typewriter-style. Best for short headlines.</p>
</header>
<section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
@@ -63,7 +61,7 @@
<span class="hb-num" aria-hidden="true">1</span>
<div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to see each part of the movement.</p></div>
</div>
- <div class="stage hb-dots">
+ <div class="stage hb-dots hb-grow">
<div id="text-target" data-mode="cascade" data-anim="fade-up">Hello, world.</div>
</div>
<div class="hb-player">
diff --git a/animations/02-entrance-and-exit/rotate-in/README.md b/animations/02-entrance-and-exit/rotate-in/README.md
index 0afaedab..49944b9f 100644
--- a/animations/02-entrance-and-exit/rotate-in/README.md
+++ b/animations/02-entrance-and-exit/rotate-in/README.md
@@ -57,5 +57,5 @@ A negative starting angle spins clockwise into place and a positive one counter-
## See also
- [Flip In](../flip-in/) — swings in like a card turning over
-- [Scale In](../scale-in/) — grows from small, with no spin
+- [Scale In / Zoom In](../scale-in/) — grows from small, with no spin
- [Bounce In](../bounce-in/) — lands with a springy bounce
diff --git a/animations/02-entrance-and-exit/rotate-in/index.html b/animations/02-entrance-and-exit/rotate-in/index.html
index 4734c1d5..b0f8b560 100644
--- a/animations/02-entrance-and-exit/rotate-in/index.html
+++ b/animations/02-entrance-and-exit/rotate-in/index.html
@@ -31,8 +31,8 @@
.icon svg{width:100%;height:100%}
@media(prefers-reduced-motion:reduce){.icon{transition:opacity 300ms linear!important;transform:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/scale-in/index.html b/animations/02-entrance-and-exit/scale-in/index.html
index 08f11db3..037850d8 100644
--- a/animations/02-entrance-and-exit/scale-in/index.html
+++ b/animations/02-entrance-and-exit/scale-in/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Scale In / Zoom In", "name": "Scale In / Zoom In", "description": "Grows from smaller to full size. Best for pop-ups and menus.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/scale-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Scale In / Zoom In"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:500ms;--ease:cubic-bezier(.34,1.56,.64,1);--ss:0.8;--origin:center}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:500ms;--ease:cubic-bezier(.34,1.56,.64,1);--ss:0.8;--origin:center}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0b0b0d}
.card{background:linear-gradient(135deg,#161b22,#1a2030);border:1px solid #30363d;border-radius:16px;padding:clamp(28px,5vw,48px);text-align:center;width:clamp(220px,50%,280px);
@@ -33,8 +33,8 @@
.card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important;transform:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/slide-in/index.html b/animations/02-entrance-and-exit/slide-in/index.html
index d3190da4..0ca4610c 100644
--- a/animations/02-entrance-and-exit/slide-in/index.html
+++ b/animations/02-entrance-and-exit/slide-in/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Slide In", "name": "Slide In", "description": "Travels into place from one edge. Best for side panels and notifications.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Slide In"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:600ms;--ease:ease-out;--tx:0px;--ty:200px;--fade:0}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:600ms;--ease:ease-out;--tx:0px;--ty:200px;--fade:0}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d}
.card{background:#161b22;border:1px solid #30363d;border-radius:12px;padding:clamp(28px,5vw,48px);text-align:center;max-width:300px;
@@ -33,8 +33,8 @@
.card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
@media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/slide-up-reveal/README.md b/animations/02-entrance-and-exit/slide-up-reveal/README.md
index 8f1ccb7d..2a7331d8 100644
--- a/animations/02-entrance-and-exit/slide-up-reveal/README.md
+++ b/animations/02-entrance-and-exit/slide-up-reveal/README.md
@@ -41,7 +41,7 @@ Multiple lines stagger through a per-line `--d` index multiplied by a `--stagger
## Production notes
- **`translateY(110%)`, not `100%`.** The extra 10% covers descenders (g, y, p) and line-height slack so no sliver of the glyph peeks above the boundary before it moves.
-- **Pick the method by tradeoff.** `translateY` inside a wrapper composites slightly cheaper and animates more smoothly, but needs the extra `.line-wrap` element. `clip-path` needs no wrapper and keeps the text as a single selectable block, at a marginally higher paint cost — the demo notes both look identical to users.
+- **Pick the method by tradeoff.** `translateY` inside a wrapper composites slightly cheaper and animates more smoothly, but needs the extra `.line-wrap` element. `clip-path` needs no wrapper and keeps the text as a single selectable block, at a marginally higher paint cost. To users, both look the same.
- **Reduced motion:** the demo strips the transform and clip entirely under `prefers-reduced-motion`, falling back to a plain opacity fade so nothing slides.
- **Library equivalents:** GSAP's SplitText plugin plus a `y: '110%'` tween is the classic production recipe; Framer Motion animates `y` inside a `overflow-hidden` wrapper with `staggerChildren`; Motion One `animate` with a `delay` derived from index.
diff --git a/animations/02-entrance-and-exit/slide-up-reveal/index.html b/animations/02-entrance-and-exit/slide-up-reveal/index.html
index e57ecf90..2962e9c8 100644
--- a/animations/02-entrance-and-exit/slide-up-reveal/index.html
+++ b/animations/02-entrance-and-exit/slide-up-reveal/index.html
@@ -21,7 +21,7 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Slide Up Reveal", "name": "Slide Up Reveal", "description": "Text rises into view from behind an invisible edge. Best for headlines.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/slide-up-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Slide Up Reveal"}</script>
<style>
- :root{--ui-accent:#5fd88a;--ui-muted:#77777e;--dur:700ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:60ms}
+ :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:700ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:60ms}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
.stage{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;overflow:hidden;padding:clamp(20px,5vw,40px);background:#0b0b0d}
.line-wrap{overflow:hidden;line-height:1.15}
@@ -33,8 +33,8 @@
.sub-line{font-size:clamp(13px,2vw,16px);color:var(--ui-muted);text-align:center}
@media(prefers-reduced-motion:reduce){.line{opacity:0;transition:opacity 300ms linear!important;transform:none!important;clip-path:none!important} .line.in{opacity:1!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
diff --git a/animations/02-entrance-and-exit/split-text-reveal/index.html b/animations/02-entrance-and-exit/split-text-reveal/index.html
index ee7d9acb..e6ed5ed4 100644
--- a/animations/02-entrance-and-exit/split-text-reveal/index.html
+++ b/animations/02-entrance-and-exit/split-text-reveal/index.html
@@ -21,10 +21,9 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Split Text Reveal", "name": "Split Text Reveal", "description": "Text breaks into pieces that appear one after another. Best for headlines.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/split-text-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Split Text Reveal"}</script>
<style>
- :root{--ui-accent:#5fd88a;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:30ms;--hb-stage-h:auto;--hb-stage-h-phone:auto}
+ :root{--ui-accent:#5fd88a;--dur:500ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:30ms}
*,*::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);
- min-height:clamp(300px,calc(100vh - 420px),440px);min-height:clamp(300px,calc(100svh - 420px),440px)}
+ .stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0b0b0d;padding:clamp(20px,4vw,48px)}
#text-target{font-size:clamp(24px,4.5vw,48px);font-weight:bold;text-align:center;line-height:1.35;max-width:560px;word-break:break-word}
/* shared unit styles — animation-type overrides below */
.unit{display:inline-block;
@@ -44,11 +43,10 @@
/* word spacing */
[data-mode="words"] .unit{margin-right:0.28em}
[data-mode="chars"] .unit{margin-right:0.01em}
- @media(max-width:600px){.stage{min-height:300px}}
@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>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
@@ -67,7 +65,7 @@
<span class="hb-num" aria-hidden="true">1</span>
<div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to see each part of the movement.</p></div>
</div>
- <div class="stage hb-dots">
+ <div class="stage hb-dots hb-grow">
<div id="text-target" class="splitting" data-mode="words" data-anim="fade-up">Design beyond the obvious</div>
</div>
<div class="hb-player">
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.md
index 8352a5fc..09db833b 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
@@ -56,4 +56,4 @@ The Pauses between sentences switch adds `si × 200ms` to the delay for each sen
## See also
- [Letter-by-Letter Stagger](../letter-by-letter-stagger/) — one letter at a time, for short phrases
- [Split Text Reveal](../split-text-reveal/) — text breaks into letters, words or lines
-- [Fade In / Out](../fade-in-out/) — the whole text fades in at once
+- [Fade In / Fade Out](../fade-in-out/) — the whole text fades in at once
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.html
index 213600f4..1852c001 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
@@ -21,10 +21,9 @@
<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Word-by-Word Reveal", "name": "Word-by-Word Reveal", "description": "Words appear one after another at a reading pace. Best for quotes and intros.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/word-by-word-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Word-by-Word Reveal"}</script>
<style>
- :root{--ui-accent:#5fd88a;--dur:450ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:80ms;--hb-stage-h:auto;--hb-stage-h-phone:auto}
+ :root{--ui-accent:#5fd88a;--dur:450ms;--ease:cubic-bezier(.2,.7,.3,1);--stagger:80ms}
*,*::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);
- min-height:clamp(300px,calc(100vh - 420px),440px);min-height:clamp(300px,calc(100svh - 420px),440px)}
+ .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;
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))}
@@ -35,11 +34,10 @@
[data-anim="fade"] .word{transform:none}
.splitting.in .word{opacity:1;transform:none;filter:none}
.sent-break{display:block;height:0.4em}
- @media(max-width:600px){.stage{min-height:300px}}
@media(prefers-reduced-motion:reduce){.word{transition:opacity 300ms linear!important;transform:none!important;filter:none!important}}
</style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=2">
+ <script src="../../../assets/js/demo-page.js?v=2" defer></script>
</head>
<body class="hb" data-hb-kind="once" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
@@ -58,7 +56,7 @@
<span class="hb-num" aria-hidden="true">1</span>
<div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to see each part of the movement.</p></div>
</div>
- <div class="stage hb-dots">
+ <div class="stage hb-dots hb-grow">
<div id="text-target" class="splitting" data-anim="fade-up"></div>
</div>
<div class="hb-player">
diff --git a/assets/css/demo-page.css b/assets/css/demo-page.css
index feeca68e..7ef6a4cf 100644
--- a/assets/css/demo-page.css
+++ b/assets/css/demo-page.css
@@ -63,6 +63,8 @@ body.hb [hidden]{display:none!important}
(scroll demos scroll inside their stage). A demo that needs another height sets --hb-stage-h or --hb-stage-h-phone. */
:where(.hb-page .stage){min-height:0;overflow:hidden}
.hb-page .stage.hb-dots{background-image:radial-gradient(rgba(255,255,255,.075) 1px,transparent 1.5px);background-size:24px 24px;background-position:center}
+/* A stage whose text the visitor can change: at least the usual height, and taller when the text needs it */
+.hb-page .stage.hb-grow{height:auto;min-height:clamp(300px,calc(100vh - 420px),440px);min-height:clamp(300px,calc(100svh - 420px),440px)}
.hb-player{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.hb-play,.hb-toggle{box-sizing:border-box;display:inline-flex;align-items:center;gap:10px;min-height:44px;padding:0 18px;
border:1px solid rgba(255,255,255,.18);border-radius:8px;background:none;color:var(--hb-ink);font:500 15px/1 var(--hb-font);cursor:pointer}
@@ -109,7 +111,7 @@ body.hb [hidden]{display:none!important}
textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
.hb-page .swatches{display:flex;flex-wrap:wrap;gap:10px}
.hb-page .swatches button{box-sizing:border-box;width:44px;height:44px;padding:0;border:2px solid transparent;border-radius:50%;
- box-shadow:inset 0 0 0 1px rgba(255,255,255,.18);cursor:pointer}
+ box-shadow:inset 0 0 0 2px rgba(255,255,255,.45);cursor:pointer}
.hb-page .swatches button[aria-pressed="true"]{border-color:var(--hb-ink);box-shadow:inset 0 0 0 3px var(--hb-bg)}
/* Step 3: the prompt card */
@@ -181,6 +183,7 @@ textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
@media(max-width:600px){
.hb-bar .hb-dir{display:none}
.hb-page .stage{height:var(--hb-stage-h-phone,300px)}
+ .hb-page .stage.hb-grow{min-height:300px}
/* With both Previous and Next, phones show only the two chevrons; each link keeps its full name as its label */
.hb-pager:has(a + a) a > span{display:none}
.hb-step-head{gap:12px}
@@ -191,7 +194,7 @@ textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
.hb-player{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.hb-play,.hb-player-note{grid-column:1/-1}
.hb-play,.hb-toggle{justify-content:center;gap:8px;padding:0 12px;font-size:14px}
- .hb-page .seg button{flex:1 1 0;min-width:0;padding:0 8px}
+ .hb-page .seg button{flex:1 0 auto;padding:0 10px}
.hb-prompt{font-size:16px;line-height:1.6}
.hb-prompt.is-clamped{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
.hb-prompt-more{display:inline-flex;align-items:center}
diff --git a/assets/js/demo-page.js b/assets/js/demo-page.js
index 0e0e1ae9..38fb5197 100644
--- a/assets/js/demo-page.js
+++ b/assets/js/demo-page.js
@@ -101,6 +101,12 @@
return s.length > max ? s.slice(0, max - 1).trimEnd() + '…' : s;
}
+ // Typed text as a setting value: shortened as above, then wrapped in quotes ('' when there is no text).
+ function quoteText(text, max) {
+ var s = shorten(text, max);
+ return s ? '"' + s + '"' : '';
+ }
+
/* ---------- Page behaviour ---------- */
var CONTROLS = 'input[type=range], input[type=checkbox], input[type=text], textarea, select, .seg, .swatches';
@@ -126,7 +132,7 @@
var shown = setting && setting.querySelector('.hb-value');
return shown ? text(shown) : (control.getAttribute('aria-valuetext') || control.value);
}
- if (control.matches('input[type=text], textarea')) return shorten(control.value, 40);
+ if (control.matches('input[type=text], textarea')) return quoteText(control.value, 40);
if (control.matches('input[type=checkbox]')) return control.checked ? 'on' : 'off';
if (control.matches('select')) return control.selectedOptions[0] ? text(control.selectedOptions[0]) : control.value;
var active = control.querySelector('.on, [aria-pressed="true"]');
@@ -292,9 +298,11 @@
}
// Changing a setting updates the chips and replays the animation shortly after the last change.
+ // Text fields already replay on every input, so the change event they fire when left is ignored.
var replayTimer = 0;
function onSettingsChange(e) {
if (e.type === 'click' && !e.target.closest('.seg button, .swatches button')) return;
+ if (e.type === 'change' && e.target.matches('input[type=text], textarea')) return;
win.setTimeout(refreshChips, 0);
win.clearTimeout(replayTimer);
replayTimer = win.setTimeout(replay, 250);
@@ -352,6 +360,6 @@
return {
escapeHtml: escapeHtml, plain: plain, isSafeHref: isSafeHref, inline: inline, sections: sections,
paragraphs: paragraphs, seeAlso: seeAlso, settingsLine: settingsLine, markFill: markFill, shorten: shorten,
- readSettings: readSettings, boot: boot
+ quoteText: quoteText, readSettings: readSettings, boot: boot
};
});
diff --git a/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md b/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
index d01c83d1..2cdcfd57 100644
--- a/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
+++ b/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
@@ -63,8 +63,8 @@ The page owns the stage's width, border, corners and height; the demo owns every
- Height: `var(--hb-stage-h, clamp(300px, 100svh − 420px, 440px))` on computers and tablets,
`var(--hb-stage-h-phone, 300px)` on phones, with the short-screen rule from the pilot. A demo that needs a
- different height sets `--hb-stage-h` or `--hb-stage-h-phone` (for example `auto` with its own `min-height` when
- typed text has to fit).
+ different height sets `--hb-stage-h` or `--hb-stage-h-phone`. A stage whose text the visitor can change adds the
+ shared class `hb-grow`: at least the usual height, and taller when the text needs it.
- Overflow, background, alignment and perspective belong to the demo. The shared default `overflow: hidden` is
written with zero specificity (`:where(...)`), so a demo's own `.stage` rule wins. This keeps scroll demos (19 of
the 26 scroll inside `.stage`), Accordion, Pull to Refresh, Smooth Scroll's comparison mode and Flip In's
@@ -93,7 +93,7 @@ three main settings, playback is not a setting, no readouts). Each type of contr
| Slider | `label.hb-setting-name[for]`, the `input[type=range]`, and `output.hb-value[for]` showing the value in plain words or friendly units ("Slow", "0.6 s", "40%") | the `output.hb-value` text |
| Menu | `label.hb-setting-name[for]` and `select.hb-select` | the chosen option's text |
| Colour | `.swatches` of buttons with `aria-pressed` and a colour name as `aria-label` (colour pickers become named swatches) | the colour's name |
-| Text | `label.hb-setting-name[for]` and `input.hb-text` or `textarea.hb-text` | the text, cut to 40 characters |
+| Text | `label.hb-setting-name[for]` and `input.hb-text` or `textarea.hb-text` | the text in quotes, cut to 40 characters inside them |
Radio groups become choice buttons. When a control has no label of its own, the reader uses the `.hb-setting-name`
in the same `.hb-setting`. If a label or value still comes out empty, the shared script logs a console warning.
diff --git a/index.html b/index.html
index 693918b2..0370605e 100644
--- a/index.html
+++ b/index.html
@@ -919,7 +919,7 @@ const CATS=[
['clip-path-reveal','Clip-Path Reveal','A growing shape uncovers it while it stays still. Best for images and banners.'],
['curtain-reveal','Curtain Reveal','A colored panel covers it, then slides away. Best for intros and logos.'],
['split-text-reveal','Split Text Reveal','Text breaks into pieces that appear one after another. Best for headlines.'],
- ['letter-by-letter-stagger','Letter-by-Letter Stagger','A phrase appears letter by letter, or is typed out. Best for short headlines.'],
+ ['letter-by-letter-stagger','Letter-by-Letter Stagger','A phrase appears letter by letter or typewriter-style. Best for short headlines.'],
['word-by-word-reveal','Word-by-Word Reveal','Words appear one after another at a reading pace. Best for quotes and intros.'],
['blur-in','Blur In','Comes into focus from a blur, like a camera. Best for featured cards and photos.'],
['flip-in','Flip In','Swings into view in 3D, like a card turning over. Best for cards and tiles.'],
diff --git a/tests/demo-page.test.js b/tests/demo-page.test.js
index 74f59359..024e7df3 100644
--- a/tests/demo-page.test.js
+++ b/tests/demo-page.test.js
@@ -82,3 +82,12 @@ test('shorten squeezes whitespace and cuts long text with an ellipsis', () => {
assert.equal(DP.shorten('abc de', 5), 'abc…');
assert.equal(DP.shorten('', 5), '');
});
+
+test('quoteText wraps typed text in quotes and keeps the 40-character cut inside them', () => {
+ assert.equal(DP.quoteText('Hello, world.', 40), '"Hello, world."');
+ assert.equal(DP.quoteText('We build interfaces\nthat disappear.', 40), '"We build interfaces that disappear."');
+ const long = DP.quoteText('a'.repeat(50), 40);
+ assert.equal(long, '"' + 'a'.repeat(39) + '…"');
+ assert.equal(long.length, 42);
+ assert.equal(DP.quoteText(' \n ', 40), '');
+});
diff --git a/tests/pages.test.js b/tests/pages.test.js
index ba6bf665..fbf713f1 100644
--- a/tests/pages.test.js
+++ b/tests/pages.test.js
@@ -71,8 +71,9 @@ for (const d of converted) {
for (const d of steps) {
test(`${d.cat}/${d.slug} uses the guided-steps page correctly`, () => {
const html = pageOf(d);
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/demo-page.css">'), 'page stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/demo-page.js" defer></script>'), 'page script');
+ // The shared files carry a version so visitors do not get a cached older copy after publishing.
+ assert.match(html, /<link rel="stylesheet" href="\.\.\/\.\.\/\.\.\/assets\/css\/demo-page\.css\?v=\d+">/, 'page stylesheet');
+ assert.match(html, /<script src="\.\.\/\.\.\/\.\.\/assets\/js\/demo-page\.js\?v=\d+" defer><\/script>/, 'page script');
const body = html.match(/<body class="hb" data-hb-kind="(once|loop|scroll|do)"( data-hb-autoplay)?>/);
assert.ok(body, 'the body declares the page kind');
const kind = body[1];