UNPKG

@humanspeak/svelte-motion

Version:

Framer Motion for Svelte 5. Declarative motion.<tag> components with AnimatePresence exit animations, gestures (hover, tap, drag, focus, in-view), variants, FLIP layout animations, shared-layout transitions, spring physics, and scroll-linked motion values

20 lines (19 loc) 573 B
import { getContext, setContext } from 'svelte'; const key = Symbol('lazyMotion'); /** * Reads the nearest LazyMotion context. * * @returns The active LazyMotion context, or undefined outside LazyMotion. */ export const getLazyMotionContext = () => { return getContext(key); }; /** * Publishes a LazyMotion context for descendant motion elements. * * @param context - LazyMotion context to publish. * @returns The same context value returned by Svelte's setContext. */ export const setLazyMotionContext = (context) => { return setContext(key, context); };