UNPKG

@omicrxn/mercury

Version:

Mercury is a Svelte animation library powered by Motion. It simplifies complex animations with Svelte actions, provides layout and exit animations, and integrates seamlessly with Svelte features.

27 lines (26 loc) 1.31 kB
import type { AnimationOptions } from 'motion'; import type { AnimationCallbacks, AnimationTransition } from './animation-interface.js'; /** * Maps Mercury's transition + callbacks onto Motion's `animate()` options. * * Undefined fields are stripped before returning. This matters for springs: * Motion only uses a duration-based spring (`duration`/`bounce`) when no physics * options (`stiffness`/`damping`/`mass`) are present — it overrides `duration` * and `bounce` the moment any physics option is set. The previous mapper injected * `stiffness`/`damping`/`mass` defaults unconditionally, which forced every spring * into physics mode and silently discarded `duration`/`bounce`. */ export declare const mapTransitionToMotion: (mercuryTransition?: AnimationTransition, callbacks?: AnimationCallbacks) => AnimationOptions; export declare const mapTransitionToAnimeJS: (mercuryTransition?: AnimationTransition, callbacks?: AnimationCallbacks) => { duration: number; autoplay: boolean | undefined; delay: number; loop: number | undefined; alternate: boolean; reversed: boolean; loopDelay: number; onBegin: (() => void) | undefined; onComplete: (() => void) | undefined; onUpdate: ((latest: any) => void) | undefined; onLoop: (() => void) | undefined; };