{"version":3,"file":"CutPaperEye.BU3WyVi7.mjs","names":["useId","useRef","useEffect","_jsxs","_jsx","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","ie","p","ce","de","addPropertyControls","init_framer_ChujFWHC","ControlType","CutPaperEye","props","inverse","followCursor","spinOnScroll","reverseSpin","style","ink","paper","burst","white","clipId","burstRef","irisRef","pupilRef","reduce","x","y","tx","ty","raf","spinRaf","running","draw","k","kick","onMove","r","dx","dy","dist","reach","onLeave","spin","onScroll","c","BURST","EYE","init_CutPaperEye","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/tPwRigagRjjdxFDoNzX6/yQAiuJv83GH9nB8y8abk/CutPaperEye.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useId,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const BURST=\"M101.145 0L123.722 50.8043L164.361 21.3913L156.233 69.5217L205 77.5435L166.167 104.283L203.194 140.826L153.524 141.717L162.555 193.413L120.11 162.217L95.7269 205L78.5683 157.761L27.0925 185.391L43.348 135.478L0 123.891L43.348 97.1522L10.837 56.1522L62.3128 63.2826L65.9251 11.587L94.8238 49.913L101.145 0Z\";const EYE=\"M0 23.3505C33.4833 -7.78349 71.75 -7.78349 114.8 23.3505C77.7292 55.0832 39.4625 55.0832 0 23.3505Z\";/**\n * Old Dog cut-paper eye. The pupil follows the cursor and the star turns as the page scrolls.\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CutPaperEye(props){const{inverse,followCursor,spinOnScroll,reverseSpin,style}=props;const ink=\"#171715\",paper=\"#F7F6F2\";const burst=inverse?paper:ink;const white=inverse?ink:paper;const clipId=\"eye-\"+useId().replace(/:/g,\"\");const burstRef=useRef(null);const irisRef=useRef(null);const pupilRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;let x=0,y=0,tx=0,ty=0,raf=0,spinRaf=0,running=false;const MAX_X=34,MAX_Y=7;const draw=()=>{const k=reduce?1:.14;x+=(tx-x)*k;y+=(ty-y)*k;pupilRef.current?.setAttribute(\"transform\",\"translate(\"+x.toFixed(2)+\" \"+y.toFixed(2)+\")\");if(Math.abs(tx-x)>.05||Math.abs(ty-y)>.05)raf=requestAnimationFrame(draw);else running=false;};const kick=()=>{if(!running){running=true;raf=requestAnimationFrame(draw);}};const onMove=e=>{if(e.pointerType===\"touch\"||!irisRef.current)return;const r=irisRef.current.getBoundingClientRect();const dx=e.clientX-(r.left+r.width/2);const dy=e.clientY-(r.top+r.height/2);const dist=Math.hypot(dx,dy)||1;const reach=Math.min(1,dist/260);tx=dx/dist*reach*MAX_X;ty=Math.max(-MAX_Y,Math.min(MAX_Y,dy/dist*reach*MAX_Y*1.6));kick();};const onLeave=()=>{tx=0;ty=0;kick();};const spin=()=>{spinRaf=0;if(burstRef.current)burstRef.current.style.transform=\"rotate(\"+(window.scrollY*.12*(reverseSpin?-1:1)).toFixed(2)+\"deg)\";};const onScroll=()=>{if(!spinRaf)spinRaf=requestAnimationFrame(spin);};if(followCursor){window.addEventListener(\"pointermove\",onMove,{passive:true});document.addEventListener(\"pointerleave\",onLeave);}if(spinOnScroll&&!reduce){window.addEventListener(\"scroll\",onScroll,{passive:true});spin();}return()=>{window.removeEventListener(\"pointermove\",onMove);document.removeEventListener(\"pointerleave\",onLeave);window.removeEventListener(\"scroll\",onScroll);cancelAnimationFrame(raf);cancelAnimationFrame(spinRaf);};},[followCursor,spinOnScroll,reverseSpin]);return /*#__PURE__*/_jsxs(\"div\",{\"aria-hidden\":\"true\",style:{...style,position:\"relative\",width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsx(\"svg\",{ref:burstRef,viewBox:\"0 0 205 205\",preserveAspectRatio:\"none\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",display:\"block\",willChange:\"transform\"},children:/*#__PURE__*/_jsx(\"path\",{d:BURST,fill:burst})}),/*#__PURE__*/_jsxs(\"svg\",{ref:irisRef,viewBox:\"0 0 114.8 47.15\",preserveAspectRatio:\"none\",style:{position:\"absolute\",left:\"22%\",top:\"40%\",width:\"56%\",height:\"23%\",overflow:\"visible\",display:\"block\"},children:[/*#__PURE__*/_jsx(\"defs\",{children:/*#__PURE__*/_jsx(\"clipPath\",{id:clipId,children:/*#__PURE__*/_jsx(\"path\",{d:EYE})})}),/*#__PURE__*/_jsx(\"path\",{d:EYE,fill:white}),/*#__PURE__*/_jsx(\"g\",{clipPath:\"url(#\"+clipId+\")\",children:/*#__PURE__*/_jsx(\"ellipse\",{ref:pupilRef,cx:\"58.43\",cy:\"23.16\",rx:\"14.35\",ry:\"18.45\",fill:burst})})]})]});}CutPaperEye.defaultProps={inverse:false,followCursor:true,spinOnScroll:true,reverseSpin:false};addPropertyControls(CutPaperEye,{inverse:{type:ControlType.Boolean,title:\"On dark\",defaultValue:false},followCursor:{type:ControlType.Boolean,title:\"Follow cursor\",defaultValue:true},spinOnScroll:{type:ControlType.Boolean,title:\"Spin on scroll\",defaultValue:true},reverseSpin:{type:ControlType.Boolean,title:\"Reverse spin\",defaultValue:false,hidden:p=>!p.spinOnScroll}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CutPaperEye\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CutPaperEye.map"],"mappings":"A,mMAIG,SAAwBgB,EAAYC,EAAM,CAAC,GAAK,CAACC,UAAQC,eAAaC,eAAaC,cAAYC,SAAOL,EAAYM,EAAI,UAAUC,EAAM,UAAgBC,EAAMP,EAAQM,EAAMD,EAAUG,EAAMR,EAAQK,EAAIC,EAAYG,EAAO,OAAO3B,EAAM,CAAC,CAAC,QAAQ,KAAK,EAAE,EAAQ4B,E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