{"version":3,"file":"CursorFollower.Ccs7LOa7.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/aD3AQXGc2sJQX7DhkkQX/I2xYXBJjNogSw3nv8vK2/CursorFollower.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const lerp=(a,b,t)=>a+(b-a)*t;const angleDeg=(a,b)=>Math.atan2(b.y-a.y,b.x-a.x)*180/Math.PI;const normalizeAngle=a=>(a+180)%360-180;// SVG details\nconst VIEWBOX=32;const TIP_X=30;const TIP_Y=16;export function CursorFollower({size=40,color=\"#ffffff\",smoothPos=.15,smoothRot=.12,inertia=.2,shadow=.28}){const cursorRef=useRef(null);// refs — start op default (0), we vullen ze in useEffect op client\nconst pos=useRef({x:0,y:0});const target=useRef({x:0,y:0});const smoothedTarget=useRef({x:0,y:0});const angleRef=useRef(0);const rafRef=useRef(null);// pivot & transformOrigin berekenen alleen als size verandert\nconst pivot=useRef(null);useEffect(()=>{pivot.current={x:TIP_X/VIEWBOX*size,y:TIP_Y/VIEWBOX*size};// en zet transformOrigin direct (indien element al bestaat)\nconst el=cursorRef.current;if(el&&pivot.current){el.style.transformOrigin=`${pivot.current.x}px ${pivot.current.y}px`;}},[size]);useEffect(()=>{if(typeof window===\"undefined\")return;// Client-only initial pos\nconst w=window.innerWidth;const h=window.innerHeight;pos.current={x:w/2,y:h/2};target.current={x:w/2,y:h/2};smoothedTarget.current={...target.current};const html=document.documentElement;const prevCursor=html.style.cursor;html.style.cursor=\"none\";const el=cursorRef.current;if(!el)return()=>{html.style.cursor=prevCursor;};// mousemove listener\nconst onMove=e=>{target.current={x:e.clientX,y:e.clientY};};document.addEventListener(\"mousemove\",onMove);// Pause animation when document hidden (reduces CPU while tab inactive / in editor)\nlet isActive=true;const onVisibility=()=>{isActive=!document.hidden;if(isActive&&rafRef.current===null){rafRef.current=requestAnimationFrame(animate);}};document.addEventListener(\"visibilitychange\",onVisibility);// animation\nfunction animate(){if(!isActive){rafRef.current=null;return;}// inertia -> smoothed target\nsmoothedTarget.current.x=lerp(smoothedTarget.current.x,target.current.x,inertia);smoothedTarget.current.y=lerp(smoothedTarget.current.y,target.current.y,inertia);// positie smoothen\npos.current.x=lerp(pos.current.x,smoothedTarget.current.x,smoothPos);pos.current.y=lerp(pos.current.y,smoothedTarget.current.y,smoothPos);// hoek smoothen\nconst rawAngle=angleDeg(pos.current,smoothedTarget.current);let delta=normalizeAngle(rawAngle-angleRef.current);angleRef.current+=delta*smoothRot;// transform toepassen — gebruik translate3d voor GPU accel\nconst{x,y}=pos.current;const px=pivot.current?pivot.current.x:TIP_X/VIEWBOX*size;const py=pivot.current?pivot.current.y:TIP_Y/VIEWBOX*size;el.style.transform=`translate3d(${x-px}px, ${y-py}px, 0) rotate(${angleRef.current}deg)`;rafRef.current=requestAnimationFrame(animate);}// start animatie\nrafRef.current=requestAnimationFrame(animate);return()=>{if(rafRef.current!==null)cancelAnimationFrame(rafRef.current);rafRef.current=null;document.removeEventListener(\"mousemove\",onMove);document.removeEventListener(\"visibilitychange\",onVisibility);html.style.cursor=prevCursor;};},[smoothPos,smoothRot,inertia,size])// props die anim beïnvloeden\n;return /*#__PURE__*/_jsx(\"svg\",{ref:cursorRef,xmlns:\"http://www.w3.org/2000/svg\",viewBox:\"0 0 32 32\",width:size,height:size,style:{position:\"fixed\",top:0,left:0,pointerEvents:\"none\",userSelect:\"none\",zIndex:9999,willChange:\"transform\",filter:`drop-shadow(0 2px 2px rgba(0,0,0,${shadow}))`},dangerouslySetInnerHTML:{__html:getModernCursorSVG(color)}});}function getModernCursorSVG(color){return`\n  <defs>\n    <linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">\n      <stop offset=\"0%\" stop-color=\"${color}\" />\n      <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0.9\" />\n    </linearGradient>\n  </defs>\n  <path d=\"M30 16\n           L6.5 6.5\n           Q5.2 6.0 5.0 7.4\n           L10.8 16\n           L5.0 24.6\n           Q5.2 26.0 6.5 25.5\n           Z\"\n        fill=\"url(#g)\"/>\n  <path d=\"M11 16 L26 16\"\n        stroke=\"rgba(0,0,0,0.08)\"\n        stroke-width=\"1.25\"\n        stroke-linecap=\"round\"/>\n  `;}// Framer controls\naddPropertyControls(CursorFollower,{size:{type:ControlType.Number,title:\"Size\",defaultValue:40,min:16,max:128},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#ffffff\"},smoothPos:{type:ControlType.Number,title:\"Smooth Position\",defaultValue:.15,min:.05,max:.3,step:.01},smoothRot:{type:ControlType.Number,title:\"Smooth Rotation\",defaultValue:.12,min:.05,max:.3,step:.01},inertia:{type:ControlType.Number,title:\"Inertia\",defaultValue:.2,min:.05,max:.4,step:.01},shadow:{type:ControlType.Number,title:\"Shadow\",defaultValue:.28,min:0,max:.5,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"CursorFollower\":{\"type\":\"reactComponent\",\"name\":\"CursorFollower\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorFollower.map"],"mappings":"+LAC+C,SAAgB,EAAe,CAAC,OAAK,GAAG,QAAM,UAAU,YAAU,IAAI,YAAU,IAAI,UAAQ,GAAG,SAAO,KAAK,CAAC,IAAM,EAAUA,EAAO,KAAK,CACjL,EAAIA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAOA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAAeA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAO,EAASA,EAAO,EAAE,CAAO,EAAOA,EAAO,KAAK,CAC9I,EAAMA,EAAO,KAAK,CAWvB,OAXwB,MAAc,CAAC,EAAM,QAAQ,CAAC,EAAE,EAAM,EAAQ,EAAK,EAAE,EAAM,EAAQ,EAAK,CACjG,IAAM,EAAG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