{"version":3,"file":"Random_cursor_movement.D3d2feYy.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/rr4PQ6bqBJmlEyqinncl/nUOCqZt5MnNehsYTCTLY/Random_cursor_movement.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useAnimation}from\"framer-motion\";function getRandomPosition(minDistance=20,maxDistance=40// you can customize maximum distance from the current position\n){const angle=Math.random()*2*Math.PI;const distance=Math.random()*(maxDistance-minDistance)+minDistance;return{x:Math.cos(angle)*distance,y:Math.sin(angle)*distance};}// you can customize the random delay between movements by tweaking the minimum and maximum values\nfunction getRandomDelay(min=500,max=1500){return Math.random()*(max-min)+min;}export function withRandomCursorMovement(Component){return props=>{const controls=useAnimation();const lastPosition=useRef({x:0,y:0});const instanceId=useRef(Math.random());useEffect(()=>{const moveRandomly=async()=>{// Initial random delay\nawait new Promise(resolve=>setTimeout(resolve,getRandomDelay(0,3e3)));while(true){const newPosition=getRandomPosition();while(Math.abs(newPosition.x-lastPosition.current.x)<5&&Math.abs(newPosition.y-lastPosition.current.y)<5){Object.assign(newPosition,getRandomPosition());}lastPosition.current=newPosition;await controls.start({x:newPosition.x,y:newPosition.y,transition:{// you can customize animation\nduration:2,type:\"spring\",stiffness:50,damping:10}});await new Promise(resolve=>setTimeout(resolve,getRandomDelay()));}};moveRandomly();return()=>{controls.stop();};},[controls,instanceId.current]);return /*#__PURE__*/_jsx(Component,{...props,animate:controls});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withRandomCursorMovement\":{\"type\":\"reactHoc\",\"name\":\"withRandomCursorMovement\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Random_cursor_movement.map"],"mappings":"0KAAuH,SAAS,EAAkB,EAAY,GAAG,EAAY,GAC5K,CAAC,IAAM,EAAM,KAAK,QAAQ,CAAC,EAAE,KAAK,GAAS,EAAS,KAAK,QAAQ,EA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