UNPKG

avent-ui

Version:

The best UI library for Typescript and React

26 lines (23 loc) 1.04 kB
import { jsx } from 'react/jsx-runtime'; import { forwardRef } from 'react'; import { motion } from 'framer-motion'; const initialPath = `M100 0 L100 ${window.innerHeight} Q-100 ${window.innerHeight / 2} 100 0`; const targetPath = `M100 0 L100 ${window.innerHeight} Q100 ${window.innerHeight / 2} 100 0`; const pathAnimation = { initial: { d: initialPath }, enter: { d: targetPath, transition: { duration: 1, ease: [0.76, 0, 0.24, 1] } }, exit: { d: initialPath, transition: { duration: 1, ease: [0.76, 0, 0.24, 1] } } }; const HamMenuCurve = forwardRef(({ className, style, ...otherProps }, ref) => { return (jsx("svg", { ref: ref, className: `absolute top-0 left-[-99px] w-[100px] h-screen stroke-none`, children: jsx(motion.path, { style: style, initial: 'initial', variants: pathAnimation, animate: 'enter', exit: "exit", className: `h-screen ${className || ''}`, d: initialPath }) })); }); export { HamMenuCurve as default }; //# sourceMappingURL=hammenu-curve.js.map