{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/qnrN6wkhz94Hv9gsiUQ3/PSxSrpFyIIHIQ5ZYuOBi/Rotate_Follow_Cursor.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{motion,useMotionValue}from\"framer-motion\";export function withFollowCursor(Component){return props=>{// Create a motion value for the rotation\nconst rotation=useMotionValue(0);// Create refs to store the cursor/touch position and the component reference\nconst[position,setPosition]=useState(null);const componentRef=useRef();// Update the position on mouse move or touch move\nconst handleMove=event=>{let x,y;if(event.changedTouches){// if this is a touch event\nx=event.changedTouches[0].clientX;y=event.changedTouches[0].clientY;}else{// if this is a mouse event\nx=event.clientX;y=event.clientY;}setPosition({x,y});};// Attach the move event listener to the window\nuseEffect(()=>{window.addEventListener(\"mousemove\",handleMove);window.addEventListener(\"touchmove\",handleMove);// Clean up the event listeners on unmount\nreturn()=>{window.removeEventListener(\"mousemove\",handleMove);window.removeEventListener(\"touchmove\",handleMove);};},[]);// Calculate the angle and update the rotation continuously\nuseEffect(()=>{const updateRotation=()=>{if(!componentRef.current||!position)return;const rect=componentRef.current.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const deltaY=position.y-centerY;const deltaX=position.x-centerX;const angle=(Math.atan2(deltaY,deltaX)*(180/Math.PI)+360+90)%360;rotation.set(angle);requestAnimationFrame(updateRotation);};updateRotation();},[position]);return /*#__PURE__*/_jsx(Component,{...props,ref:componentRef,as:motion.div,style:{...props.style,rotate:rotation,transformOrigin:\"center\"}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withFollowCursor\":{\"type\":\"reactHoc\",\"name\":\"withFollowCursor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rotate_Follow_Cursor.map"],
  "mappings": "uJAAgJ,SAASA,EAAiBC,EAAU,CAAC,OAAOC,GAAO,CACnM,IAAMC,EAASC,EAAe,CAAC,EAC1B,CAACC,EAASC,CAAW,EAAEC,EAAS,IAAI,EAAQC,EAAaC,EAAO,EAC/DC,EAAWC,GAAO,CAAC,IAAIC,EAAEC,EAAKF,EAAM,gBAC1CC,EAAED,EAAM,eAAe,CAAC,EAAE,QAAQE,EAAEF,EAAM,eAAe,CAAC,EAAE,UAC5DC,EAAED,EAAM,QAAQE,EAAEF,EAAM,SAASL,EAAY,CAAC,EAAAM,EAAE,EAAAC,CAAC,CAAC,CAAE,EACpD,OAAAC,EAAU,KAAKC,EAAO,iBAAiB,YAAYL,CAAU,EAAEK,EAAO,iBAAiB,YAAYL,CAAU,EACvG,IAAI,CAACK,EAAO,oBAAoB,YAAYL,CAAU,EAAEK,EAAO,oBAAoB,YAAYL,CAAU,CAAE,GAAI,CAAC,CAAC,EACvHI,EAAU,IAAI,CAAC,IAAME,EAAe,IAAI,CAAC,GAAG,CAACR,EAAa,SAAS,CAACH,EAAS,OAAO,IAAMY,EAAKT,EAAa,QAAQ,sBAAsB,EAAQU,EAAQD,EAAK,KAAKA,EAAK,MAAM,EAAQE,EAAQF,EAAK,IAAIA,EAAK,OAAO,EAAQG,EAAOf,EAAS,EAAEc,EAAcE,EAAOhB,EAAS,EAAEa,EAAcI,GAAO,KAAK,MAAMF,EAAOC,CAAM,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,IAAIlB,EAAS,IAAImB,CAAK,EAAE,sBAAsBN,CAAc,CAAE,EAAEA,EAAe,CAAE,EAAE,CAACX,CAAQ,CAAC,EAAsBkB,EAAKtB,EAAU,CAAC,GAAGC,EAAM,IAAIM,EAAa,GAAGgB,EAAO,IAAI,MAAM,CAAC,GAAGtB,EAAM,MAAM,OAAOC,EAAS,gBAAgB,QAAQ,CAAC,CAAC,CAAE,CAAE",
  "names": ["withFollowCursor", "Component", "props", "rotation", "useMotionValue", "position", "setPosition", "ye", "componentRef", "pe", "handleMove", "event", "x", "y", "ue", "window", "updateRotation", "rect", "centerX", "centerY", "deltaY", "deltaX", "angle", "p", "motion"]
}
