{"version":3,"file":"Movement.CU7ZyXoE.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/jyDHsCZ2gjC0IlQ8ie6I/rr2AeRm6yCMZNKwv269r/Movement.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function MagneticDot(props){const{size,color}=props;const ref=useRef(null);const float=useRef({x:0,y:0});const floatTarget=useRef({x:0,y:0});const follow=useRef({x:0,y:0});const mouse=useRef({x:-9999,y:-9999});useEffect(()=>{const el=ref.current;if(!el)return;let rect=el.getBoundingClientRect();let origin={x:rect.left+rect.width/2,y:rect.top+rect.height/2};let frameId;function updateOrigin(){rect=el.getBoundingClientRect();origin={x:rect.left+rect.width/2,y:rect.top+rect.height/2};}function handleMouseMove(e){mouse.current.x=e.clientX;mouse.current.y=e.clientY;}window.addEventListener(\"resize\",updateOrigin);window.addEventListener(\"mousemove\",handleMouseMove);const wanderRadius=30;const floatSpeed=.01;const followSpeed=.18;const returnSpeed=.08;const maxDistance=120;const strength=.35;floatTarget.current.x=(Math.random()-.5)*wanderRadius;floatTarget.current.y=(Math.random()-.5)*wanderRadius;function animate(){const dx=mouse.current.x-origin.x;const dy=mouse.current.y-origin.y;const distance=Math.sqrt(dx*dx+dy*dy);const isHovering=distance<maxDistance;// CHANGE Z-INDEX ON HOVER\nel.style.zIndex=isHovering?\"10\":\"1\";// FLOAT ONLY WHEN NOT HOVERING\nif(!isHovering){const dxFloat=floatTarget.current.x-float.current.x;const dyFloat=floatTarget.current.y-float.current.y;const floatDistance=Math.sqrt(dxFloat*dxFloat+dyFloat*dyFloat);if(floatDistance<1){floatTarget.current.x=(Math.random()-.5)*wanderRadius;floatTarget.current.y=(Math.random()-.5)*wanderRadius;}float.current.x+=dxFloat*floatSpeed;float.current.y+=dyFloat*floatSpeed;}// FOLLOW CURSOR WHEN CLOSE\nlet targetX=0;let targetY=0;if(isHovering){targetX=dx*strength;targetY=dy*strength;}const speed=isHovering?followSpeed:returnSpeed;follow.current.x+=(targetX-follow.current.x)*speed;follow.current.y+=(targetY-follow.current.y)*speed;const x=float.current.x+follow.current.x;const y=float.current.y+follow.current.y;el.style.transform=`translate(${x}px, ${y}px)`;frameId=requestAnimationFrame(animate);}updateOrigin();animate();return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);window.removeEventListener(\"resize\",updateOrigin);cancelAnimationFrame(frameId);};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:size,height:size,borderRadius:\"50%\",background:color,willChange:\"transform\",position:\"relative\",zIndex:1}});}addPropertyControls(MagneticDot,{size:{type:ControlType.Number,defaultValue:16,min:4,max:100,unit:\"px\"},color:{type:ControlType.Color,defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MagneticDot\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Movement.map"],"mappings":"0LAAmI,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,SAAO,EAAY,EAAIA,EAAO,KAAK,CAAO,EAAMA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAYA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAOA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAMA,EAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAGmO,OAHlO,MAAc,CAAC,IAAM,EAAG,EAAI,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAI,EAAK,EAAG,uBAAuB,CAAK,EAAO,CAAC,EAAE,EAAK,KAAK,EAAK,MAAM,EAAE,EAAE,EAAK,IAAI,EAAK,OAAO,EAAE,CAAK,EAAQ,SAAS,GAAc,CAAC,EAAK,EAAG,uBAAuB,CAAC,EAAO,CAAC,EAAE,EAAK,KAA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