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: Card Deck Swipe re-review notes: See inside says fade under reduced motion, Undo after a one-card run's throw brings the card back, the stamps are fully strong halfway to the line so the views' rest poses reach 4.5:1
matin8efa54fedc3d
diff --git a/animations/04-micro-interactions/card-deck-swipe/README.md b/animations/04-micro-interactions/card-deck-swipe/README.mdindex c1045008..5b80b7f1 100644--- a/animations/04-micro-interactions/card-deck-swipe/README.md+++ b/animations/04-micro-interactions/card-deck-swipe/README.md@@ -23,7 +23,7 @@ While it is dragged, the top card's transform follows the pointer and turns in p```jscard.style.transform = `translate(${dx}px, ${dy}px) rotate(${dx / cardWidth * turn}deg)`;-like.style.opacity = Math.min(1, Math.max(0, dx / (threshold * cardWidth)));+like.style.opacity = Math.min(1, Math.max(0, dx / (threshold * cardWidth / 2)));```On release, a card whose middle went past the swipe distance, or that was flicked away from the middle faster than half a pixel per millisecond, gets a transition and is moved off that side; otherwise it springs back with an overshooting curve. The next card's depth becomes 0, so its own transition grows it into place, and the card that left is removed once its transition ends. Undo puts the last card back on top where it left and lets the transition bring it in. Nope, Like and Undo are real buttons, the Left and Right keys work on the focused top card, and each choice is also written into a polite status line for screen readers. Under reduced motion, cards fade instead of flying.@@ -33,7 +33,7 @@ On release, a card whose middle went past the swipe distance, or that was flicke|-----------|---------|--------|| How far to swipe | Medium | How far the card's middle must go before letting go sends it: short is a quarter of the card's width, medium 40% and long 60%; a quick flick sends it from anywhere || How much it turns | A little | How far the card turns for each card width of drag, around a point below its bottom edge: none does not turn, a little turns 14 degrees and a lot 30 degrees |-| Shows stamps | on | Like in green and Nope in red fade in on the card as it is dragged, fully shown at the swipe distance |+| Shows stamps | on | Like in green and Nope in red fade in on the card as it is dragged, fully shown halfway to the swipe distance || Cards behind | Peeking | How the waiting cards show: peeking sets each one a little lower and 5% smaller, fanned turns them left and right in turn, 5 degrees more and 3% smaller for each card further back, around the same low point, hidden shows only the top card until the next one grows in |## Production notesdiff --git a/animations/04-micro-interactions/card-deck-swipe/index.html b/animations/04-micro-interactions/card-deck-swipe/index.htmlindex d209b657..e7b3b69f 100644--- a/animations/04-micro-interactions/card-deck-swipe/index.html+++ b/animations/04-micro-interactions/card-deck-swipe/index.html@@ -226,9 +226,10 @@// The words follow the settings and reduced motion: with None the card stays upright, so See inside has no pivot to name;// under reduced motion the right card fades where it is instead of flying offconst said={inside:document.querySelector('[data-hb-for="inside"]').textContent,compare:document.querySelector('[data-hb-for="compare"]').textContent};- if(reduceMQ.matches){document.querySelector('.cap.second').textContent='Fades out';LABELS.compare='Profile cards: this pile fades out when let go, and a copy beside it vanishes'}+ if(reduceMQ.matches){document.querySelector('.cap.second').textContent='Fades out';document.getElementById('c-go').textContent='Let go past here: it fades';LABELS.compare='Profile cards: this pile fades out when let go, and a copy beside it vanishes'}function notes(){- document.querySelector('[data-hb-for="inside"]').textContent=turn?said.inside:'Inside, the pile is spread apart and numbered: each waiting card is smaller. With no turn set, the top card stays upright, and a dashed line lights once it is far enough to fly.';+ const verb=reduceMQ.matches?'fade':'fly';+ document.querySelector('[data-hb-for="inside"]').textContent=turn?said.inside.replace('to fly.','to '+verb+'.'):'Inside, the pile is spread apart and numbered: each waiting card is smaller. With no turn set, the top card stays upright, and a dashed line lights once it is far enough to '+verb+'.';document.querySelector('[data-hb-for="compare"]').textContent=reduceMQ.matches?'On the left the card vanishes the moment you let go. On the right, with reduced motion on, it fades out where it is and the next one appears in its place.':said.compare;LABELS.inside='Profile cards spread apart and numbered, with dashed lines at the swipe distance'+(turn?' and the point the top card turns around':'');if(mode==='inside')pileEl.setAttribute('aria-label',LABELS.inside);@@ -274,7 +275,7 @@dx=x;const c=topOf(real),s=thr*cardW,t=twin&&topOf(twin);if(c){c.style.transform=x||y?`translate(${x}px,${y}px) rotate(${cardW?x/cardW*turn:0}deg)`:'';- c.querySelector('.like').style.opacity=stamps?clamp01(x/s):0;c.querySelector('.nope').style.opacity=stamps?clamp01(-x/s):0;+ c.querySelector('.like').style.opacity=stamps?clamp01(x/(s/2)):0;c.querySelector('.nope').style.opacity=stamps?clamp01(-x/(s/2)):0;}if(t)t.style.transform=x?`translateX(${x}px)`:'';gr.classList.toggle('lit',x>s);gl.classList.toggle('lit',-x>s);@@ -351,7 +352,7 @@});document.getElementById('btn-nope').addEventListener('click',()=>{stopRun();send(-1)});document.getElementById('btn-like').addEventListener('click',()=>{stopRun();send(1)});- document.getElementById('btn-undo').addEventListener('click',()=>{stopRun();undo()});+ document.getElementById('btn-undo').addEventListener('click',()=>{if(thrown&&!live(real).length)thrown=false;stopRun();undo()}); // not a refill: Undo brings the last card back// Show me: a drag that springs back, a throw to the left, then Undo. Its drags move the card the way a finger would, by the// time that passes; every pause waits on a timer, and slow motion triples the moves, never the pauses.diff --git a/sitemap.xml b/sitemap.xmlindex e01805de..e968ca97 100644--- a/sitemap.xml+++ b/sitemap.xml@@ -104,7 +104,7 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>- <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/</loc><lastmod>2026-10-17</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/kinetic-typography/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/typewriter-effect/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/scramble-text/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>diff --git a/skills/animation-handbook/references/04-micro-interactions.md b/skills/animation-handbook/references/04-micro-interactions.mdindex 3b9c52bc..f3a9a521 100644--- a/skills/animation-handbook/references/04-micro-interactions.md+++ b/skills/animation-handbook/references/04-micro-interactions.md@@ -911,5 +911,5 @@ Add a swipeable card deck to [your stack of cards, such as profiles or products]- How far to swipe: Short · **Medium** · Long. How far the card's middle must go before letting go sends it: short is a quarter of the card's width, medium 40% and long 60%; a quick flick sends it from anywhere.- How much it turns: None · **A little** · A lot. How far the card turns for each card width of drag, around a point below its bottom edge: none does not turn, a little turns 14 degrees and a lot 30 degrees.-- Shows stamps: **on** · off. Like in green and Nope in red fade in on the card as it is dragged, fully shown at the swipe distance.+- Shows stamps: **on** · off. Like in green and Nope in red fade in on the card as it is dragged, fully shown halfway to the swipe distance.- Cards behind: **Peeking** · Fanned · Hidden. How the waiting cards show: peeking sets each one a little lower and 5% smaller, fanned turns them left and right in turn, 5 degrees more and 3% smaller for each card further back, around the same low point, hidden shows only the top card until the next one grows in.