{"version":3,"file":"TextReveal.DMUO2jYX.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/tbH5N9VjyB9FUlrIk3qq/FzmbUfTvqzaYHMS2Xn0S/TextReveal.js"],"sourcesContent":["// Text appear effect with random character opacity animation\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef}from\"react\";/**\n * Random FadeIn Text Reveal\n * \n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RandomFadeInTextReveal(props){const{text=\"Hello World\",font,color=\"#000000\",duration=2e3,delay=0,triggerOnce=true,triggerType=\"appear\"}=props;const containerRef=useRef(null);const isInView=useInView(containerRef,{once:triggerOnce});const isStatic=useIsStaticRenderer();const[charOpacities,setCharOpacities]=useState([]);const[isHovered,setIsHovered]=useState(false);const characters=useMemo(()=>{return text.split(\"\").map((char,index)=>({char:char===\" \"?\"\\xa0\":char,index}));},[text]);const shouldAnimate=triggerType===\"appear\"?isInView:isHovered;useEffect(()=>{if(isStatic){setCharOpacities(characters.map(()=>1));return;}if(triggerType===\"appear\"){if(!shouldAnimate){setCharOpacities(characters.map(()=>0));return;}}else if(triggerType===\"hover\"){if(!shouldAnimate){return;}}const timeouts=[];const animateCharacters=()=>{const newOpacities=new Array(characters.length).fill(0);setCharOpacities([...newOpacities]);characters.forEach((_,index)=>{const randomDelay=Math.random()*duration;const timeout=window.setTimeout(()=>{startTransition(()=>{setCharOpacities(prev=>{const updated=[...prev];updated[index]=1;return updated;});});},delay*1e3+randomDelay);timeouts.push(timeout);});};const initialTimeout=window.setTimeout(animateCharacters,100);timeouts.push(initialTimeout);return()=>{timeouts.forEach(timeout=>clearTimeout(timeout));};},[shouldAnimate,characters.length,duration,delay,isStatic,triggerType]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",...isFixedWidth?{}:{width:\"max-content\"},...font},onMouseEnter:()=>triggerType===\"hover\"&&setIsHovered(true),onMouseLeave:()=>triggerType===\"hover\"&&setIsHovered(false),children:[triggerType===\"hover\"&&/*#__PURE__*/_jsx(\"span\",{style:{color,display:\"inline-block\",whiteSpace:\"nowrap\",opacity:isHovered?0:1,transition:\"opacity 0.2s ease\"},children:text}),/*#__PURE__*/_jsx(\"span\",{style:{color,display:\"inline-block\",whiteSpace:\"nowrap\",...triggerType===\"hover\"&&{position:\"absolute\",top:0,left:0}},children:characters.map((item,index)=>/*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-block\",opacity:triggerType===\"appear\"?charOpacities[index]||0:isHovered?charOpacities[index]||0:0},animate:{opacity:triggerType===\"appear\"?charOpacities[index]||0:isHovered?charOpacities[index]||0:0},transition:{duration:.3,ease:\"easeOut\"},children:item.char},`${item.char}-${index}`))})]});}addPropertyControls(RandomFadeInTextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello World\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},triggerType:{type:ControlType.Enum,title:\"Trigger\",options:[\"appear\",\"hover\"],optionTitles:[\"Appear\",\"Hover\"],defaultValue:\"appear\",displaySegmentedControl:true},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:500,max:5e3,step:100,unit:\"ms\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:3,step:.1,unit:\"s\"},triggerOnce:{type:ControlType.Boolean,title:\"Trigger Once\",defaultValue:true,enabledTitle:\"Once\",disabledTitle:\"Repeat\",hidden:({triggerType})=>triggerType===\"hover\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomFadeInTextReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextReveal.map"],"mappings":"wcAMG,SAAwB,EAAuB,EAAM,CAAC,GAAK,CAAC,OAAK,cAAc,OAAK,QAAM,UAAU,WAAS,IAAI,QAAM,EAAE,cAAY,GAAK,cAAY,UAAU,EAAY,EAAaA,EAAO,KAAK,CAAO,EAAS,EAAU,EAAa,CAAC,KAAK,EAAY,CAAC,CAAO,EAAS,GAAqB,CAAM,CAAC,EAAc,GAAkBC,EAAS,EAAE,CAAC,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAWC,MAAoB,EAAK,MAAM,GAAG,CAAC,KAAK,EAAK,KAAS,CAAC,KAAK,IAAO,IAAI,OAAO,EAAK,QAAM,EAAE,CAAG,CAAC,EAAK,CAAC,CAAO,EAAc,IAAc,SAAS,EAAS,EAAU,MAAc,CAAC,GAAG,EAAS,CAAC,EAAiB,EAAW,QAAQ,EAAE,CAAC,CAAC,OAAQ,GAAG,IAAc,aAAa,CAAC,EAAc,CAAC,EAAiB,EAAW,QAAQ,EAAE,CAAC,CAAC,gBAAiB,IAAc,SAAY,CAAC,EAAe,OAAS,IAAM,EAAS,EAAE,CAA6Y,EAAe,EAAO,eAAtY,CAAC,IAAM,EAAiB,MAAM,EAAW,OAAO,CAAC,KAAK,EAAE,CAAC,EAAiB,CAAC,GAAG,EAAa,CAAC,CAAC,EAAW,SAAS,EAAE,IAAQ,CAAC,IAAM,EAAY,KAAK,QAAQ,CAAC,EAAe,EAAQ,EAAO,eAAe,CAAC,MAAoB,CAAC,EAAiB,GAAM,CAAC,IAAM,EAAQ,CAAC,GAAG,EAAK,CAAkB,MAAjB,GAAQ,GAAO,EAAS,GAAU,EAAG,EAAG,EAAM,IAA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