{"version":3,"file":"PortraitHalo.DkfeFVQk.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/qpU4B4QY4NU57j5VRKfp/dljVrRBzwfgtYqEXyBy6/PortraitHalo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PortraitHalo(props){const{color=\"#B6FF2E\",strokeWidth=1,duration=14,animate=true,style}=props;const isStaticRenderer=useIsStaticRenderer();const rootRef=useRef(null);const groupRef=useRef(null);const[isInView,setIsInView]=useState(true);const[reducedMotion,setReducedMotion]=useState(null);const rafRef=useRef(null);const elapsedRef=useRef(0);const lastTimeRef=useRef(0);useEffect(()=>{if(typeof window===\"undefined\"||!rootRef.current)return;const observer=new IntersectionObserver(entries=>{startTransition(()=>setIsInView(entries[0]?.isIntersecting??false));},{threshold:.05});observer.observe(rootRef.current);return()=>observer.disconnect();},[]);useEffect(()=>{if(typeof window===\"undefined\")return;const media=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const onChange=()=>{startTransition(()=>setReducedMotion(media.matches));};onChange();media.addEventListener(\"change\",onChange);return()=>media.removeEventListener(\"change\",onChange);},[]);const shouldAnimate=animate&&reducedMotion===false&&!isStaticRenderer&&isInView;useEffect(()=>{const group=groupRef.current;if(!group)return;if(!shouldAnimate){group.setAttribute(\"transform\",\"rotate(0 200 140) scale(1)\");if(typeof window!==\"undefined\"&&rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}lastTimeRef.current=0;return;}const tick=time=>{if(!lastTimeRef.current)lastTimeRef.current=time;const delta=time-lastTimeRef.current;lastTimeRef.current=time;elapsedRef.current+=delta;const cycle=elapsedRef.current/Math.max(1e3,duration*1e3)*Math.PI*2;const mirrored=.5-.5*Math.cos(cycle);const rotation=-3+6*mirrored;const scale=1+.01*mirrored;group.setAttribute(\"transform\",`rotate(${rotation} 200 140) scale(${scale})`);if(typeof window!==\"undefined\"){rafRef.current=window.requestAnimationFrame(tick);}};if(typeof window!==\"undefined\"){if(rafRef.current!==null)window.cancelAnimationFrame(rafRef.current);rafRef.current=window.requestAnimationFrame(tick);}return()=>{if(typeof window!==\"undefined\"&&rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}lastTimeRef.current=0;};},[duration,shouldAnimate]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,\"aria-hidden\":true,style:{position:\"relative\",width:\"100%\",height:\"100%\",...style},children:/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 400 280\",width:\"100%\",height:\"100%\",preserveAspectRatio:\"xMidYMid meet\",style:{overflow:\"visible\"},children:/*#__PURE__*/_jsx(\"g\",{ref:groupRef,children:/*#__PURE__*/_jsx(\"path\",{d:\"M180 230 C35 45 100 -30 235 45 C390 125 415 265 290 230 C240 215 205 180 180 230\",fill:\"none\",stroke:color,strokeWidth:strokeWidth,strokeLinecap:\"round\",strokeLinejoin:\"round\",opacity:.92})})})});}addPropertyControls(PortraitHalo,{color:{type:ControlType.Color,defaultValue:\"#B6FF2E\",title:\"Color\"},strokeWidth:{type:ControlType.Number,title:\"Stroke\",min:.5,max:4,step:.1,defaultValue:1},duration:{type:ControlType.Number,title:\"Duration\",min:6,max:30,step:.5,unit:\"s\",defaultValue:14},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PortraitHalo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PortraitHalo.map"],"mappings":"2MAGG,SAAwB,EAAa,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