{"version":3,"file":"MouseParallax.CgfdNF2z.mjs","names":["useRef","useContext"],"sources":["https:/framerusercontent.com/modules/wdzqOCbUp8yRhm0nqg75/M08ZrZsgkCAEGN2hYUOY/MouseParallax.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{createContext,useContext,useRef}from\"react\";import{motion,useMotionValue,useTransform,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const absoluteFill={position:\"absolute\",top:0,right:0,bottom:0,left:0};const ParallaxContext=/*#__PURE__*/createContext(null);export function withContainer(Component){return props=>{var _ref_current;const x=useMotionValue(0);const y=useMotionValue(0);const ref=useRef();const rect=(_ref_current=ref.current)===null||_ref_current===void 0?void 0:_ref_current.getBoundingClientRect();const handleMouseMove=e=>{if(!rect)return;const{clientX,clientY,target}=e;// Mouse position\nconst xx=(clientX-rect.left)/rect.width;const yy=(clientY-rect.top)/rect.height;x.set(xx);y.set(yy);};return /*#__PURE__*/_jsx(ParallaxContext.Provider,{value:{x,y},children:/*#__PURE__*/_jsx(Component,{...props,onMouseMove:handleMouseMove,ref:ref})});};}const useHoverParallax=({level})=>{const mouse=useContext(ParallaxContext);if(!mouse)return{x:null,y:null};const x=useSpring(useTransform(mouse.x,[0,.01,1],[0,-level,level]));const y=useSpring(useTransform(mouse.y,[0,.01,1],[0,-level,level]));return{x,y};};export function withHover3(Component){return props=>{const{x,y}=useHoverParallax({level:3});return /*#__PURE__*/_jsx(Component,{...props,style:{x,y,...props.style?props.style:{}}});};}export function withHover5(Component){return props=>{const{x,y}=useHoverParallax({level:5});return /*#__PURE__*/_jsx(Component,{...props,style:{x,y,...props.style?props.style:{}}});};}export function withHover7(Component){return props=>{const{x,y}=useHoverParallax({level:7});return /*#__PURE__*/_jsx(Component,{...props,style:{x,y,...props.style?props.style:{}}});};}export function withHover10(Component){return props=>{const{x,y}=useHoverParallax({level:10});return /*#__PURE__*/_jsx(Component,{...props,style:{x,y,...props.style?props.style:{}}});};}export function withHover20(Component){return props=>{const{x,y}=useHoverParallax({level:20});return /*#__PURE__*/_jsx(Component,{...props,style:{x,y,...props.style?props.style:{}}});};}export default function ParallaxLayer(props){const{level,...otherProps}=props;const{x,y}=useHoverParallax({level});return /*#__PURE__*/_jsx(motion.div,{...otherProps,style:{x,y,...props.style?props.style:{}}});}ParallaxLayer.defaultProps={level:5};addPropertyControls(ParallaxLayer,{level:{title:\"Parallax Level\",type:ControlType.Number},children:{type:ControlType.Array,control:{type:ControlType.ComponentInstance},maxCount:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"withContainer\":{\"type\":\"reactHoc\",\"name\":\"withContainer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover7\":{\"type\":\"reactHoc\",\"name\":\"withHover7\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover20\":{\"type\":\"reactHoc\",\"name\":\"withHover20\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover10\":{\"type\":\"reactHoc\",\"name\":\"withHover10\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover5\":{\"type\":\"reactHoc\",\"name\":\"withHover5\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxLayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover3\":{\"type\":\"reactHoc\",\"name\":\"withHover3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MouseParallax.map"],"mappings":"8PAAwV,SAAgB,EAAc,EAAU,CAAC,MAAO,IAAO,CAAkB,IAAM,EAAE,EAAe,EAAE,CAAO,EAAE,EAAe,EAAE,CAAO,EAAIA,GAAQ,CAAO,EAAmB,EAAI,SAA2D,uBAAuB,CAAO,EAAgB,GAAG,CAAC,GAAG,CAAC,EAAK,OAAO,GAAK,CAAC,UAAQ,UAAQ,UAAQ,EAC1pB,GAAI,EAAQ,EAAK,MAAM,EAAK,MAAY,G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