{"version":3,"file":"AnimatedCounter.JZCZSzZd.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/VcEfweh9Du8keUCAyqCh/XAVSABI1UmWE6OSfWRNn/AnimatedCounter.js"],"sourcesContent":["// Number counter component that animates from start to end value when centered in view\n// Supports prefix/suffix, font customization, decimals, easing, duration and delay\n// Animation triggers once when component is centered in viewport\n// Digital color is a customizable gradient\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView,animate}from\"framer-motion\";const easingFunctions={linear:[0,0,1,1],easeIn:[.42,0,1,1],easeOut:[0,0,.58,1],easeInOut:[.42,0,.58,1]};/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AnimatedCounter(props){const{startValue,endValue,duration,delay,decimals,prefix,suffix,easing,font,gradientColor1,gradientColor2,gradientAngle,style}=props;const[displayValue,setDisplayValue]=useState(startValue);const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);const isInView=useInView(ref,{once:true,amount:.5});useEffect(()=>{if(isInView&&!hasAnimated){const timer=setTimeout(()=>{const controls=animate(startValue,endValue,{duration:duration,ease:easingFunctions[easing],onUpdate:value=>{startTransition(()=>{setDisplayValue(value);});},onComplete:()=>{startTransition(()=>{setHasAnimated(true);});}});return()=>controls.stop();},delay*1e3);return()=>clearTimeout(timer);}},[isInView,hasAnimated,startValue,endValue,duration,delay,easing]);const formattedValue=displayValue.toFixed(decimals);const gradientStyle={background:`linear-gradient(${gradientAngle}deg, ${gradientColor1}, ${gradientColor2})`,WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\"};return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,position:\"relative\",width:\"max-content\",minWidth:\"max-content\",...font,...gradientStyle},children:[prefix,formattedValue,suffix]});}addPropertyControls(AnimatedCounter,{startValue:{type:ControlType.Number,title:\"Start Value\",defaultValue:0,step:.01},endValue:{type:ControlType.Number,title:\"End Value\",defaultValue:100,step:.01},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2,min:.1,max:10,step:.1,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:5,step:.1,unit:\"s\"},decimals:{type:ControlType.Number,title:\"Decimals\",defaultValue:0,min:0,max:4,step:1,displayStepper:true},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"%\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\",displaySegmentedControl:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},gradientColor1:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:\"#0099FF\"},gradientColor2:{type:ControlType.Color,title:\"Gradient End\",defaultValue:\"#8855FF\"},gradientAngle:{type:ControlType.Number,title:\"Gradient Angle\",defaultValue:135,min:0,max:360,step:1,unit:\"deg\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedCounter.map"],"mappings":"wPAOG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,aAAW,WAAS,WAAS,QAAM,WAAS,SAAO,SAAO,SAAO,OAAK,iBAAe,iBAAe,gBAAc,SAAO,EAAW,CAAC,EAAa,GAAiBA,EAAS,CAAU,EAAO,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