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: let keyboard Show me and Reset leave 3D Flip Card's hover state clean, and show its reduced-motion swap from the back
matinf705a5f9a0b1
diff --git a/animations/06-3d-advanced/flip-card-3d/README.md b/animations/06-3d-advanced/flip-card-3d/README.mdindex c9db0129..5e042e8c 100644--- a/animations/06-3d-advanced/flip-card-3d/README.md+++ b/animations/06-3d-advanced/flip-card-3d/README.md@@ -62,7 +62,7 @@ stage.addEventListener('pointermove', e => {- **Backface-visibility support**: both faces must be absolutely positioned and stacked, and the inner element must have `preserve-3d`. If `preserve-3d` is missing (or a property like `overflow` or `filter` flattens the context), both faces render and the back bleeds through.- **Safari flicker**: WebKit can flash the hidden face mid-rotation. Add `-webkit-backface-visibility: hidden` and nudge each face with `transform: translateZ(0)` (or `translateZ(1px)`) to force a stable compositing layer. Avoid `overflow`/`filter` on the `preserve-3d` element, as they can collapse the 3D context.- **Accessibility**: the flip must be keyboard-triggerable — make the card focusable (`tabindex="0"`, `role="button"`) and flip on Enter/Space, with a visible focus ring. Because `backface-visibility: hidden` only hides visuals, the back face's text stays in the accessibility tree and is reachable; expose state with `aria-pressed`. Do not hide the reverse content behind hover alone.-- **Reduced motion**: under `prefers-reduced-motion: reduce`, drop the rotation and the tilt entirely and swap faces with an instant opacity change instead, so the information is still available without vestibular-triggering movement.+- **Reduced motion**: under `prefers-reduced-motion: reduce`, drop the rotation and the tilt entirely and swap faces with a quick opacity fade instead (the demo's takes 120ms), so the information is still available without vestibular-triggering movement.- **Libraries**: Framer Motion animates this with `rotateY` on a motion component and `AnimatePresence` for the face swap; GSAP handles it with `rotationY` plus `transformPerspective`/`transformStyle`. The vanilla CSS version above needs no dependency for the common case.## See alsodiff --git a/animations/06-3d-advanced/flip-card-3d/index.html b/animations/06-3d-advanced/flip-card-3d/index.htmlindex 103baac8..922cb434 100644--- a/animations/06-3d-advanced/flip-card-3d/index.html+++ b/animations/06-3d-advanced/flip-card-3d/index.html@@ -237,16 +237,18 @@function stopRun(){clearTimeout(runTimer);runTimer=0;}function toFront(){if(!card.classList.contains('flipped'))return;- card.style.setProperty('transition','none','important');+ // The card turns by its own transition, and under reduced motion the faces fade instead: hold both for this one change+ const held=[card,...card.querySelectorAll('.face')];+ held.forEach(el=>el.style.setProperty('transition','none','important'));setFlipped(false);void card.offsetWidth;- card.style.removeProperty('transition');+ held.forEach(el=>el.style.removeProperty('transition'));}document.getElementById('btn-demo').addEventListener('click',()=>{- stopRun();toFront();setFlipped(true);+ stopRun();hovering=false;toFront();setFlipped(true);runTimer=setTimeout(()=>{runTimer=0;setFlipped(false);},flipMs*(slowTog.checked?3:1)+1200);});document.getElementById('btn-reset').addEventListener('click',()=>{- stopRun();setFlipped(false);tilt.style.transform=FLAT;+ stopRun();hovering=false;setFlipped(false);tilt.style.transform=FLAT;});// The visitor pressed, typed, scrolled or touched inside the stage: only a run that is under way stops, and the card stays// as it is. The click, tap or key that comes with it then turns the card as usual.diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.mdindex 1072f7e9..7b5b81f0 100644--- a/docs/superpowers/plans/2026-09-29-3d-content.md+++ b/docs/superpowers/plans/2026-09-29-3d-content.md@@ -1476,12 +1476,12 @@ None: leave out the `details.hb-options` block.- **Description:** A card turns over in 3D to show its back. Best for profile and product cards.- **Step 1:** Click it — "Click or tap the card to turn it over, or press Show me."- **Player bar:** Show me · Reset · Slow motion (css)-- **Show me:** one click's worth, about 2.5 seconds at Normal: `setFlipped(true)` at once; after Speed + 1200ms (Speed × 3 + 1200ms while Slow motion is on), `setFlipped(false)`. It ends on the front. A second press clears the pending timer and starts again.+- **Show me:** one click's worth, about 2.5 seconds at Normal: `setFlipped(true)` at once; after Speed + 1200ms (Speed × 3 + 1200ms while Slow motion is on), `setFlipped(false)`. It ends on the front. A second press clears the pending timer and starts again. A run starts from the front: a card that shows its back is put on the front without turning or fading (`toFront()` holds the transitions of the card and of its faces for that one change, so under reduced motion the swap to the back that follows is seen). With Flips on hover, Show me sets `hovering` false, so a pointer that is resting on the card (a keyboard press) turns the card again at its next move.- **Stopping a run:** on `hb:input`, only if a run is under way (its timer is pending): clear the timer, leaving the card as it is; otherwise do nothing. The visitor's click, tap or key then turns it as usual.-- **Reset:** stops a run, calls `setFlipped(false)` and sets the tilt flat (`tilt.style.transform='rotateX(0deg) rotateY(0deg)'`).+- **Reset:** stops a run, sets `hovering` false (as Show me does), calls `setFlipped(false)` and sets the tilt flat (`tilt.style.transform='rotateX(0deg) rotateY(0deg)'`).- **Sequence:** as today. A click, a tap, Enter or Space turns the card over; with Flips on hover, pointing turns it and leaving turns it back, and a tap still turns it on touch screens. While idle under a hovering pointer, the card leans toward it (Tilt toward the pointer). The "Flip card" button goes: Show me demonstrates the flip, and the card itself is the control.- **Slow motion:** css: the flip and the tilt's return run at a third of their speed, and Show me's wait uses Speed × 3 while the switch is on.-- **Reduced motion:** Show me does not run on arrival. The demo's reduced-motion rules stay: the faces swap with a 120ms fade instead of turning, and the tilt is off. Show me, clicks and taps still swap the faces.+- **Reduced motion:** Show me does not run on arrival. The demo's reduced-motion rules stay: the faces swap with a 120ms fade instead of turning, and the tilt is off. Show me, clicks and taps still swap the faces. Show me pressed while the card shows its back puts it on the front at once, then fades to the back, so the swap is seen before the card fades back to the front.- **Stage font:** site font. `.avatar` and `.front .name` drop `var(--disp)` (their weights 800 and 700 stay). `.front .hint` and `.back .hint` get 11px and `rgba(255,255,255,.6)` (were 9px at .4); `.back .over` gets 11px and `font-weight:600` (was 9px).- **Stage:**- The card only, directly in the stage; the `.stage-wrap` wrapper goes.