{"version":3,"file":"ProductStack.SfIlrAYw.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/7NQ7S55P4AAdXxgiwvM0/4SEC353Oy3GaWSsZ0HXo/ProductStack.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/components/auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export function BatteryComponentDing(props){const[scrolling,setScrolling]=useState(false);const batterySectionRef=useRef(null);const batteryContainerRef=useRef(null);const batteryParts=(props.images??[]).map((image,index)=>{if(props.value===\"4stack\"){return{image:image,y:0,x:0};}else{return{image:image,y:index>3?-100:0,x:0};}});const styles={batterySection:{pointerEvents:\"none\",position:\"relative\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},batteryContainer:{position:\"relative\",width:400,height:380,marginTop:\"50px\",overflow:\"visible\"},batteryPart:index=>({position:\"absolute\",width:\"auto\",height:620,transition:\"transform 0.6s cubic-bezier(0.33, 1, 0.68, 1)\",willChange:\"transform\",left:\"50%\",transform:\"translateX(-50%)\",bottom:0,zIndex:9})};const updateBatteryPositions=()=>{if(!batterySectionRef.current||!batteryContainerRef.current)return;const containerRect=batteryContainerRef.current.getBoundingClientRect();// Calculate position relative to viewport\nconst viewportPosition=Math.max(0,Math.min(1,(window.innerHeight-containerRect.top)/(window.innerHeight/2)));// Update battery part positions\nconst parts=batteryContainerRef.current.children;Array.from(parts).forEach((part,index)=>{const batteryPart=batteryParts[index];if(!batteryPart)return;let yOffset=index*(48*viewportPosition);yOffset+=batteryPart.y??0;const xOffset=batteryPart.x??0;part.style.transform=`translateX(calc(-50% + ${xOffset}px)) translateY(${yOffset}px)`;});};useEffect(()=>{const onScroll=()=>{if(!scrolling){setScrolling(true);requestAnimationFrame(()=>{updateBatteryPositions();setScrolling(false);});}};window.addEventListener(\"scroll\",onScroll);window.addEventListener(\"resize\",updateBatteryPositions);// Initial position update\nupdateBatteryPositions();return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",updateBatteryPositions);};},[scrolling,batteryParts,props.value]);return /*#__PURE__*/_jsx(\"div\",{style:styles.batterySection,ref:batterySectionRef,children:/*#__PURE__*/_jsx(\"div\",{style:styles.batteryContainer,ref:batteryContainerRef,children:batteryParts.map((part,index)=>/*#__PURE__*/_jsx(\"img\",{src:part.image,alt:`Battery part ${index+1}`,style:styles.batteryPart(index)},index))})});}addPropertyControls(BatteryComponentDing,{images:{type:ControlType.Array,control:{type:ControlType.Image}},value:{type:ControlType.Enum,defaultValue:\"6stack\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",options:[\"4stack\",\"6stack\"],optionTitles:[\"Stack van 4 Batterijen\",\"Stack van 6 Batterijen\"]}});BatteryComponentDing.defaultProps={images:[]};\nexport const __FramerMetadata__ = {\"exports\":{\"BatteryComponentDing\":{\"type\":\"reactComponent\",\"name\":\"BatteryComponentDing\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProductStack.map"],"mappings":"0TAQG,SAAgB,EAAqB,EAAM,CAAC,GAAK,CAAC,EAAU,EAAa,CAACA,EAAS,IAAa,EAAkBC,EAAO,MAAY,EAAoBA,EAAO,MAAY,GAAc,EAAM,QAAQ,EAAE,EAAE,KAAK,EAAM,IAAY,EAAM,QAAQ,SAAgB,CAAO,QAAM,EAAE,EAAE,EAAE,EAAE,CAAa,CAAO,QAAM,EAAE,EAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAW,EAAO,CAAC,eAAe,CAAC,cAAc,OAAO,SAAS,WAAW,QAAQ,OAAO,eAAe,SAAS,WAAW,SAAS,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