{"version":3,"file":"LookAtCursor.VTaTS0SP.mjs","names":[],"sources":["https:/framerusercontent.com/modules/JJc46EO2jghWooo5dHyp/zzV36thCyWJXoNYHDzxM/LookAtCursor.js"],"sourcesContent":["// 3D component that tracks cursor movement and rotates to look at it\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function LookAtCursor(props){const{children,intensity,perspective,parallaxIntensity,shineIntensity,shineColor,shineGradientEnd,borderRadius,contentPosition}=props;const[rotation,setRotation]=useState({x:0,y:0});const[parallax,setParallax]=useState({x:0,y:0});const[isClicked,setIsClicked]=useState(false);const[shinePosition,setShinePosition]=useState({x:50,y:50});const[shineEnabled,setShineEnabled]=useState(true);const elementRef=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const handleMouseMove=e=>{if(!elementRef.current)return;const rect=elementRef.current.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const deltaX=e.clientX-centerX;const deltaY=e.clientY-centerY;const rotateX=deltaY/window.innerHeight*intensity*-1;const rotateY=deltaX/window.innerWidth*intensity;const parallaxX=deltaX/window.innerWidth*parallaxIntensity;const parallaxY=deltaY/window.innerHeight*parallaxIntensity;// Calculate shine position based on cursor relative to element\nconst shineX=(e.clientX-rect.left)/rect.width*100;const shineY=(e.clientY-rect.top)/rect.height*100;startTransition(()=>{setRotation({x:rotateX,y:rotateY});setParallax({x:parallaxX,y:parallaxY});setShinePosition({x:shineX,y:shineY});});};const handleMouseLeave=()=>{startTransition(()=>{setRotation({x:0,y:0});setParallax({x:0,y:0});setShinePosition({x:50,y:50});});};const handleClick=()=>{startTransition(()=>{setIsClicked(true);setShineEnabled(!shineEnabled);setTimeout(()=>{startTransition(()=>setIsClicked(false));},150);});};window.addEventListener(\"mousemove\",handleMouseMove);window.addEventListener(\"mouseleave\",handleMouseLeave);if(elementRef.current){elementRef.current.addEventListener(\"click\",handleClick);}return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);window.removeEventListener(\"mouseleave\",handleMouseLeave);if(elementRef.current){elementRef.current.removeEventListener(\"click\",handleClick);}};},[intensity,parallaxIntensity,isStatic,shineEnabled]);return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,perspective:`${perspective}px`,width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsxs(\"div\",{ref:elementRef,style:{width:\"100%\",height:\"100%\",transform:`translate3d(${parallax.x}px, ${parallax.y}px, 0) rotateX(${rotation.x}deg) rotateY(${rotation.y}deg) scale(${isClicked?.95:1})`,transition:isStatic?\"none\":\"transform 0.1s ease-out\",transformStyle:\"preserve-3d\",cursor:\"pointer\",position:\"relative\",overflow:\"hidden\",borderRadius:`${borderRadius}px`},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",background:`radial-gradient(circle at ${shinePosition.x}% ${shinePosition.y}%, ${shineColor} 0%, ${shineGradientEnd} 20%, transparent ${shineIntensity}%)`,pointerEvents:\"none\",opacity:shineEnabled?.6:0,transition:isStatic?\"none\":\"background 0.1s ease-out, opacity 0.3s ease-out\",zIndex:1,borderRadius:`${borderRadius}px`}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"-2px\",left:\"-2px\",width:\"calc(100% + 4px)\",height:\"calc(100% + 4px)\",background:`radial-gradient(circle at ${shinePosition.x}% ${shinePosition.y}%, ${shineColor} 0%, ${shineGradientEnd} 15%, transparent ${shineIntensity*.8}%)`,pointerEvents:\"none\",opacity:shineEnabled?.4:0,transition:isStatic?\"none\":\"background 0.1s ease-out, opacity 0.3s ease-out\",zIndex:-1,borderRadius:`${borderRadius+2}px`,mask:`radial-gradient(circle at center, transparent calc(100% - 4px), black calc(100% - 2px))`,WebkitMask:`radial-gradient(circle at center, transparent calc(100% - 4px), black calc(100% - 2px))`}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",zIndex:2},children:children})]})});}addPropertyControls(LookAtCursor,{children:{type:ControlType.Slot,title:\"Content\"},contentPosition:{type:ControlType.Enum,title:\"Content Position\",defaultValue:\"center\",options:[\"center\",\"top\",\"bottom\",\"left\",\"right\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"],optionTitles:[\"Center\",\"Top\",\"Bottom\",\"Left\",\"Right\",\"Top Left\",\"Top Right\",\"Bottom Left\",\"Bottom Right\"]},intensity:{type:ControlType.Number,title:\"Rotation Intensity\",defaultValue:20,min:0,max:50,step:1},perspective:{type:ControlType.Number,title:\"Perspective\",defaultValue:1e3,min:500,max:2e3,step:50,unit:\"px\"},parallaxIntensity:{type:ControlType.Number,title:\"Parallax Movement\",defaultValue:10,min:0,max:50,step:1,unit:\"px\"},shineIntensity:{type:ControlType.Number,title:\"Shine Size\",defaultValue:30,min:10,max:80,step:5,unit:\"%\"},shineColor:{type:ControlType.Color,title:\"Shine Color\",defaultValue:\"#FFFFFF\"},shineGradientEnd:{type:ControlType.Color,title:\"Shine Gradient End\",defaultValue:\"rgba(255,255,255,0.3)\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LookAtCursor\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LookAtCursor.map"],"mappings":"iWAIG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,YAAU,cAAY,oBAAkB,iBAAe,aAAW,mBAAiB,eAAa,kBAAgB,CAAC,EAAW,CAA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