{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/9v3L4TcIO8eY5H9xyNQ4/eFqgrUaDyBnVzw2DDuLl/Mouse_Parallax.js"],
  "sourcesContent": ["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Mouse Parallax\n * By OneFramer.com\n *\n * @framerDisableUnlink\n */export default function Mouse_Parallax(props){const{parentId,children,movementAxis}=props;const[clientX,setClientX]=useState(null);const[clientY,setClientY]=useState(null);useEffect(()=>{const parent=document.getElementById(parentId);if(!parent)return;const handleMouseMove=e=>{setClientX(e.clientX);setClientY(e.clientY);};const handleMouseLeave=()=>{children.forEach(child=>{const childElement=document.getElementById(child.id);if(!childElement)return;childElement.style.transition=`transform ${child.transitionDuration}ms cubic-bezier(0, 0, 0.58, 1) `;childElement.style.transform=\"translate(0, 0)\";});};parent.addEventListener(\"mousemove\",handleMouseMove);parent.addEventListener(\"mouseleave\",handleMouseLeave);return()=>{parent.removeEventListener(\"mousemove\",handleMouseMove);parent.removeEventListener(\"mouseleave\",handleMouseLeave);};},[parentId,children]);useEffect(()=>{const parent=document.getElementById(parentId);if(!parent)return;children.forEach(child=>{const childElement=document.getElementById(child.id);if(!childElement)return;let moveX=0;let moveY=0;const speed=child.movementFactor/1e3;if(movementAxis===\"Both\"||movementAxis===\"Horizontal\"){if(clientX){moveX=(clientX-window.innerWidth/2)*child.sensitivityX*.01*speed;}}if(movementAxis===\"Both\"||movementAxis===\"Vertical\"){if(clientY){moveY=(clientY-window.innerHeight/2)*child.sensitivityY*.01*speed;}}if(child.reverseMovement){moveX*=-1;moveY*=-1;}if(child.lockReverse){console.log(child);if(moveX<0){childElement.style.transition=`transform ${child.transitionDuration}ms cubic-bezier(0, 0, 0.58, 1`;childElement.style.transform=`translate(${moveX}px, ${moveY}px)`;}return;}childElement.style.transition=`transform ${child.transitionDuration}ms cubic-bezier(0, 0, 0.58, 1)`;childElement.style.transform=`translate(${moveX}px, ${moveY}px)`;});},[clientX,clientY,parentId,children,movementAxis]);return /*#__PURE__*/_jsx(_Fragment,{});}addPropertyControls(Mouse_Parallax,{parentId:{type:ControlType.String,title:\"Parent ID\",defaultValue:\"container\"},movementAxis:{type:ControlType.Enum,title:\"Movement Axis\",options:[\"Both\",\"Horizontal\",\"Vertical\"],optionTitles:[\"Both\",\"Horizontal\",\"Vertical\"],defaultValue:\"Both\"},children:{type:ControlType.Array,title:\"Children\",propertyControl:{type:ControlType.Object,controls:{id:{type:ControlType.String,title:\"ID\",defaultValue:\"child\"},movementFactor:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:500,displayStepper:true,step:10},reverseMovement:{type:ControlType.Boolean,title:\"Reverse Movement\",defaultValue:false},sensitivityX:{type:ControlType.Number,title:\"Horizontal Sensitivity\",defaultValue:10,displayStepper:true,step:10},sensitivityY:{type:ControlType.Number,title:\"Vertical Sensitivity\",defaultValue:10,displayStepper:true,step:10},transitionDuration:{type:ControlType.Number,title:\"Transition Duration (ms)\",defaultValue:500,displayStepper:true,step:10},lockReverse:{type:ControlType.Boolean,title:\"Lock Reverse Movement (horizontal)\",defaultValue:false}}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Mouse_Parallax\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Mouse_Parallax.map"],
  "mappings": "uJAKkB,SAARA,EAAgCC,EAAM,CAAC,GAAK,CAAC,SAAAC,EAAS,SAAAC,EAAS,aAAAC,CAAY,EAAEH,EAAW,CAACI,EAAQC,CAAU,EAAEC,EAAS,IAAI,EAAO,CAACC,EAAQC,CAAU,EAAEF,EAAS,IAAI,EAAE,OAAAG,EAAU,IAAI,CAAC,IAAMC,EAAO,SAAS,eAAeT,CAAQ,EAAE,GAAG,CAACS,EAAO,OAAO,IAAM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CAAE,CAACC,EAAoBvB,EAAe,CAAC,SAAS,CAAC,KAAKwB,EAAY,OAAO,MAAM,YAAY,aAAa,WAAW,EAAE,aAAa,CAAC,KAAKA,EAAY,KAAK,MAAM,gBAAgB,QAAQ,CAAC,OAAO,aAAa,UAAU,EAAE,aAAa,CAAC,OAAO,aAAa,UAAU,EAAE,aAAa,MAAM,EAAE,SAAS,CAAC,KAAKA,EAAY,MAAM,MAAM,WAAW,gBAAgB,CAAC,KAAKA,EAAY,OAAO,SAAS,CAAC,GAAG,CAAC,KAAKA,EAAY,OAAO,MAAM,KAAK,aAAa,OAAO,EAAE,eAAe,CAAC,KAAKA,EAAY,OAAO,MAAM,aAAa,aAAa,IAAI,eAAe,GAAK,KAAK,EAAE,EAAE,gBAAgB,CAAC,KAAKA,EAAY,QAAQ,MAAM,mBAAmB,aAAa,EAAK,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,MAAM,yBAAyB,aAAa,GAAG,eAAe,GAAK,KAAK,EAAE,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,MAAM,uBAAuB,aAAa,GAAG,eAAe,GAAK,KAAK,EAAE,EAAE,mBAAmB,CAAC,KAAKA,EAAY,OAAO,MAAM,2BAA2B,aAAa,IAAI,eAAe,GAAK,KAAK,EAAE,EAAE,YAAY,CAAC,KAAKA,EAAY,QAAQ,MAAM,qCAAqC,aAAa,EAAK,CAAC,CAAC,CAAC,CAAC,CAAC",
  "names": ["Mouse_Parallax", "props", "parentId", "children", "movementAxis", "clientX", "setClientX", "ye", "clientY", "setClientY", "ue", "parent", "handleMouseMove", "e", "handleMouseLeave", "child", "childElement", "moveX", "moveY", "speed", "window", "p", "l", "addPropertyControls", "ControlType"]
}
