{"version":3,"file":"ScrollRevealImage.BojMk4IP.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/629SWU8tVevk1coykbxL/5ccTxqfScnZrhvvGfeN7/ScrollRevealImage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Image that reveals from bottom to top on scroll\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollRevealImage(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},enableAnimation=true,revealDuration,revealEasing,revealDirection=\"bottom-to-top\",animationDuration=.9,animationDelay=0}=props;const containerRef=useRef(null);const[isRevealed,setIsRevealed]=useState(false);const[prefersReducedMotion,setPrefersReducedMotion]=useState(false);// Check for reduced motion preference\nuseEffect(()=>{if(typeof window===\"undefined\")return;const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");setPrefersReducedMotion(mediaQuery.matches);const handleChange=e=>{setPrefersReducedMotion(e.matches);};mediaQuery.addEventListener(\"change\",handleChange);return()=>mediaQuery.removeEventListener(\"change\",handleChange);},[]);// Set up IntersectionObserver for scroll trigger\nuseEffect(()=>{if(typeof window===\"undefined\"||!containerRef.current)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting&&!isRevealed){setIsRevealed(true);// Disconnect after first trigger to prevent replay\nobserver.disconnect();}});},{threshold:.1,rootMargin:\"0px\"});observer.observe(containerRef.current);return()=>observer.disconnect();},[isRevealed]);const getClipPathValues=()=>{switch(revealDirection){case\"bottom-to-top\":return{initial:\"inset(100% 0% 0% 0%)\",final:\"inset(0% 0% 0% 0%)\"};case\"top-to-bottom\":return{initial:\"inset(0% 0% 100% 0%)\",final:\"inset(0% 0% 0% 0%)\"};case\"left-to-right\":return{initial:\"inset(0% 100% 0% 0%)\",final:\"inset(0% 0% 0% 0%)\"};case\"right-to-left\":return{initial:\"inset(0% 0% 0% 100%)\",final:\"inset(0% 0% 0% 0%)\"};case\"middle-horizontal\":return{initial:\"inset(0% 50% 0% 50%)\",final:\"inset(0% 0% 0% 0%)\"};case\"middle-vertical\":return{initial:\"inset(50% 0% 50% 0%)\",final:\"inset(0% 0% 0% 0%)\"};default:return{initial:\"inset(100% 0% 0% 0%)\",final:\"inset(0% 0% 0% 0%)\"};}};const getEasingFunction=()=>{switch(revealEasing){case\"linear\":return\"linear\";case\"easeIn\":return\"cubic-bezier(0.42, 0, 1, 1)\";case\"easeOut\":return\"cubic-bezier(0, 0, 0.58, 1)\";case\"easeInOut\":return\"cubic-bezier(0.42, 0, 0.58, 1)\";default:return\"cubic-bezier(0, 0, 0.58, 1)\";}};const clipPathValues=getClipPathValues();const currentClipPath=!enableAnimation||prefersReducedMotion||isRevealed?clipPathValues.final:clipPathValues.initial;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",clipPath:currentClipPath,transition:!enableAnimation||prefersReducedMotion?\"none\":`clip-path ${animationDuration}s ${getEasingFunction()} ${animationDelay}s`},children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})})});}addPropertyControls(ScrollRevealImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},enableAnimation:{type:ControlType.Boolean,title:\"Animation\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},revealDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"bottom-to-top\",\"top-to-bottom\",\"left-to-right\",\"right-to-left\",\"middle-horizontal\",\"middle-vertical\"],optionTitles:[\"Bottom to Top\",\"Top to Bottom\",\"Left to Right\",\"Right to Left\",\"Middle Horizontal\",\"Middle Vertical\"],defaultValue:\"bottom-to-top\",displaySegmentedControl:false,hidden:({enableAnimation})=>!enableAnimation},animationDuration:{type:ControlType.Number,title:\"Duration\",defaultValue:.9,min:.1,max:5,step:.1,unit:\"s\",hidden:({enableAnimation})=>!enableAnimation},animationDelay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:3,step:.1,unit:\"s\",hidden:({enableAnimation})=>!enableAnimation},revealDuration:{type:ControlType.Number,title:\"Reveal Duration\",defaultValue:50,min:10,max:100,step:5,unit:\"%\",hidden:({enableAnimation})=>!enableAnimation},revealEasing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\",hidden:({enableAnimation})=>!enableAnimation}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollRevealImage\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollRevealImage.map"],"mappings":"sMAKG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,EAAE,kBAAgB,GAAK,iBAAe,eAAa,kBAAgB,gBAAgB,oBAAkB,GAAG,iBAAe,GAAG,EAAY,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAW,GAAeC,EAAS,EAAK,EAAO,CAAC,EAAqB,GAAyBA,EAAS,EAAK,EACpb,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAW,EAAO,WAAW,kCAAkC,EAAE,EAAwB,EAAW,OAAO,EAAE,IAAM,EAAa,GAAG,CAAC,EAAwB,EAAE,OAAO,CAAE,EAAqD,OAAnD,EAAW,iBAAiB,SAAS,CAAY,MAAY,EAAW,oBA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