{"version":3,"file":"ProgressAnimation_1.ChAxcp5H.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/XOkUQ8t51HArgljPz99A/AenXJYlfUQmoDo9ibiEF/ProgressAnimation_1.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";export default function ProgressAnimation(props){const{backgroundColor,progressColor,timeAnimation}=props;const[width,setWidth]=useState(0);const ref=useRef(null);const isInView=useInView(ref);const _interval=useRef(null);useEffect(function(){_interval.current=setInterval(function(){setWidth(prevWidth=>prevWidth>=100?0:prevWidth+1);},timeAnimation);return function cleanup(){clearInterval(_interval.current);};},[timeAnimation]);// useEffect(() => {\n//     console.log(\"Element is in view: \", isInView)\n//     if (isInView) {\n//         _interval.current = setInterval(function () {\n//             setWidth((prevWidth) => (prevWidth >= 100 ? 0 : prevWidth + 1))\n//         }, timeAnimation)\n//     } else {\n//         clearInterval(_interval.current)\n//         setWidth(0)\n//     }\n//     return () => {\n//         clearInterval(_interval.current)\n//     }\n// }, [isInView])\nconst styles={container:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",borderRadius:\"100px\"},background:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",background:backgroundColor},progress:{position:\"absolute\",top:0,left:0,height:\"100%\",width:`${width}%`,background:progressColor,transition:`width ${timeAnimation}ms linear`,borderRadius:\"100px\"}};return /*#__PURE__*/_jsxs(\"div\",{style:styles.container,ref:ref,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.background}),/*#__PURE__*/_jsx(\"div\",{style:styles.progress})]});}addPropertyControls(ProgressAnimation,{backgroundColor:{title:\"Background Color\",type:ControlType.Color,defaultValue:\"transparent\"},progressColor:{title:\"Progress Color\",type:ControlType.Color,defaultValue:\"rgba(171, 169, 255, 1)\"},timeAnimation:{title:\"Animation Time (ms)\",type:ControlType.Number,defaultValue:80,min:10,max:1e3,step:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProgressAnimation\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgressAnimation_1.map"],"mappings":"iPAA+L,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,kBAAgB,gBAAc,iBAAe,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAO,EAAIC,EAAO,KAAK,CAAgB,EAAU,EAAI,CAAC,IAAM,EAAUA,EAAO,KAAK,CAAC,EAAU,UAAU,CAA6G,MAA5G,GAAU,QAAQ,YAAY,UAAU,CAAC,EAAS,GAAW,GAAW,IAAI,EAAE,EAAU,EAAE,EAAG,EAAc,CAAQ,UAAkB,CAAC,cAAc,EAAU,QAAQ,GAAK,CAAC,EAAc,CAAC,CAc7mB,IAAM,EAAO,CAAC,UAAU,CAAC,MAAM,OAAO,OAAO,OAAO,SAAS,WAAW,SAAS,SAAS,aAAa,QAAQ,CAAC,WAAW,CAAC,SAAS,WAAW,IAAI,EAAE,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,WAAW,EAAgB,CAAC,SAAS,CAAC,SAAS,WAAW,IAAI,EAAE,KAAK,EAAE,OAAO,OAAO,MAAM,GAAG,EAAM,GAAG,WAAW,EAAc,WAAW,SAAS,EAAc,WAAW,aAAa,QAAQ,CAAC,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,EAAO,UAAc,MAAI,SAAS,CAAc,EAAK,MAAM,CAAC,MAAM,EAAO,WAAW,CAAC,CAAc,EAAK,MAAM,CAAC,MAAM,EAAO,SAAS,CAAC,CAAC,CAAC,CAAC,kBAdnf,IAA6C,IAAoD,IAAqC,CAc+W,EAAoB,EAAkB,CAAC,gBAAgB,CAAC,MAAM,mBAAmB,KAAK,EAAY,MAAM,aAAa,cAAc,CAAC,cAAc,CAAC,MAAM,iBAAiB,KAAK,EAAY,MAAM,aAAa,yBAAyB,CAAC,cAAc,CAAC,MAAM,sBAAsB,KAAK,EAAY,OAAO,aAAa,GAAG,IAAI,GAAG,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC"}