{"version":3,"file":"ParallaxImage.DsCwfoAF.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/n5jacmZHfmczJYnpxH0w/iewDDKJfsIAxTvFnsD3L/ParallaxImage.js"],"sourcesContent":["// Parallax scrolling image component with configurable size and image upload\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ParallaxImage(props){const{mediaType=\"image\",image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},video=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",speed,scale,direction}=props;const containerRef=useRef(null);const imageRef=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic)return;const handleScroll=()=>{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})`;};if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",handleScroll,{passive:true});// Initial calculation\nrequestAnimationFrame(handleScroll);}return()=>{if(typeof window!==\"undefined\"){window.removeEventListener(\"scroll\",handleScroll);}};},[speed,scale,direction,isStatic]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{ref:imageRef,style:{width:\"100%\",height:\"100%\",transform:`scale(${scale})`,willChange:\"transform\"},children:mediaType===\"image\"?/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Parallax image\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}):/*#__PURE__*/_jsx(\"video\",{src:video,autoPlay:true,loop:true,muted:true,playsInline:true,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})})});}addPropertyControls(ParallaxImage,{mediaType:{type:ControlType.Enum,title:\"Media Type\",options:[\"image\",\"video\"],optionTitles:[\"Image\",\"Video\"],defaultValue:\"image\",displaySegmentedControl:true},image:{type:ControlType.ResponsiveImage,title:\"Image\",hidden:({mediaType})=>mediaType!==\"image\"},video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({mediaType})=>mediaType!==\"video\"},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"up\",\"down\"],optionTitles:[\"↑ Up\",\"↓ Down\"],defaultValue:\"down\",displaySegmentedControl:true},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:.5,min:-2,max:2,step:.01,displayStepper:true},scale:{type:ControlType.Number,title:\"Scale\",defaultValue:1.2,min:1,max:2,step:.1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParallaxImage.map"],"mappings":"uMAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,YAAU,QAAQ,QAAM,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,QAAM,uEAAuE,QAAM,QAAM,aAAW,EAAY,EAAaA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAO,EAAS,GAAqB,CAGnN,OAHoN,MAAc,CAAC,GAAG,EAAS,OAAO,IAAM,MAAiB,CAAC,GAAG,CAAC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