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 every mouse swipe close the Drawer, not only the first
matin6665610913e6
diff --git a/animations/04-micro-interactions/drawer-slide/README.md b/animations/04-micro-interactions/drawer-slide/README.mdindex 10700c1f..b1219c08 100644--- a/animations/04-micro-interactions/drawer-slide/README.md+++ b/animations/04-micro-interactions/drawer-slide/README.md@@ -89,7 +89,7 @@ drawer.addEventListener('pointerup', e => { if (e.clientX - dragStartX < -50)- **`aria-modal="true"` and `role="dialog"`**: required for screen readers to announce the drawer as a modal context. Add `aria-label` or `aria-labelledby` for the drawer title.- **`will-change: transform`**: promotes the drawer to its own compositing layer, preventing paint during the slide. Remove `will-change` after the animation completes if memory is a concern on low-end devices.- **Right/bottom drawers**: for filters, slides from right (`translateX(100%)`); for action sheets, slides from bottom (`translateY(100%)`).-- **Swipe-to-close on touch**: use `pointerdown`/`pointermove`/`pointerup` (not mouse/touch events separately). Measure the delta and close if the swipe distance exceeds ~50px in the close direction.+- **Swipe-to-close on touch**: use `pointerdown`/`pointermove`/`pointerup` (not mouse/touch events separately). Measure the delta and close if the swipe distance exceeds ~50px in the close direction. With a mouse, give the drawer `user-select: none`, or the first drag selects its text and the next one becomes a native text drag.- **Radix UI Sheet / shadcn Drawer**: fully accessible, animated drawer components. Vaul (Emil Kowalski) adds native mobile-style drag-to-dismiss for bottom drawers.## See alsodiff --git a/animations/04-micro-interactions/drawer-slide/index.html b/animations/04-micro-interactions/drawer-slide/index.htmlindex dac22d02..2f6c01a5 100644--- a/animations/04-micro-interactions/drawer-slide/index.html+++ b/animations/04-micro-interactions/drawer-slide/index.html@@ -36,8 +36,8 @@/* Backdrop */.backdrop{position:absolute;inset:0;background:rgba(0,0,0,var(--backdrop-op));opacity:0;transition:opacity var(--close-dur) var(--close-ease);pointer-events:none;z-index:5}.backdrop.visible{opacity:1;pointer-events:auto;transition:opacity var(--open-dur) var(--open-ease)}- /* Drawer */- .drawer{position:absolute;top:0;left:0;bottom:0;width:var(--drawer-w);background:var(--ui-bg);border-right:1px solid var(--ui-border);z-index:10;display:flex;flex-direction:column;transform:translateX(-100%);transition:transform var(--close-dur) var(--close-ease);will-change:transform;overflow:hidden;touch-action:pan-y}+ /* Drawer. No text selection: a mouse swipe would select the list's words, and the next swipe would become a native text drag and fail. */+ .drawer{position:absolute;top:0;left:0;bottom:0;width:var(--drawer-w);background:var(--ui-bg);border-right:1px solid var(--ui-border);z-index:10;display:flex;flex-direction:column;transform:translateX(-100%);transition:transform var(--close-dur) var(--close-ease);will-change:transform;overflow:hidden;touch-action:pan-y;-webkit-user-select:none;user-select:none}.drawer.right{left:auto;right:0;border-right:none;border-left:1px solid var(--ui-border);transform:translateX(100%)}.drawer.top{width:auto;left:0;right:0;top:0;bottom:auto;height:200px;transform:translateY(-100%);touch-action:pan-x}.drawer.bottom{width:auto;left:0;right:0;top:auto;bottom:0;height:200px;transform:translateY(100%);touch-action:pan-x}diff --git a/docs/superpowers/plans/2026-09-29-micro-content-part2.md b/docs/superpowers/plans/2026-09-29-micro-content-part2.mdindex 5b150956..d8a3cb63 100644--- a/docs/superpowers/plans/2026-09-29-micro-content-part2.md+++ b/docs/superpowers/plans/2026-09-29-micro-content-part2.md@@ -159,6 +159,7 @@ Every fit number in this sheet was measured in Chrome on the lane server, with e- **Slow motion:** css. The slide is the run's movement (Opening speed); the 1500ms is a hold. A slowed run takes about 3 s.- **Reduced motion:** the demo's rule stays: the drawer and the dimming appear and disappear without sliding or fading.- **Touch:** the swipe to close already uses Pointer Events (`pointerdown` on the drawer, `pointerup` on the document, 50px toward its edge).+- **Mouse swipe:** the drawer has `user-select:none` (with the `-webkit-` prefix). Without it, the first mouse swipe selects the words it starts on, and the next swipe begins on selected text, which the browser turns into a native text drag: no `pointerup` arrives and the drawer stays open, although the help line promises "or a swipe". With it, every mouse swipe closes the drawer, on every side.- **Stage font:** site font. `.hamburger` gets `font-family:inherit` (was `monospace`), and so does `.close-btn`. The ☰ comes from the system's fallback font, as it does today.- **Stage:** the small app screen stays: the header with the menu button and "Atlas App", the gray content lines, the dimming layer and the drawer.- The State readout goes.@@ -212,7 +213,7 @@ Every fit number in this sheet was measured in Chrome on the lane server, with e- [Accordion Open/Close](../accordion/) — sections that open in place instead of over the page- [Tooltip Reveal](../tooltip-reveal/) — a small label for a short explanation- **README How it works:** in the JS snippet, `open()` also does `drawer.inert = false;` and `close()` does `drawer.inert = true;`, with the comment `// a closed drawer cannot be reached with Tab`. The rest is unchanged.-- **README Production notes:** unchanged+- **README Production notes:** the "Swipe-to-close on touch" bullet gets one more sentence: "With a mouse, give the drawer `user-select: none`, or the first drag selects its text and the next one becomes a native text drag." The rest is unchanged.- **Category line:** `04.17 · Micro-Interactions`- **Pager:** Previous: Tooltip Reveal (`../tooltip-reveal/`) · Next: Modal Expand (`../modal-expand/`)