{"version":3,"file":"Scroll_Text_Reveal.DPuIr58_.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","ce","init_jsx_runtime","c","p","_e","de","useScroll","motion","init_framer_motion_DhsWWWsN","useTransform","init_framer_DKtAEkcX","addPropertyControls","ControlType","EachCharacter","colorProgress","progress","start","end","interpolatedColor","startColor","endColor","index","transitionStartIndex","char","EachWord","characters","word","wordLength","amount","ending","starting","step","idx","currentCharacterIndex","AnimatedText","ref","Tag","fontSize","lineHeight","letterSpacing","paragraphAlign","words","totalWords","startIdx","scrollYProgress","RevealText","props","mounted","setMounted","headingTag","text","sharedStyle","init_Scroll_Text_Reveal"],"sources":["https:/framerusercontent.com/modules/fW0u2SCfArwppYOSVY5j/sbJ2YgSJ9XqRKsehWmAF/Scroll_Text_Reveal.js"],"sourcesContent":["\"use client\";import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform}from\"framer-motion\";import{useRef,useEffect,useState}from\"react\";// ─── Character ───────────────────────────────────────────────────────────────\nfunction EachCharacter({char,start,end,progress,index,transitionStartIndex,startColor,endColor}){const colorProgress=useTransform(progress,[start,end],[0,1],{clamp:true});const interpolatedColor=useTransform(colorProgress,[0,1],[startColor,endColor]);return /*#__PURE__*/_jsx(motion.span,{style:{color:index<transitionStartIndex?endColor:interpolatedColor,display:\"inline-block\",whiteSpace:\"pre\"},children:char});}// ─── Word ─────────────────────────────────────────────────────────────────────\nfunction EachWord({word,progress,starting,ending,transitionStartIndex,currentCharacterIndex,startColor,endColor}){const characters=word.split(\"\");const wordLength=characters.length;const amount=ending-starting;const step=wordLength>0?amount/wordLength:amount;return /*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-block\",whiteSpace:\"pre\"},children:[characters.map((char,idx)=>/*#__PURE__*/_jsx(EachCharacter,{char:char,start:starting+step*idx,end:starting+step*(idx+1),progress:progress,index:currentCharacterIndex+idx,transitionStartIndex:transitionStartIndex,startColor:startColor,endColor:endColor},idx)),/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:\"0.25em\"}})]});}// ─── Animated inner — only ever rendered in the browser ──────────────────────\nfunction AnimatedText({words,totalWords,Tag,fontSize,lineHeight,letterSpacing,paragraphAlign,fontFamily,fontWeight,transitionStartIndex,startColor,endColor}){const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[\"start 0.75\",\"start 0.15\"]});let currentCharacterIndex=0;return /*#__PURE__*/_jsx(Tag,{ref:ref,style:{fontFamily,fontSize:`${fontSize}px`,display:\"flex\",flexWrap:\"wrap\",lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,justifyContent:paragraphAlign,margin:0,padding:0,fontWeight,width:\"100%\"},children:words.map((word,idx)=>{const starting=idx/totalWords;const ending=(idx+1)/totalWords;const startIdx=currentCharacterIndex;currentCharacterIndex+=word.length+1;return /*#__PURE__*/_jsx(EachWord,{word:word,progress:scrollYProgress,starting:starting,ending:ending,transitionStartIndex:transitionStartIndex,currentCharacterIndex:startIdx,startColor:startColor,endColor:endColor},`word-${idx}`);})});}// ─── Root export ──────────────────────────────────────────────────────────────\nexport default function RevealText(props){const{text=\"Hello Text\",duration=.3,easing=\"easeInOut\",fontSize=48,lineHeight=60,letterSpacing=-3,paragraphAlign=\"center\",transitionStartIndex=22,fontFamily=\"Urbanist\",fontWeight=400,startColor=\"#0000004D\",endColor=\"#000000\",headingTag=\"h1\"}=props;const[mounted,setMounted]=useState(false);useEffect(()=>{setMounted(true);},[]);const validTags=[\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"];const Tag=validTags.includes(headingTag)?headingTag:\"h1\";const words=(text||\"\").split(\" \").filter(Boolean);const totalWords=words.length;const sharedStyle={fontFamily,fontSize:`${fontSize}px`,lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,margin:0,padding:0,fontWeight,width:\"100%\"};if(!mounted){return /*#__PURE__*/_jsx(Tag,{style:{...sharedStyle,display:\"flex\",flexWrap:\"wrap\",justifyContent:paragraphAlign,color:startColor},children:text});}return /*#__PURE__*/_jsx(AnimatedText,{words:words,totalWords:totalWords,Tag:Tag,fontSize:fontSize,lineHeight:lineHeight,letterSpacing:letterSpacing,paragraphAlign:paragraphAlign,fontFamily:fontFamily,fontWeight:fontWeight,transitionStartIndex:transitionStartIndex,startColor:startColor,endColor:endColor});}// ─── Property controls ───────────────────────────────────────────────────────\naddPropertyControls(RevealText,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello Text\",displayTextArea:true},headingTag:{title:\"HTML Tag\",type:ControlType.Enum,options:[\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"P\",\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\"],defaultValue:\"h1\"},fontFamily:{title:\"Font Family\",type:ControlType.String,defaultValue:\"Urbanist\"},fontSize:{title:\"Font Size\",type:ControlType.Number,defaultValue:48,min:10,max:200},fontWeight:{title:\"Font Weight\",type:ControlType.Number,defaultValue:400,min:100,max:900,step:100},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:60,min:10,max:200},letterSpacing:{title:\"Letter Spacing\",type:ControlType.Number,defaultValue:-3,min:-10,max:10},paragraphAlign:{title:\"Paragraph Align\",type:ControlType.Enum,options:[\"flex-start\",\"center\",\"flex-end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\"},duration:{title:\"Duration\",type:ControlType.Number,defaultValue:.3,min:.1,max:3,step:.1},easing:{title:\"Easing\",type:ControlType.Enum,options:[\"easeInOut\",\"easeIn\",\"easeOut\",\"linear\"],optionTitles:[\"Ease In Out\",\"Ease In\",\"Ease Out\",\"Linear\"],defaultValue:\"easeInOut\"},transitionStartIndex:{title:\"Transition Start\",type:ControlType.Number,defaultValue:22,min:0,max:1e3},startColor:{title:\"Start Color\",type:ControlType.Color,defaultValue:\"#0000004D\"},endColor:{title:\"End Color\",type:ControlType.Color,defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RevealText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_Text_Reveal.map"],"mappings":"A,+PACA,SAASiB,EAAc,CAAC,OAAK,QAAM,MAAI,WAAS,QAAM,uBAAqB,aAAW,YAAU,CAAC,IAAMC,EAAcL,EAAaM,EAAS,CAACC,EAAMC,CAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAI,CAAC,EAAQC,EAAkBT,EAAaK,EAAc,CAAC,EAAE,CAAC,EAAE,CAACK,EAAWC,CAAQ,CAAC,EAAE,MAAoB,gBAAKb,EAAO,KAAK,CAAC,MAAM,CAAC,MAAMc,EAAMC,EAAqBF,EAASF,EAAkB,QAAQ,eAAe,WAAW,KAAK,EAAE,SAASK,CAAI,CAAC,CAAE,CAC7Z,SAASC,EAAS,CAAC,OAAK,WAAS,WAAS,SAAO,uBAAqB,wBAAsB,aAAW,YAAU,CAAC,IAAMC,EAAWC,EAAK,MAAM,EAAE,EAAQC,EAAWF,EAAW,OAAaG,EAAOC,EAAOC,EAAeC,EAAKJ,EAAW,EAAEC,EAAOD,EAAWC,EAAO,MAAoB,gBAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,eAAe,WAAW,KAAK,EAAE,SAAS,CAACH,EAAW,KAAK,EAAK,IAAmB,gBAAKZ,EAAc,CAAM,OAAK,MAAMiB,EAASC,EAAKC,EAAI,IAAIF,EAASC,GAAMC,EAAI,GAAY,WAAS,MAAMC,EAAsBD,EAAyB,uBAAgC,aAAoB,UAAQ,EAAEA,CAAG,CAAC,EAAe,gBAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,eAAe,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAC/qB,SAASE,EAAa,CAAC,QAAM,aAAW,MAA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