{"version":3,"file":"RandomNumberGenerator.BeMMXFYQ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/9uFb7YLp59WYckcrMIy0/V85cPBd2IcW6nxaBYi6t/RandomNumberGenerator.js"],"sourcesContent":["// Random number generator that generates a number between 800 and 905 when it comes into view\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";/**\n * Random Number Generator (Auto on In-View)\n *\n * @framerIntrinsicWidth 120\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function RandomNumberGenerator(props){const{min,max,font,color,background,borderRadius,style}=props;const[number,setNumber]=useState(min);const[isAnimating,setIsAnimating]=useState(false);const[animationOffset,setAnimationOffset]=useState(0);const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true});const animationRef=useRef(null);useEffect(()=>{if(isInView){setIsAnimating(true);const start=Date.now();const duration=2e3// 2 seconds\n;function animate(){const elapsed=Date.now()-start;if(elapsed<duration){// During animation, show any number for whirring effect\nconst random=Math.floor(Math.random()*900)+100// 3-digit range for animation\n;const progress=elapsed/duration;const offset=Math.sin(progress*Math.PI*8)*10*(1-progress);startTransition(()=>{setNumber(random);setAnimationOffset(offset);});animationRef.current=window.requestAnimationFrame(animate);}else{// Final number is constrained to min-max range\nconst final=Math.floor(Math.random()*(max-min+1))+min;startTransition(()=>{setNumber(final);setAnimationOffset(0);setIsAnimating(false);});}}animate();return()=>{if(animationRef.current)window.cancelAnimationFrame(animationRef.current);};}},[isInView,min,max]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,minWidth:5,minHeight:5,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background,color,borderRadius,...font,position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"span\",{style:{transform:`translateY(${animationOffset}px)`,opacity:isAnimating?.7+Math.random()*.3:1,transition:isAnimating?\"none\":\"all 0.3s ease-out\"},children:number})});}addPropertyControls(RandomNumberGenerator,{min:{type:ControlType.Number,title:\"Min\",defaultValue:800,min:0,max:1e4,step:1},max:{type:ControlType.Number,title:\"Max\",defaultValue:905,min:0,max:1e4,step:1},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomNumberGenerator\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"120\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomNumberGenerator.map"],"mappings":"oZASG,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,MAAI,MAAI,OAAK,QAAM,aAAW,eAAa,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAI,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAgB,GAAoBA,EAAS,EAAE,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAS,EAAU,EAAa,CAAC,KAAK,GAAK,CAAC,CAAO,EAAaA,EAAO,KAAK,CAIjH,OAJkH,MAAc,CAAC,GAAG,EAAS,CAAC,EAAe,GAAK,CAAC,IAAM,EAAM,KAAK,KAAK,CAAO,EAAS,IAC7c,SAAS,GAAS,CAAC,IAAM,EAAQ,KAAK,KA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