{"version":3,"file":"Parallax.BBCnpDqB.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/51nUsCdtaNVANqxkdq5C/zyeM3BlPtM14rDugDQBU/Parallax.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,motion,RenderTarget,useScroll,useTransform}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Parallax({image,videoFile,amount,style}){const isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const[isTopOfPage,setIsTopOfPage]=useState(false);const{scrollYProgress}=useScroll({target:ref,offset:[\"start end\",\"end start\"]});const y=useTransform(scrollYProgress,[0,1],isTopOfPage?[`${amount*-1}%`,`${amount}%`]:[`${amount*-.5}%`,`${amount/2}%`]);const itemStyles={objectFit:\"cover\",width:\"100%\",height:\"100%\",scale:1.2,y:!isCanvas&&amount?y:undefined};useEffect(()=>{if(ref.current){const rect=ref.current.getBoundingClientRect();setIsTopOfPage(Math.abs(rect.top)<1);}},[]);return image||videoFile?/*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,overflow:\"hidden\"},children:videoFile?/*#__PURE__*/_jsx(motion.video,{src:videoFile,poster:image?.src,style:itemStyles,autoPlay:!isCanvas,playsInline:true,loop:true,muted:true}):image&&/*#__PURE__*/_jsx(motion.img,{src:image.src,srcSet:image.srcSet,alt:image.alt,style:{...itemStyles,objectPosition:`${image.positionX} ${image.positionY}`}})}):null;}addPropertyControls(Parallax,{image:{type:ControlType.ResponsiveImage},videoFile:{type:ControlType.File,allowedFileTypes:[\"mp4\"]},amount:{type:ControlType.Number,defaultValue:20,step:1,min:0}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Parallax\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\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