{"version":3,"file":"MouseParallax.B1MFtttx.mjs","names":["useRef","useContext","__esmMin","init_npm_react_18_3_1","oe","init_jsx_runtime","B","c","de","useMotionValue","useSpring","useTransform","init_framer_motion_DhsWWWsN","motion","init_framer_BL70qLPA","addPropertyControls","ControlType","withContainer","x","y","ref","rect","handleMouseMove","xx","clientX","yy","clientY","ParallaxContext","Component","props","withHover3","useHoverParallax","withHover5","withHover7","withHover10","withHover20","ParallaxLayer","otherProps","init_MouseParallax","mouse","level"],"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":"A,8PAAwV,SAAgBiB,EAAc,EAAU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