{"version":3,"file":"ImageScroll.C809UT0g.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","de","init_jsx_runtime","c","p","ce","_e","useInView","init_framer_motion_DbYmcygs","addPropertyControls","init_framer_DPhDUVVB","ControlType","useIsStaticRenderer","ImageScroll","props","imageRef","containerRef","isStatic","isInView","isInViewOnScreen","hasTriggered","setHasTriggered","hasAnimated","setHasAnimated","element","scale","shouldTrigger","trigger","autoPlay","timeoutId","duration","getEasingFunction","easing","handleTransitionEnd","loop","yoyo","delay","image","init_ImageScroll"],"sources":["https:/framerusercontent.com/modules/AlGMSdh546QHMJSzAoPj/JFUF5n7JAYeNuSwfisTA/ImageScroll.js"],"sourcesContent":["// Image component that animates from top to bottom using GSAP\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ImageScroll(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},duration,delay,easing,autoPlay,trigger,loop,yoyo,scale=1.1}=props;const imageRef=useRef(null);const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const isInView=useInView(containerRef,{once:true});const isInViewOnScreen=useInView(containerRef,{once:false,amount:.3});const[hasTriggered,setHasTriggered]=useState(false);const[hasAnimated,setHasAnimated]=useState(false);useEffect(()=>{if(isStatic||!imageRef.current||hasAnimated)return;const element=imageRef.current;// Set initial state (starts from top)\nelement.style.clipPath=\"inset(0 0 100% 0)\";element.style.transform=`scale(${scale})`;element.style.transition=\"none\";// Determine if animation should trigger\nlet shouldTrigger=false;if(trigger===\"onAppear\"&&autoPlay){shouldTrigger=true;}else if(trigger===\"onScroll\"&&isInView&&!hasTriggered){shouldTrigger=true;setHasTriggered(true);}else if(trigger===\"onScreen\"&&isInViewOnScreen&&!hasAnimated){shouldTrigger=true;}if(!shouldTrigger)return;// Start animation after delay\nconst timeoutId=setTimeout(()=>{element.style.transition=`clip-path ${duration}s ${getEasingFunction(easing)}, transform ${duration}s ${getEasingFunction(easing)}`;element.style.clipPath=\"inset(0% 0 0 0)\";element.style.transform=\"scale(1.0)\";// Mark as animated once the animation completes\nconst handleTransitionEnd=()=>{setHasAnimated(true);element.removeEventListener(\"transitionend\",handleTransitionEnd);};element.addEventListener(\"transitionend\",handleTransitionEnd);if(loop){const handleTransitionEnd=()=>{if(yoyo){// Reverse animation\nsetTimeout(()=>{element.style.clipPath=\"inset(0 0 100% 0)\";element.style.transform=`scale(${scale})`;},100);}else{// Reset and repeat\nelement.style.transition=\"none\";element.style.clipPath=\"inset(0 0 100% 0)\";element.style.transform=`scale(${scale})`;setTimeout(()=>{element.style.transition=`clip-path ${duration}s ${getEasingFunction(easing)}, transform ${duration}s ${getEasingFunction(easing)}`;element.style.clipPath=\"inset(0% 0 0 0)\";element.style.transform=\"scale(1.0)\";},100);}};element.addEventListener(\"transitionend\",handleTransitionEnd);return()=>element.removeEventListener(\"transitionend\",handleTransitionEnd);}},delay*1e3);return()=>{clearTimeout(timeoutId);};},[duration,delay,easing,autoPlay,trigger,isInView,isInViewOnScreen,hasTriggered,hasAnimated,isStatic,loop,yoyo,scale]);const getEasingFunction=easing=>{switch(easing){case\"power2.out\":return\"cubic-bezier(0.25, 0.46, 0.45, 0.94)\";case\"power2.in\":return\"cubic-bezier(0.55, 0.06, 0.68, 0.19)\";case\"power2.inOut\":return\"cubic-bezier(0.65, 0.05, 0.36, 1)\";case\"bounce.out\":return\"cubic-bezier(0.68, -0.55, 0.265, 1.55)\";case\"elastic.out\":return\"cubic-bezier(0.68, -0.55, 0.265, 1.55)\";case\"back.out\":return\"cubic-bezier(0.175, 0.885, 0.32, 1.275)\";default:return\"cubic-bezier(0.25, 0.46, 0.45, 0.94)\";}};const playAnimation=()=>{if(isStatic||!imageRef.current||hasAnimated)return;const element=imageRef.current;element.style.transition=\"none\";element.style.clipPath=\"inset(0 0 100% 0)\";element.style.transform=`scale(${scale})`;setTimeout(()=>{element.style.transition=`clip-path ${duration}s ${getEasingFunction(easing)}, transform ${duration}s ${getEasingFunction(easing)}`;element.style.clipPath=\"inset(0% 0 0 0)\";element.style.transform=\"scale(1.0)\";const handleTransitionEnd=()=>{setHasAnimated(true);element.removeEventListener(\"transitionend\",handleTransitionEnd);};element.addEventListener(\"transitionend\",handleTransitionEnd);},delay*1e3+50);};if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#f5f5f5\"},children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}})});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"img\",{ref:imageRef,src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",transform:`scale(${scale})`}}),trigger===\"manual\"&&/*#__PURE__*/_jsx(\"button\",{onClick:playAnimation,style:{position:\"absolute\",bottom:\"16px\",right:\"16px\",padding:\"8px 16px\",backgroundColor:\"rgba(0, 0, 0, 0.7)\",color:\"white\",border:\"none\",borderRadius:\"4px\",cursor:\"pointer\",fontSize:\"14px\"},children:\"Play Animation\"})]});}addPropertyControls(ImageScroll,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},trigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"onAppear\",\"onScroll\",\"onScreen\",\"manual\"],optionTitles:[\"On Appear\",\"On Scroll\",\"On Screen\",\"Manual\"],defaultValue:\"onAppear\"},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({trigger})=>trigger!==\"onAppear\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1,min:.1,max:5,step:.1,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:3,step:.1,unit:\"s\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"power2.out\",\"power2.in\",\"power2.inOut\",\"bounce.out\",\"elastic.out\",\"back.out\"],optionTitles:[\"Ease Out\",\"Ease In\",\"Ease In Out\",\"Bounce\",\"Elastic\",\"Back\"],defaultValue:\"power2.out\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},yoyo:{type:ControlType.Boolean,title:\"Yoyo\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({loop})=>!loop},scale:{type:ControlType.Number,title:\"Scale\",defaultValue:1.1,min:1,max:2,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageScroll.map"],"mappings":"A,wPAMG,SAAwBgB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,EAAE,WAAS,QAAM,SAAO,WAAS,UAAQ,OAAK,OAAK,QAAM,KAAKC,EAAYC,EAASlB,EAAO,IAAI,EAAQmB,EAAanB,EAAO,IAAI,EAAQoB,EAASL,EAAoB,EAAQM,EAASX,EAAUS,EAAa,CAAC,KAAK,EAAI,CAAC,EAAQG,EAAiBZ,EAAUS,EAAa,CAAC,KAAK,GAAM,OAAO,EAAE,CAAC,EAAO,CAACI,EAAaC,GAAiBvB,EAAS,EAAK,EAAO,CAACwB,EAAYC,GAAgBzB,EAAS,EAAK,EAAEO,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