{"version":3,"file":"MouseParallax3D.B2CVou48.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/C7iVO4YLQUyEJMIyNPk5/XBoloXiDTPB5LtSolM8j/MouseParallax3D.js"],"sourcesContent":["// 3D Mouse Parallax Effect with intensity, smoothness, and max rotation controls\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useSpring,useMotionValue}from\"framer-motion\";/**\n * 3D Mouse Parallax Effect\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function MouseParallax3D(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},intensity=20,smoothness=150,maxRotation=15,perspective=1e3,style}=props;const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const rotateX=useMotionValue(0);const rotateY=useMotionValue(0);const springConfig={damping:smoothness,stiffness:400};const rotateXSpring=useSpring(rotateX,springConfig);const rotateYSpring=useSpring(rotateY,springConfig);useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const handleMouseMove=e=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const mouseX=e.clientX-centerX;const mouseY=e.clientY-centerY;const percentX=mouseX/(rect.width/2)*intensity;const percentY=mouseY/(rect.height/2)*intensity;const clampedRotateY=Math.max(-maxRotation,Math.min(maxRotation,percentX));const clampedRotateX=Math.max(-maxRotation,Math.min(maxRotation,-percentY));rotateX.set(clampedRotateX);rotateY.set(clampedRotateY);};const handleMouseLeave=()=>{rotateX.set(0);rotateY.set(0);};window.addEventListener(\"mousemove\",handleMouseMove);if(containerRef.current){containerRef.current.addEventListener(\"mouseleave\",handleMouseLeave);}return()=>{window.removeEventListener(\"mousemove\",handleMouseMove);if(containerRef.current){containerRef.current.removeEventListener(\"mouseleave\",handleMouseLeave);}};},[intensity,maxRotation,rotateX,rotateY,isStatic]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",perspective:`${perspective}px`,position:\"relative\"},children:/*#__PURE__*/_jsx(motion.div,{style:{width:\"100%\",height:\"100%\",rotateX:isStatic?0:rotateXSpring,rotateY:isStatic?0:rotateYSpring,transformStyle:\"preserve-3d\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:image&&/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",pointerEvents:\"none\"}})})});}addPropertyControls(MouseParallax3D,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},intensity:{type:ControlType.Number,title:\"Intensity\",defaultValue:20,min:0,max:50,step:1},smoothness:{type:ControlType.Number,title:\"Smoothness\",defaultValue:150,min:10,max:300,step:10},maxRotation:{type:ControlType.Number,title:\"Max Rotation\",defaultValue:15,min:0,max:45,step:1,unit:\"deg\"},perspective:{type:ControlType.Number,title:\"Perspective\",defaultValue:1e3,min:100,max:2e3,step:50,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MouseParallax3D\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"400\",\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MouseParallax3D.map"],"mappings":"sQASG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,YAAU,GAAG,aAAW,IAAI,cAAY,GAAG,cAA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