{"version":3,"file":"WipeImage.B2kcyt6p.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/mvkRD5UOnnUCcc420bbS/sfTxu0DwhAnpd2W3U834/WipeImage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef}from\"react\";const easings={smooth:[.22,1,.36,1],soft:[.33,1,.68,1],expo:[.16,1,.3,1],inout:[.65,0,.35,1]};// The reveal travels in the chosen direction, so the mask starts\n// collapsed on the opposite edge.\nconst hiddenClip={right:\"inset(0% 100% 0% 0%)\",left:\"inset(0% 0% 0% 100%)\",down:\"inset(0% 0% 100% 0%)\",up:\"inset(100% 0% 0% 0%)\"};const shownClip=\"inset(0% 0% 0% 0%)\";function driftFor(direction,drift){switch(direction){case\"left\":return{x:drift,y:0};case\"down\":return{x:0,y:-drift};case\"up\":return{x:0,y:drift};default:return{x:-drift,y:0};}}/**\n * Wipe Image\n *\n * An image that reveals itself with a directional wipe.\n *\n * @framerIntrinsicWidth 374\n * @framerIntrinsicHeight 525\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function WipeImage(props){const{image={src:\"https://framerusercontent.com/images/lTGPXF8cH3SSSpjU4FE3RVkApYw.png\",alt:\"\"},direction=\"right\",trigger=\"layer\",amount=.3,replay=false,duration=1.2,delay=0,easing=\"smooth\",fit=\"cover\",radius=\"0px\",drift=48,zoom=1.06,style}=props;const ref=useRef(null);const isStatic=useIsStaticRenderer();// \"Section in view\" fires early by extending the observed area a fifth of\n// a viewport past the bottom edge, so the wipe has already run by the time\n// the image is properly on screen.\nconst inView=useInView(ref,{once:!replay,amount:trigger===\"section\"?0:amount,margin:trigger===\"section\"?\"0px 0px 20% 0px\":undefined});const revealed=isStatic||trigger===\"appear\"||inView;const offset=driftFor(direction,drift);const transition={duration,delay,ease:easings[easing]??easings.smooth};const frameStyle={...style,position:\"relative\",overflow:\"hidden\",borderRadius:radius};// The canvas shows the finished state so the layer stays easy to position.\nif(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:frameStyle,children:/*#__PURE__*/_jsx(\"img\",{src:image?.src,srcSet:image?.srcSet,alt:image?.alt??\"\",style:{width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\"}})});}return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:frameStyle,children:/*#__PURE__*/_jsx(motion.div,{initial:{clipPath:hiddenClip[direction]},animate:{clipPath:revealed?shownClip:hiddenClip[direction]},transition:transition,style:{width:\"100%\",height:\"100%\",willChange:\"clip-path\"},children:/*#__PURE__*/_jsx(motion.img,{src:image?.src,srcSet:image?.srcSet,alt:image?.alt??\"\",initial:{x:offset.x,y:offset.y,scale:zoom},animate:revealed?{x:0,y:0,scale:1}:{x:offset.x,y:offset.y,scale:zoom},transition:transition,style:{width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\",willChange:\"transform\"}})})});}addPropertyControls(WipeImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},direction:{type:ControlType.Enum,title:\"Wipe\",options:[\"right\",\"left\",\"down\",\"up\"],optionTitles:[\"Right\",\"Left\",\"Down\",\"Up\"],defaultValue:\"right\",displaySegmentedControl:true},trigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"appear\",\"layer\",\"section\"],optionTitles:[\"On Appear\",\"Layer In View\",\"Section In View\"],defaultValue:\"layer\",description:\"When the wipe starts\"},amount:{type:ControlType.Number,title:\"Threshold\",defaultValue:.3,min:0,max:1,step:.05,hidden:({trigger})=>trigger!==\"layer\",description:\"How much of the layer must be visible\"},replay:{type:ControlType.Boolean,title:\"Replay\",defaultValue:false,hidden:({trigger})=>trigger===\"appear\",description:\"Run again every time it scrolls back in\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.2,min:.1,max:4,step:.05,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:3,step:.05,unit:\"s\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"smooth\",\"soft\",\"expo\",\"inout\"],optionTitles:[\"Smooth\",\"Soft\",\"Expo\",\"In Out\"],defaultValue:\"smooth\"},drift:{type:ControlType.Number,title:\"Drift\",defaultValue:48,min:0,max:200,step:1,unit:\"px\",description:\"Image slides in behind the wipe\"},zoom:{type:ControlType.Number,title:\"Zoom\",defaultValue:1.06,min:1,max:1.4,step:.01,description:\"Image settles back from a slight scale\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\",displaySegmentedControl:true},radius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WipeImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"374\",\"framerIntrinsicHeight\":\"525\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WipeImage.map"],"mappings":"0OAEuK,SAAS,EAAS,EAAU,EAAM,CAAC,OAAO,EAAP,CAAkB,IAAI,OAAO,MAAM,CAAC,EAAE,EAAM,EAAE,CAAC,EAAE,IAAI,OAAO,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAK,EAAE,IAAI,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAK,EAAE,QAAQ,MAAM,CAAC,EAAE,CAAC,EAAM,EAAE,CAAC,CAAE,CAAC,CAUnV,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,uEAAuE,IAAI,EAAE,EAAE,YAAU,QAAQ,UAAQ,QAAQ,SAAO,GAAG,SAAO,GAAM,WAAS,IAAI,QAAM,EAAE,SAAO,SAAS,MAAI,QAAQ,S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