{"version":3,"file":"ImageParallaxHorizontal.BR7mU5VM.mjs","names":["React.useRef","React.useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","c","ce","window","addPropertyControls","init_framer_BL70qLPA","ControlType","ImageParallaxHorizontal","rest","props","containerRef","translateX","setTranslateX","ready","setReady","calculateParallax","rect","windowWidth","elementWidth","startPosition","endPosition","totalTravel","progress","parallax","image","init_ImageParallaxHorizontal"],"sources":["https:/framerusercontent.com/modules/feXRJ0itnCTO7c2NoCYF/WMqCIxfvOFU74t1bxtyS/ImageParallaxHorizontal.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 300\n */export default function ImageParallaxHorizontal(props){const{image,parallax=100,...rest}=props;const containerRef=React.useRef(null);const[translateX,setTranslateX]=React.useState(0);const[ready,setReady]=React.useState(false);React.useEffect(()=>{if(typeof window===\"undefined\")return;const calculateParallax=()=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const windowWidth=window.innerWidth;const elementWidth=rect.width;const startPosition=windowWidth-rect.left;const endPosition=-rect.right;const totalTravel=windowWidth+elementWidth;let progress=0;if(startPosition>=0&&endPosition<=0){progress=startPosition/totalTravel;}else if(startPosition<0){progress=0;}else if(endPosition>0){progress=1;}setTranslateX(parallax-progress*parallax);setReady(true);};window.addEventListener(\"scroll\",calculateParallax);calculateParallax();return()=>window.removeEventListener(\"scroll\",calculateParallax);},[parallax]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{overflow:\"hidden\",position:\"relative\",backgroundColor:\"#ffffff\",...rest.style},children:image&&ready&&/*#__PURE__*/_jsx(\"img\",{src:image,style:{width:`calc(100% + ${parallax}px)`,height:\"100%\",objectFit:\"cover\",transform:`translateX(${-translateX}px)`},alt:\"Parallax Image\"})});}addPropertyControls(ImageParallaxHorizontal,{image:{type:ControlType.Image,title:\"Image\"},parallax:{type:ControlType.Number,title:\"Parallax\",defaultValue:100,min:0,max:300,step:10,description:\"Component made by Anton Drukarov\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageParallaxHorizontal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"300\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageParallaxHorizontal.map"],"mappings":"A,sMAQG,SAAwBc,EAAwB,EAAM,CAAC,GAAK,CAAC,QAAM,WAAS,IAAI,GAAGC,GAAMC,EAAYC,EAAajB,EAAa,IAAI,EAAO,CAACkB,EAAWC,GAAelB,EAAe,CAAC,EAAO,CAACmB,EAAMC,GAAUpB,EAAe,EAAK,EAAytB,OAAvtBQ,MAAoB,CAAC,GAAUC,IAAS,OAAY,OAAO,IAAMY,MAAsB,CAAC,GAAG,CAACL,EAAa,QAAQ,OAAO,IAAMM,EAAKN,EAAa,QAAQ,sBAAsB,EAAQO,EAAYd,EAAO,WAAiBe,EAAaF,EAAK,MAAYG,EAAcF,EAAYD,EAAK,KAAWI,EAAY,CAACJ,EAAK,MAAYK,EAAYJ,EAAYC,EAAiBI,EAAS,EAAKH,GAAe,GAAGC,GAAa,EAAG,EAASD,EAAcE,EAAqBF,EAAc,EAAG,EAAS,EAAWC,EAAY,IAAG,EAAS,GAAGR,EAAcW,EAASD,EAASC,CAAQ,EAAET,EAAS,EAAI,CAAE,EAA0E,OAAxEX,EAAO,iBAAiB,SAASY,CAAiB,EAAEA,EAAkB,MAAYZ,EAAO,oBAAoB,SAASY,CAAiB,CAAE,EAAE,CAACQ,CAAQ,C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