{"version":3,"file":"HoverImageSpread.ow1kC3VC.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/9H7O1qRIzxjJXRXo5oCb/p7okwJgVWahLtY39m82O/HoverImageSpread.js"],"sourcesContent":["// Playful image hover effect with background images that spread out from the main image\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion}from\"framer-motion\";/**\n * 3D Image Hover Effect\n * \n * A component with 3D tilt and cursor following effects\n * \n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 300\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageHover3D(props){const{mainImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Main image\"},imageOpacity=1,followCursor=true,followStrength=20,enable3D=true,tiltStrength=15,keepTiltOnLeave=false,imageAlignment=\"center\",resetSpeed=.3}=props;const[isHovered,setIsHovered]=useState(false);const[mousePosition,setMousePosition]=useState({x:0,y:0});const[tiltAngles,setTiltAngles]=useState({rotateX:0,rotateY:0});const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const handleMouseEnter=()=>{if(!isStatic){startTransition(()=>setIsHovered(true));}};const handleMouseLeave=()=>{if(!isStatic){startTransition(()=>setIsHovered(false));startTransition(()=>setMousePosition({x:0,y:0}));if(!keepTiltOnLeave){startTransition(()=>setTiltAngles({rotateX:0,rotateY:0}));}}};const handleMouseMove=e=>{if(!isStatic&&containerRef.current){const rect=containerRef.current.getBoundingClientRect();const centerX=rect.width/2;const centerY=rect.height/2;const x=e.clientX-rect.left-centerX;const y=e.clientY-rect.top-centerY;if(followCursor){// Normalize and apply follow strength as percentage of container size\nconst normalizedX=x/centerX*(followStrength/100)*centerX;const normalizedY=y/centerY*(followStrength/100)*centerY;startTransition(()=>setMousePosition({x:normalizedX,y:normalizedY}));}if(enable3D){// Calculate 3D tilt angles\nconst rotateY=x/centerX*tiltStrength;const rotateX=-(y/centerY)*tiltStrength;startTransition(()=>setTiltAngles({rotateX,rotateY}));}}};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:imageAlignment===\"top\"?\"flex-start\":\"center\",justifyContent:\"center\",overflow:\"visible\",cursor:\"pointer\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,onMouseMove:handleMouseMove,children:/*#__PURE__*/_jsx(motion.div,{animate:{scale:isHovered?1.05:1,zIndex:isHovered?10:5,x:followCursor?mousePosition.x:0,y:followCursor?mousePosition.y:0,rotateX:enable3D?tiltAngles.rotateX:0,rotateY:enable3D?tiltAngles.rotateY:0},transition:{duration:isHovered?.3:resetSpeed,ease:\"easeOut\"},style:{position:\"relative\",width:\"100%\",height:\"100%\",borderRadius:\"12px\",overflow:\"hidden\",transformStyle:\"preserve-3d\"},children:/*#__PURE__*/_jsx(\"img\",{src:mainImage.src,alt:mainImage.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",opacity:imageOpacity}})})});}addPropertyControls(ImageHover3D,{mainImage:{type:ControlType.ResponsiveImage,title:\"Main Image\"},imageAlignment:{type:ControlType.Enum,title:\"Image Alignment\",options:[\"center\",\"top\"],optionTitles:[\"Center\",\"Top\"],defaultValue:\"center\",displaySegmentedControl:true},imageOpacity:{type:ControlType.Number,title:\"Image Opacity\",defaultValue:1,min:0,max:1,step:.1},followCursor:{type:ControlType.Boolean,title:\"Cursor Following\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},followStrength:{type:ControlType.Number,title:\"Cursor Follow Distance\",defaultValue:20,min:5,max:50,step:5,unit:\"%\",hidden:({followCursor})=>!followCursor},enable3D:{type:ControlType.Boolean,title:\"3D Tilt Effect\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},tiltStrength:{type:ControlType.Number,title:\"3D Tilt Intensity\",defaultValue:15,min:5,max:30,step:1,unit:\"deg\",hidden:({enable3D})=>!enable3D},keepTiltOnLeave:{type:ControlType.Boolean,title:\"Maintain Tilt After Hover\",defaultValue:false,enabledTitle:\"Keep\",disabledTitle:\"Reset\",hidden:({enable3D})=>!enable3D},resetSpeed:{type:ControlType.Number,title:\"Reset Speed\",defaultValue:.3,min:.1,max:2,step:.1,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageHover3D\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"300\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HoverImageSpread.map"],"mappings":"iPAWG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,CAAC,IAAI,sEAAsE,IAAI,aAAa,CAAC,eAAa,EAAE,eAAa,GAAK,iBAAe,GAAG,WAAS,GAAK,eAAa,GAAG,kBAAgB,GAAM,iBAAe,SAAS,aAAW,IAAI,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAc,GAAkBA,EAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAM,CAAC,EAAW,GAAeA,EAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAS,GAAqB,CAErZ,OAAoB,EAAK,MAAM,CAAC,IAAI,EAAa,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,QAAQ,OAAO,WAAW,IAAiB,MAAM,aAAa,SAAS,eAAe,SAAS,SAAS,UAAU,OAAO,UAAU,CAAC,iBAFsM,CAAK,GAAU,MAAoB,EAAa,GAAK,CAAC,EAE9N,iBAF6P,CAAK,IAAU,MAAoB,EAAa,GAAM,CAAC,CAAC,MAAoB,EAAiB,CAAC,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