{"version":3,"file":"ParallaxImageFrame.KA22LOCe.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","te","window","_e","de","init_jsx_runtime","init_npm_react_18_3_1","ce","motion","init_framer_motion_DhsWWWsN","init_framer_CaDWdxiz","addPropertyControls","RenderTarget","ControlType","useIsStaticRenderer","ParallaxImageFrame","props","containerRef","offset","setOffset","isStatic","inView","setInView","checkInView","rect","windowHeight","isInView","handleScroll","scrollY","frameHeight","focalY","image","parallax","style","init_ParallaxImageFrame"],"sources":["https:/framerusercontent.com/modules/pzsD5eZc1H6AmMoGdh5o/MxtXwThCC1R9WYZ3tawV/ParallaxImageFrame.js"],"sourcesContent":["// Parallax Image Frame with 90% scroll speed effect\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";/**\n * ParallaxImageFrame\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */function ParallaxImageFrame(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},borderRadius,shadow,style}=props;const containerRef=useRef(null);const[offset,setOffset]=useState(0);const isStatic=useIsStaticRenderer();const[inView,setInView]=useState(false);useEffect(()=>{if(isStatic||RenderTarget.current()===RenderTarget.thumbnail)return;function checkInView(){if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const windowHeight=window.innerHeight||document.documentElement.clientHeight;const isInView=rect.bottom>0&&rect.top<windowHeight;startTransition(()=>setInView(isInView));}window.addEventListener(\"scroll\",checkInView,{passive:true});window.addEventListener(\"resize\",checkInView);checkInView();return()=>{window.removeEventListener(\"scroll\",checkInView);window.removeEventListener(\"resize\",checkInView);};},[isStatic]);useEffect(()=>{if(isStatic||RenderTarget.current()===RenderTarget.thumbnail)return;if(!inView)return;function handleScroll(){if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();const windowHeight=window.innerHeight||document.documentElement.clientHeight;if(rect.bottom<0||rect.top>windowHeight)return;const scrollY=window.scrollY||window.pageYOffset;const frameTop=rect.top+scrollY;const frameHeight=rect.height;// Calculate the focal point in the frame (center of frame for now)\n// Instead, use the focal point from the image if available\nlet focalY=.5;if(image.focalPoint&&typeof image.focalPoint.y===\"number\"){focalY=image.focalPoint.y;}// The Y position in the viewport where the focal point is\nconst focalPointInFrame=rect.top+focalY*frameHeight;// The offset is how far the focal point is from the center of the viewport\nconst viewportCenter=windowHeight/2;const delta=focalPointInFrame-viewportCenter;// Allow negative or >1 parallaxSpeed for reverse/fast effect\nconst parallax=-delta*(1-props.parallaxSpeed);setOffset(parallax);}window.addEventListener(\"scroll\",handleScroll,{passive:true});handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[isStatic,inView]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius,boxShadow:props.boxShadow,position:\"relative\",background:\"#eee\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(motion.img,{src:image.src,alt:image.alt,style:{width:`${props.zoom*100}%`,height:`${props.zoom*100}%`,objectFit:\"cover\",objectPosition:image.focalPoint&&typeof image.focalPoint.x===\"number\"&&typeof image.focalPoint.y===\"number\"?`${image.focalPoint.x*100}% ${image.focalPoint.y*100}%`:`50% 50%`,display:\"block\"},animate:{y:isStatic?0:offset,scale:props.zoom!==1?props.zoom:1},transition:{type:\"spring\",stiffness:props.motionStiffness,damping:props.motionDamping,ease:props.motionEase},draggable:false})});}addPropertyControls(ParallaxImageFrame,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:16,min:0,max:64},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:()=>true},boxShadow:{type:ControlType.BoxShadow,title:\"Shadow\",defaultValue:\"0 4px 24px rgba(0,0,0,0.10)\"},zoom:{type:ControlType.Number,title:\"Zoom\",defaultValue:1,min:1,max:2,step:.01,displayStepper:false},parallaxSpeed:{type:ControlType.Number,title:\"Parallax Speed\",defaultValue:.9,min:-2,max:2,step:.01,displayStepper:false,description:\"Negative reverses direction, >1 increases speed.\"},motionStiffness:{type:ControlType.Number,title:\"Motion Stiffness\",defaultValue:120,min:10,max:500,step:1,displayStepper:true,description:\"Spring stiffness for parallax motion.\"},motionDamping:{type:ControlType.Number,title:\"Motion Damping\",defaultValue:20,min:1,max:100,step:1,displayStepper:true,description:\"Spring damping for parallax motion.\"},motionEase:{type:ControlType.Enum,title:\"Animation Curve\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\",\"circIn\",\"circOut\",\"circInOut\",\"backIn\",\"backOut\",\"backInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\",\"Circ In\",\"Circ Out\",\"Circ In Out\",\"Back In\",\"Back Out\",\"Back In Out\"],defaultValue:\"easeOut\",description:\"Animation curve for parallax motion.\"}});export default ParallaxImageFrame;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParallaxImageFrame\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParallaxImageFrame.map"],"mappings":"A,yQAMG,SAASkB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,EAAE,eAAa,SAAO,SAAOC,EAAYC,EAAapB,EAAO,IAAI,EAAO,CAACqB,EAAOC,GAAWrB,EAAS,CAAC,EAAQsB,EAASN,EAAoB,EAAO,CAACO,EAAOC,GAAWxB,E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