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: growing stages get the 260px short-window minimum, and FLIP Technique gets smaller cards there so its player bar is on the first screen

matind5bb6ce6c5c3
diff --git a/animations/03-page-transitions/flip-technique/index.html b/animations/03-page-transitions/flip-technique/index.html
index c79d081a..540f046b 100644
--- a/animations/03-page-transitions/flip-technique/index.html
+++ b/animations/03-page-transitions/flip-technique/index.html
@@ -36,6 +36,17 @@
#card-grid{--rows-h:230px;display:grid;gap:10px;transition:none;min-height:var(--rows-h);align-content:start}
#card-grid[data-columns="2"]{--rows-h:350px}
.flip-card{border-radius:8px;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;padding:14px;cursor:default;will-change:transform;position:relative}
+ .flip-card.is-small{height:86px}
+ .flip-card.is-large{height:110px}
+ #card-grid[data-columns="1"] .flip-card{height:56px}
+ /* A laptop window under 651px tall: smaller cards keep the player bar on the first screen. The grid is 162px in three
+ columns and 248px in two, the same sums as above with 76px and 60px cards. */
+ @media(min-width:601px) and (max-height:650px){
+ #card-grid{--rows-h:162px}
+ #card-grid[data-columns="2"]{--rows-h:248px}
+ .flip-card.is-small{height:60px}
+ .flip-card.is-large{height:76px}
+ }
.card-num{font-size:32px;font-weight:bold;opacity:.15;line-height:1;position:absolute;top:10px;right:12px}
.card-name{font-size:12px;font-weight:bold;margin-bottom:2px}
.card-meta{font-size:10px;opacity:.8}
@@ -181,8 +192,8 @@
grid.dataset.columns=cols;
grid.style.gridTemplateColumns=`repeat(${cols},1fr)`;
order.forEach(i=>{
- const c=CARDS[i],el=document.createElement('div');el.className='flip-card';el.id='fc'+i;
- el.style.cssText=`background:${c.bg};height:${cols===1?'56px':(c.h===2?'110px':'86px')}`;
+ const c=CARDS[i],el=document.createElement('div');el.className='flip-card '+(c.h===2?'is-large':'is-small');el.id='fc'+i;
+ el.style.background=c.bg;
el.innerHTML=`<div class="card-num" aria-hidden="true">${String(i+1).padStart(2,'0')}</div><div class="card-name">${c.name}</div><div class="card-meta">${c.meta}</div>`;
grid.appendChild(el);
});
diff --git a/assets/css/demo-page.css b/assets/css/demo-page.css
index 88df6080..5eef16c8 100644
--- a/assets/css/demo-page.css
+++ b/assets/css/demo-page.css
@@ -211,6 +211,8 @@ textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
.hb-step-head h2{font-size:22px}
.hb-watch{gap:12px}
.hb-page .stage{height:var(--hb-stage-h,clamp(260px,calc(100vh - 330px),440px));height:var(--hb-stage-h,clamp(260px,calc(100svh - 330px),440px))}
+ /* A stage that grows with its text gets the same shorter minimum */
+ .hb-page .stage.hb-grow{min-height:clamp(260px,calc(100vh - 330px),440px);min-height:clamp(260px,calc(100svh - 330px),440px)}
}
@media(max-width:600px){
.hb-page .stage{height:var(--hb-stage-h-phone,300px)}
diff --git a/tests/pages.test.js b/tests/pages.test.js
index b0c575cf..392e5661 100644
--- a/tests/pages.test.js
+++ b/tests/pages.test.js
@@ -390,6 +390,16 @@ test('the shared stylesheet turns CSS scroll snapping off on a box that Play is
'a box marked data-hb-autoscrolling has scroll-snap-type: none !important');
});
+test('the shared stylesheet gives a stage that grows with its text the same 260px short-window minimum as the other stages', () => {
+ // On a short laptop window a tighter header lets a stage be 260px tall. A stage that grows with its text needs the same
+ // minimum, or it stays at 300px and pushes the player bar off the first screen.
+ for (const unit of ['vh', 'svh']) {
+ const minimum = `clamp(260px,calc(100${unit} - 330px),440px)`;
+ assert.ok(rulesFor('.hb-page .stage').some(rule => rule.body.includes(`height:var(--hb-stage-h,${minimum})`)), `a stage is ${minimum} tall on a short window`);
+ assert.ok(rulesFor('.hb-page .stage.hb-grow').some(rule => rule.body.includes(`min-height:${minimum}`)), `a growing stage is at least ${minimum} tall on a short window`);
+ }
+});
+
test('the shared stylesheet keeps choice buttons at least 44px wide', () => {
assert.ok(rulesFor('.hb-page .seg button').some(rule => /(^|;)\s*min-width:\s*44px\s*(;|$)/.test(rule.body)), 'a choice button is at least 44px wide');
});