{"version":3,"file":"ScrollParallaxImageStack.CKd8ZqfC.mjs","names":["React.useRef","React.useMemo","__esmMin","init_npm_react_18_3_1","pe","init_jsx_runtime","c","de","useTransform","motion","useScroll","useSpring","init_framer_motion_DhsWWWsN","useIsStaticRenderer","addPropertyControls","init_framer_CN96F41L","ControlType","clamp","max","min","value","applyEasing","easing","magnitude","ScrollParallaxLayer","props","x","factor","enabled","fixed","base","intensity","depth","direction","y","alt","imageFit","ScrollParallaxImageStack","defaultImages","containerRef","isStaticRenderer","validImages","images","item","centeredFactor","scrollYProgress","clamped","progress","smoothFactor","style","image","index","firstImageFixed","init_ScrollParallaxImageStack"],"sources":["https:/framerusercontent.com/modules/mIooYVxJB4oEwwbKqdOn/0z18O55F70f64VxquG1u/ScrollParallaxImageStack.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useScroll,useSpring,useTransform}from\"framer-motion\";const defaultImages=[{image:{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",alt:\"Gradient 5 - Green\"}},{image:{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",alt:\"Gradient 4 - Yellow\"}},{image:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}}];function clamp(value,min,max){return Math.min(max,Math.max(min,value));}function applyEasing(magnitude,easing){if(easing===\"linear\")return magnitude;if(easing===\"easeIn\")return magnitude*magnitude;if(easing===\"easeOut\")return 1-(1-magnitude)*(1-magnitude);if(magnitude<.5)return 2*magnitude*magnitude;return 1-Math.pow(-2*magnitude+2,2)/2;}function ScrollParallaxLayer(props){const{src,srcSet,alt,depth,zIndex,enabled,fixed,imageFit,direction,intensity,factor}=props;const x=useTransform(factor,value=>{if(!enabled||fixed)return 0;const base=value*intensity*depth;if(direction===\"leftToRight\")return base;if(direction===\"rightToLeft\")return-base;return 0;});const y=useTransform(factor,value=>{if(!enabled||fixed)return 0;const base=value*intensity*depth;if(direction===\"topToBottom\")return base;if(direction===\"bottomToTop\")return-base;return 0;});return /*#__PURE__*/_jsx(motion.img,{src:src,srcSet:srcSet,alt:alt||\"\",draggable:false,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:imageFit===\"fill\"?\"cover\":\"contain\",objectPosition:\"center center\",pointerEvents:\"none\",zIndex,x,y,willChange:\"transform\",transformOrigin:\"center center\"}});}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ScrollParallaxImageStack(props){const{images=defaultImages,firstImageFixed=false,intensity=60,direction=\"topToBottom\",easing=\"easeOut\",imageFit=\"fit\",style}=props;const containerRef=React.useRef(null);const isStaticRenderer=useIsStaticRenderer();const validImages=React.useMemo(()=>{return(images||[]).filter(item=>Boolean(item?.image?.src));},[images]);const{scrollYProgress}=useScroll({target:containerRef,offset:[\"start end\",\"end start\"]});const centeredFactor=useTransform(scrollYProgress,progress=>{const normalized=(progress-.5)*2;const clamped=clamp(normalized,-1,1);const sign=clamped<0?-1:1;const easedMagnitude=applyEasing(Math.abs(clamped),easing);return sign*easedMagnitude;});const smoothFactor=useSpring(centeredFactor,{stiffness:170,damping:24,mass:.35});return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:style?.width??420,height:style?.height??280,overflow:\"visible\",...style},children:validImages.map((item,index)=>{const image=item.image;if(!image?.src)return null;const depth=validImages.length<=1?1:(index+1)/validImages.length;return /*#__PURE__*/_jsx(ScrollParallaxLayer,{src:image.src,srcSet:image.srcSet,alt:image.alt||\"\",depth:depth,zIndex:index,enabled:!isStaticRenderer,fixed:firstImageFixed&&index===0,imageFit:imageFit,direction:direction,intensity:intensity,factor:smoothFactor},`${image.src}-${index}`);})});}addPropertyControls(ScrollParallaxImageStack,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Object,controls:{image:{type:ControlType.ResponsiveImage,title:\"Image\"}}},defaultValue:defaultImages,maxCount:20},firstImageFixed:{type:ControlType.Boolean,title:\"First Image Fixed\",enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:false},intensity:{type:ControlType.Number,title:\"Intensity\",min:0,max:400,step:1,unit:\"px\",defaultValue:60},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"topToBottom\",\"bottomToTop\",\"leftToRight\",\"rightToLeft\"],optionTitles:[\"Top → Bottom\",\"Bottom → Top\",\"Left → Right\",\"Right → Left\"],defaultValue:\"topToBottom\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\"},imageFit:{type:ControlType.Enum,title:\"Image Fit\",options:[\"fit\",\"fill\"],optionTitles:[\"Fit\",\"Fill\"],defaultValue:\"fit\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollParallaxImageStack\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollParallaxImageStack.map"],"mappings":"A,mQAAgjB,SAASiB,EAAM,EAAM,EAAI,EAAI,CAAC,OAAO,KAAK,IAAIC,EAAI,KAAK,IAAIC,EAAIC,CAAK,CAAC,CAAE,CAAC,SAASC,EAAY,EAAU,EAAO,CAA+L,OAA3LC,IAAS,SAAgBC,EAAaD,IAAS,SAAgBC,EAAUA,EAAaD,IAAS,UAAiB,GAAG,EAAEC,IAAY,EAAEA,GAAcA,EAAU,GAAU,EAAEA,EAAUA,EAAiB,GAAW,GAAGA,EAAU,IAAE,EAAG,CAAE,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