@omicrxn/mercury
Version:
Mercury is a Svelte animation library using AnimeJS under the hood. It simplifies complex animations with Svelte actions, provides layout and exit animations, and integrates seamlessly with Svelte features.
16 lines (15 loc) • 499 B
JavaScript
import { MotionEngine } from './adapters/index.js';
import { handleGestures } from './gestures/index.js';
export const mercury = (options) => {
const engine = options?.engine ?? MotionEngine;
return (element) => {
if (options) {
let animation = engine.animate(element, options);
options.instance?.(animation);
}
let cleanupGestures = handleGestures(element, options);
return () => {
cleanupGestures();
};
};
};