{"version":3,"file":"ParallaxImage.BcirJsAs.mjs","names":["useRef","useCallback","useMemo","__esmMin","init_ssg_sandbox_shims","ne","window","de","init_jsx_runtime","pe","init_npm_react_18_3_1","ce","useInView","init_framer_motion_DhsWWWsN","init_framer_B6PCHH0A","useIsStaticRenderer","addPropertyControls","ControlType","ParallaxImage","props","containerRef","imageRef","isStatic","isInView","rafRef","handleScroll","enableParallax","rect","windowHeight","parallaxOffset","speed","finalOffset","direction","scale","containerStyle","imageWrapperStyle","imageStyle","focalPoint","objectFit","image","init_ParallaxImage"],"sources":["https:/framerusercontent.com/modules/WIxQ14ScS2r1gkVB9iNj/33L2A2cAKugHAI4hInTr/ParallaxImage.js"],"sourcesContent":["// Parallax scrolling image component with configurable size and image upload\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useCallback,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ParallaxImage(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},speed,scale,direction,objectFit,focalPoint,enableParallax}=props;const containerRef=useRef(null);const imageRef=useRef(null);const isStatic=useIsStaticRenderer();const isInView=useInView(containerRef,{once:false,amount:0});const rafRef=useRef(null);const handleScroll=useCallback(()=>{if(!enableParallax||!isInView)return;// Cancel any pending animation frame\nif(rafRef.current!==null){cancelAnimationFrame(rafRef.current);}rafRef.current=requestAnimationFrame(()=>{if(!containerRef.current||!imageRef.current)return;const rect=containerRef.current.getBoundingClientRect();const windowHeight=window.innerHeight;// Only animate if in view\nif(rect.bottom<0||rect.top>windowHeight)return;const scrollProgress=(windowHeight-rect.top)/(windowHeight+rect.height);// Center the progress around 0.5 so the image is centered when the container is centered\nconst parallaxOffset=(scrollProgress-.5)*speed*100;const finalOffset=direction===\"down\"?parallaxOffset:-parallaxOffset;imageRef.current.style.transform=`translateY(${finalOffset}px) scale(${scale})`;});},[speed,scale,direction,enableParallax,isInView]);useEffect(()=>{if(isStatic||!enableParallax||!isInView)return;if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",handleScroll,{passive:true});// Initial calculation\nhandleScroll();}return()=>{if(typeof window!==\"undefined\"){window.removeEventListener(\"scroll\",handleScroll);}if(rafRef.current!==null){cancelAnimationFrame(rafRef.current);}};},[handleScroll,isStatic,enableParallax,isInView]);const containerStyle=useMemo(()=>({width:\"100%\",height:\"100%\",overflow:\"hidden\",position:\"relative\"}),[]);const imageWrapperStyle=useMemo(()=>({width:\"100%\",height:\"100%\",transform:enableParallax?`scale(${scale})`:\"none\",willChange:enableParallax&&isInView?\"transform\":\"auto\"}),[enableParallax,scale,isInView]);const imageStyle=useMemo(()=>({width:\"100%\",height:\"100%\",objectFit:objectFit,objectPosition:focalPoint,display:\"block\"}),[objectFit,focalPoint]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:containerStyle,children:/*#__PURE__*/_jsx(\"div\",{ref:imageRef,style:imageWrapperStyle,children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Parallax image\",style:imageStyle})})});}addPropertyControls(ParallaxImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},enableParallax:{type:ControlType.Boolean,title:\"Parallax\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"fill\",\"contain\",\"cover\",\"none\",\"scale-down\"],optionTitles:[\"Fill\",\"Contain\",\"Cover\",\"None\",\"Scale Down\"],defaultValue:\"cover\"},focalPoint:{type:ControlType.Enum,title:\"Focal Point\",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\"],defaultValue:\"center\"},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"up\",\"down\"],optionTitles:[\"↑ Up\",\"↓ Down\"],defaultValue:\"down\",displaySegmentedControl:true,hidden:({enableParallax})=>!enableParallax},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:.5,min:-2,max:2,step:.1,displayStepper:true,hidden:({enableParallax})=>!enableParallax},scale:{type:ControlType.Number,title:\"Scale\",defaultValue:1.2,min:1,max:2,step:.1,displayStepper:true,hidden:({enableParallax})=>!enableParallax}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParallaxImage.map"],"mappings":"A,iQAIG,SAAwBkB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,EAAE,QAAM,QAAM,YAAU,YAAU,aAAW,kBAAgBC,EAAYC,EAAapB,EAAO,IAAI,EAAQqB,EAASrB,EAAO,IAAI,EAAQsB,EAASP,EAAoB,EAAQQ,EAASX,EAAUQ,EAAa,CAAC,KAAK,GAAM,OAAO,CAAC,CAAC,EAAQI,EAAOxB,EAAO,IAAI,EAAQyB,EAAaxB,MAAgB,CAAKyB,GAAiBH,IAC/cC,EAAO,UAAU,MAAM,qBAAqBA,EAAO,OAAO,EAAG,EAAO,QAAQ,0BAA0B,CAAC,GAAG,CAACJ,EAAa,SAAS,CAACC,EAAS,QAAQ,OAAO,IAAMM,EAAKP,EAAa,QAAQ,sBAAsB,EAAQQ,EAAatB,EAAO,YAC/O,GAAGqB,EAAK,OAAO,GAAGA,EAAK,IAAIC,EAAa,OACxC,IAAMC,IAD+DD,EAAaD,EAAK,MAAMC,EAAaD,EAAK,QAC1E,IAAIG,EAAM,IAAUC,EAAY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