{"version":3,"file":"Parallax_img.DvkO2WFa.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/gOIYmNJ1Ne1glg1XWbFY/3WojuPJwE4Ue7G9rZppA/Parallax_img.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";export function ParallaxImage({image,intensity,borderRadius,uniqueKey,altText}){const containerRef=useRef(null);const imageRef=useRef(null);let animationFrame=useRef(null);// Generate a unique key dynamically (prevents Framer key conflicts)\nconst[componentKey]=useState(uniqueKey||`parallax-${Math.random()}`);useEffect(()=>{const handleScroll=()=>{if(!containerRef.current||!imageRef.current)return;const rect=containerRef.current.getBoundingClientRect();const viewportHeight=window.innerHeight;const progress=rect.top/viewportHeight;// Apply a slower parallax movement\nconst moveY=progress*intensity*-5;// Smooth animation using requestAnimationFrame\ncancelAnimationFrame(animationFrame.current);animationFrame.current=requestAnimationFrame(()=>{imageRef.current.style.transform=`translateY(${moveY}px)`;});};window.addEventListener(\"scroll\",handleScroll);return()=>{window.removeEventListener(\"scroll\",handleScroll);cancelAnimationFrame(animationFrame.current);};},[intensity]);// Get image source (CMS image or direct URL)\nconst isCMSImage=typeof image===\"object\"&&image!==null&&\"url\"in image;const imageSrc=isCMSImage?image.url:image;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...containerStyle,borderRadius},children:/*#__PURE__*/_jsx(\"img\",{ref:imageRef,src:imageSrc,alt:altText,style:{...imageStyle,borderRadius}})},componentKey);}// Styles\nconst containerStyle={overflow:\"hidden\",position:\"relative\",width:\"100%\",height:\"100%\"};const imageStyle={position:\"absolute\",top:\"0%\",left:\"0\",height:\"105%\",width:\"100%\",objectFit:\"cover\",willChange:\"transform\"};// Framer Property Controls\naddPropertyControls(ParallaxImage,{image:{type:ControlType.Image,title:\"Select Image\"},altText:{type:ControlType.String,title:\"Alt Text\",defaultValue:\"Parallax Image\"},intensity:{type:ControlType.Number,title:\"Parallax Intensity\",min:5,max:100,step:1,defaultValue:20},borderRadius:{type:ControlType.Number,title:\"Border Radius\",min:0,max:100,step:1,defaultValue:0,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"ParallaxImage\":{\"type\":\"reactComponent\",\"name\":\"ParallaxImage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Parallax_img.map"],"mappings":"sMAA4I,SAAgB,EAAc,CAAC,QAAM,YAAU,eAAa,YAAU,WAAS,CAAC,IAAM,EAAaA,EAAO,IAAI,EAAQ,EAASA,EAAO,IAAI,EAAM,EAAeA,EAAO,IAAI,EACjT,CAAC,GAAcC,EAAS,GAAW,YAAY,KAAK,OAAO,GAAG,EAAE,MAAc,CAAC,IAAM,MAAiB,CAAC,GAAG,CAAC,EAAa,SAAS,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAK,EAAa,QAAQ,sBAAsB,EAAQ,EAAe,EAAO,YAC7O,EADwQ,EAAK,IAAI,EAClQ,EAAU,GAC/B,qBAAqB,EAAe,OAAO,EAAE,EAAe,QAAQ,0BAA0B,CAAC,EAAS,QAAQ,MAAM,UAAU,cAAc,EAAM,IAAK,CAAC,CAAE,EAAiD,OAA/C,EAAO,iBAAiB,SAAS,CAAY,MAAY,CAAC,EAAO,oBAAoB,SAAS,CAAY,EAAE,qBAAqB,EAAe,OAAO,CAAE,CAAE,EAAE,CAAC,CAAS,CAAC,EAChQ,IAAM,EAA3D,OAAO,GAAQ,UAAU,GAAc,QAAQ,EAAgC,EAAM,IAAI,EAAM,OAAoB,EAAK,MAAM,CAAC,IAAI,EAAa,MAAM,CAAC,GAAG,EAAe,cAAY,EAAE,SAAsB,EAAK,MAAM,CAAC,IAAI,EAAS,IAAI,EAAS,IAAI,EAAQ,MAAM,CAAC,GAAG,EAAW,cAAY,CAAC,CAAC,CAAC,EAAE,CAAY,CAAE,yBAJ1R,IAAoD,IAA6C,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