UNPKG

framer-motion-3d

Version:

A simple and powerful React animation library for @react-three/fiber

20 lines (18 loc) 776 B
function useHover(isStatic, { whileHover, onHoverStart, onHoverEnd, onPointerOver, onPointerOut, }, visualElement) { const isHoverEnabled = whileHover || onHoverStart || onHoverEnd; if (isStatic || !visualElement || !isHoverEnabled) return {}; return { onPointerOver: (event) => { var _a; (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive("whileHover", true); onPointerOver && onPointerOver(event); }, onPointerOut: (event) => { var _a; (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive("whileHover", false); onPointerOut && onPointerOut(event); }, }; } export { useHover };