{"version":3,"file":"TextReveal.CUpVBn63.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/hZ1FpsXUlU79wLD1JXsD/UbfJuppfFEM72twdPNzd/TextReveal.js"],"sourcesContent":["// Scroll-animated text component with karaoke-style reveal and styled words\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion}from\"framer-motion\";/**\n * About Text Reveal\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function AboutTextReveal(props){const{text=\"Create beautiful animations with smooth scroll effects and elegant typography\",font,secondaryFont,styledWords=\"beautiful, elegant\",defaultColor=\"#D1D5DB\",revealColor=\"#000000\",useGradient=true,sectionId=\"text-reveal\",smooth=true,transitionDuration=.2,blurEffect=true,blurAmount=2,startPercent=0,endPercent=100}=props;const containerRef=useRef(null);const targetRef=useRef(null);const[scrollProgress,setScrollProgress]=useState(0);const isStatic=useIsStaticRenderer();// Find target element by section ID\nuseEffect(()=>{if(typeof window===\"undefined\"||isStatic)return;const findTarget=()=>{const element=document.getElementById(sectionId);if(element){targetRef.current=element;}};findTarget();// Retry finding element after a delay in case it's not mounted yet\nconst timeout=setTimeout(findTarget,100);return()=>clearTimeout(timeout);},[sectionId,isStatic]);// Scroll animation logic\nuseEffect(()=>{if(typeof window===\"undefined\"||isStatic||!targetRef.current)return;const handleScroll=()=>{const target=targetRef.current;if(!target)return;const rect=target.getBoundingClientRect();const windowHeight=window.innerHeight;// Calculate scroll progress based on element position\nconst elementTop=rect.top;const elementHeight=rect.height;// Start animation when element enters viewport\nconst startPoint=windowHeight-startPercent/100*windowHeight;const endPoint=-elementHeight+endPercent/100*windowHeight;let progress=0;if(elementTop<=startPoint&&elementTop>=endPoint){progress=(startPoint-elementTop)/(startPoint-endPoint);}else if(elementTop<endPoint){progress=1;}progress=Math.max(0,Math.min(1,progress));if(smooth){startTransition(()=>setScrollProgress(progress));}else{setScrollProgress(progress);}};window.addEventListener(\"scroll\",handleScroll,{passive:true});handleScroll()// Initial check\n;return()=>window.removeEventListener(\"scroll\",handleScroll);},[sectionId,startPercent,endPercent,smooth,isStatic]);// Parse styled words\nconst styledWordsArray=useMemo(()=>{return styledWords.split(\",\").map(word=>word.trim().toLowerCase()).filter(word=>word.length>0);},[styledWords]);// Process text with styled words\nconst processedText=useMemo(()=>{if(!text||styledWordsArray.length===0){return[{text,isStyled:false}];}const words=text.split(/(\\s+)/);const result=[];words.forEach(word=>{const cleanWord=word.toLowerCase().replace(/[.,!?;:]/g,\"\");const isStyled=styledWordsArray.includes(cleanWord);result.push({text:word,isStyled});});return result;},[text,styledWordsArray]);// Calculate reveal progress for each word\nconst getWordRevealProgress=(wordIndex,totalWords)=>{const wordProgress=scrollProgress*totalWords;const wordStart=wordIndex;const wordEnd=wordIndex+1;if(wordProgress<=wordStart)return 0;if(wordProgress>=wordEnd)return 1;return wordProgress-wordStart;};const totalWords=processedText.length;if(isStatic){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",...font,color:revealColor},children:processedText.map((segment,index)=>/*#__PURE__*/_jsx(\"span\",{style:{...segment.isStyled?secondaryFont:font},children:segment.text},index))});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",...font},children:processedText.map((segment,index)=>{const wordProgress=getWordRevealProgress(index,totalWords);const currentColor=useGradient?`color-mix(in srgb, ${revealColor} ${wordProgress*100}%, ${defaultColor})`:wordProgress>.5?revealColor:defaultColor;const blur=blurEffect?(1-wordProgress)*blurAmount:0;return /*#__PURE__*/_jsx(motion.span,{style:{color:currentColor,filter:`blur(${blur}px)`,transition:smooth?`all ${transitionDuration}s ease-out`:\"none\",...segment.isStyled?secondaryFont:font},children:segment.text},index);})});}addPropertyControls(AboutTextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Create beautiful animations with smooth scroll effects and elegant typography\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"40px\",variant:\"Medium\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},secondaryFont:{type:ControlType.Font,title:\"Secondary Font\",defaultValue:{fontSize:\"40px\",variant:\"Medium\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},styledWords:{type:ControlType.String,title:\"Styled Words\",defaultValue:\"beautiful, elegant\",placeholder:\"word1, word2, word3\"},defaultColor:{type:ControlType.Color,title:\"Default Color\",defaultValue:\"#D1D5DB\"},revealColor:{type:ControlType.Color,title:\"Reveal Color\",defaultValue:\"#000000\"},useGradient:{type:ControlType.Boolean,title:\"Use Gradient\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},sectionId:{type:ControlType.String,title:\"Section ID\",defaultValue:\"text-reveal\",placeholder:\"element-id\"},smooth:{type:ControlType.Boolean,title:\"Smooth\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},transitionDuration:{type:ControlType.Number,title:\"Transition Duration\",defaultValue:.2,min:.1,max:2,step:.1,unit:\"s\"},blurEffect:{type:ControlType.Boolean,title:\"Blur Effect\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},blurAmount:{type:ControlType.Number,title:\"Blur Amount\",defaultValue:2,min:0,max:10,step:.5,unit:\"px\",hidden:({blurEffect})=>!blurEffect},startPercent:{type:ControlType.Number,title:\"Start (%)\",defaultValue:0,min:0,max:100,step:5,unit:\"%\"},endPercent:{type:ControlType.Number,title:\"End (%)\",defaultValue:100,min:0,max:100,step:5,unit:\"%\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AboutTextReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__Fram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