{"version":3,"file":"TextReveal.BY___jYd.mjs","names":["useRef","useState","useMemo","totalWords"],"sources":["https:/framerusercontent.com/modules/Js1lwUycr2n2tkUie1X6/Ltsx3ZvOdHyoMWZoQKrK/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\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"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