FIG-001/ LAZY

load features around m.

Wrap m.* components in LazyMotion and pass a feature bundle. The element still animates on mount, while gesture support comes from the selected bundle.

  • LazyMotion provides the active feature bundle through context. Descendant m.* elements read that context before attaching gesture, drag, or layout behavior.
  • domAnimation is the usual interactive bundle: mount/update animations plus hover, tap, focus, pan, and in-view gestures.
↩ all examples
bundle · domAnimation mode · live running source
// lazy motion features: domAnimation
lazy-loaded feature bundle
category · lazy
sheet · sheet 01 / 04
⟳ to re-run
FIG-002/ BUNDLES

compare domMin/domAnimation/domMax.

domMin keeps animation only, domAnimation enables gestures, and domMax adds drag/layout behavior for the subtree.

  • The same m.div receives different runtime capabilities depending on the nearest LazyMotion provider.
  • Try hover/tap across all three cards. Drag is intentionally available only under domMax.
↩ all examples
split · min / animation / max mode · live running source
// domMin animation only
domMin
// domAnimation gestures enabled
domAnimation
// domMax gestures + drag + layout
domMax
category · bundles
sheet · sheet 02 / 04
⟳ to re-run
FIG-003/ REORDER

reorder from the m entry.

Import Reorder from @humanspeak/svelte-motion/m and it renders m components, so it takes drag and layout from <LazyMotion features={domMax} strict> without tripping strict mode.

  • The main Reorder renders motion components, which always have every feature. Inside <LazyMotion strict> it warns once in development and points here.
  • Reordering needs drag and layout, so give the m entry's Reorder the domMax bundle.
↩ all examples
entry · @humanspeak/svelte-motion/m mode · live running source
  • Tomato
  • Cucumber
  • Cheese
  • Lettuce
category · reorder
sheet · sheet 03 / 04
⟳ to re-run
FIG-004/ ASYNC

wait for the bundle.

An m with no LazyMotion features renders its initial and does nothing else, as in Motion. Give LazyMotion an async loader and its m components animate in from initial once the bundle arrives.

  • The bare m.div has no LazyMotion above it, so it has no animation runtime: it stays at its initial and ignores hover.
  • The async card renders initial while its loader is pending. Press "Load features" and it animates in from there, then responds to hover.
↩ all examples
features · () => import(...) mode · live running source
// no LazyMotion stays at initial
bare m
// async features waiting for the bundle
async m
category · async
sheet · sheet 04 / 04
⟳ to re-run

LazyMotion