{"version":3,"file":"ImageReveal.CihMAUlo.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/rvsrl4LnrnPb5MGmpRll/SuucvW7xgWPRps3JGO7S/ImageReveal.js"],"sourcesContent":["// Reveal image on in-view\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * ImageReveal\n *\n * Reveals the image or video with a fade-in when the layer is in view.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ImageReveal(props){const{mediaType=\"image\",image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},video=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",revealDuration=.8,style,transitionEase=\"cubic-bezier(0.4,0,0.2,1)\",transitionDelay=0,replay=false,videoControls=true,videoAutoplay=true,videoLoop=true,videoMuted=true,revealDirection=\"bottom\"}=props;const ref=useRef(null);const[visible,setVisible]=useState(false);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic){startTransition(()=>setVisible(true));return;}if(!ref.current)return;let observer=null;function observe(){observer=new window.IntersectionObserver(([entry])=>{if(entry.isIntersecting){startTransition(()=>setVisible(true));if(!replay)observer?.disconnect();}else if(replay){startTransition(()=>setVisible(false));}},{threshold:.1});observer.observe(ref.current);}observe();return()=>observer?.disconnect();},[isStatic,replay]);const getClipPath=isVisible=>{if(isVisible)return\"inset(0 0 0 0)\";switch(revealDirection){case\"bottom\":return\"inset(0 0 100% 0)\";case\"top\":return\"inset(100% 0 0 0)\";case\"left\":return\"inset(0 0 0 100%)\";case\"right\":return\"inset(0 100% 0 0)\";default:return\"inset(0 0 100% 0)\";}};return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:props.backgroundColor,borderRadius:props.borderRadius,border:props.borderWidth?`${props.borderWidth}px solid ${props.borderColor}`:undefined},children:mediaType===\"image\"?/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:props.focalPoint||\"50% 50%\",opacity:visible?1:0,transition:`opacity ${revealDuration}s ${transitionEase} ${transitionDelay}s, clip-path ${revealDuration}s ${transitionEase} ${transitionDelay}s`,clipPath:getClipPath(visible)}}):/*#__PURE__*/_jsx(\"video\",{src:video,controls:videoControls,autoPlay:videoAutoplay,loop:videoLoop,muted:videoMuted,playsInline:true,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:props.focalPoint||\"50% 50%\",opacity:visible?1:0,transition:`opacity ${revealDuration}s ${transitionEase} ${transitionDelay}s, clip-path ${revealDuration}s ${transitionEase} ${transitionDelay}s`,clipPath:getClipPath(visible)}})});}addPropertyControls(ImageReveal,{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===\"video\"},video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({mediaType})=>mediaType===\"image\"},videoAutoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({mediaType})=>mediaType===\"image\"},videoLoop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({mediaType})=>mediaType===\"image\"},videoMuted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({mediaType})=>mediaType===\"image\"},videoControls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:({mediaType})=>mediaType===\"image\"},revealDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"bottom\",\"top\",\"left\",\"right\"],optionTitles:[\"Bottom\",\"Top\",\"Left\",\"Right\"],defaultValue:\"bottom\",displaySegmentedControl:true},revealDuration:{type:ControlType.Number,title:\"Fade Duration\",defaultValue:.8,min:.1,max:3,step:.1,unit:\"s\",displayStepper:true},transitionEase:{type:ControlType.String,title:\"Ease\",defaultValue:\"cubic-bezier(0.4,0,0.2,1)\",placeholder:\"e.g. ease, linear, cubic-bezier(...)\"},transitionDelay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:2,step:.05,unit:\"s\",displayStepper:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:64,step:1,unit:\"px\",displayStepper:true},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:0,min:0,max:16,step:1,unit:\"px\",displayStepper:true},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#222222\",hidden:({borderWidth})=>borderWidth===0},focalPoint:{type:ControlType.String,title:\"Focal Point\",defaultValue:\"50% 50%\",placeholder:\"e.g. 50% 50%, top left, 30% 70%\",description:\"Set the image focal point (object-position). Example: 50% 50%, top left, 30% 70%\"},replay:{type:ControlType.Boolean,title:\"Replay on Scroll\",defaultValue:false,enabledTitle:\"Replay\",disabledTitle:\"Once\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":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