{"version":3,"file":"Reveal_Text.B-R1z0GW.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","de","p","c","init_jsx_runtime","ce","motion","useTransform","useScroll","init_framer_motion_DhsWWWsN","init_framer_CN96F41L","ControlType","addPropertyControls","Text_Color_Letters","props","words","text","totalWords","ref","style","fontFamily","currentCharacterIndex","fontSize","lineHeight","letterSpacing","paragraphAlign","starting","idx","ending","wordLength","word","startIdx","EachWord","scrollYProgress","EachCharacter","init_Reveal_Text","colorProgress","progress","start","end","initialColor","index","transitionStartIndex","easing","char","characters","step","charStart","charEnd"],"sources":["https:/framerusercontent.com/modules/VsUt8kJtSk76YCeQVz21/Tx7eImUuBPIeepU9Iwwe/Reveal_Text.js"],"sourcesContent":["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}from\"react\";const EachCharacter=({char,start,end,progress,duration,easing,index,transitionStartIndex})=>{const colorProgress=useTransform(progress,[start,end],[\"#666666\",\"#FFFFFF\"]);const initialColor=index<transitionStartIndex?\"#FFFFFF\":\"#666666\";return /*#__PURE__*/_jsx(motion.span,{style:{color:index<transitionStartIndex?initialColor:colorProgress},transition:{duration:duration,ease:easing},children:char});};const EachWord=({word,progress,starting,ending,duration,easing,transitionStartIndex,currentCharacterIndex})=>{const characters=word.split(\"\");const wordLength=word.length;const amount=ending-starting;const step=amount/wordLength;return /*#__PURE__*/_jsxs(motion.span,{children:[characters.map((char,idx)=>{const charStart=starting+step*idx;const charEnd=starting+step*(idx+1);return /*#__PURE__*/_jsx(EachCharacter,{char:char,start:charStart,end:charEnd,progress:progress,duration:duration,easing:easing,index:currentCharacterIndex+idx,transitionStartIndex:transitionStartIndex},idx);}),\"\\xa0\"]});};export default function Text_Color_Letters(props){const{text,duration,easing,fontSize,lineHeight,letterSpacing,paragraphAlign,transitionStartIndex,fontFamily}=props;const words=text.split(\" \");const totalWords=words.length;const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[\"start 0.75\",\"start 0.15\"]});useEffect(()=>{const style=document.createElement(\"style\");style.appendChild(document.createTextNode(`\n            @import url('https://fonts.googleapis.com/css2?family=${fontFamily.replace(/ /g,\"+\")}:wght@400&display=swap');\n        `));document.head.appendChild(style);return()=>{document.head.removeChild(style);};},[fontFamily]);let currentCharacterIndex=0;return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{fontFamily:`${fontFamily}, sans-serif`,fontSize:`${fontSize}px`,color:\"#666666\",display:\"flex\",flexWrap:\"wrap\",lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,justifyContent:paragraphAlign,margin:0},children:words.map((word,idx)=>{const starting=idx/totalWords;const ending=(idx+1)/totalWords;const wordLength=word.length;const startIdx=currentCharacterIndex;currentCharacterIndex+=wordLength+1// Including space\n;return /*#__PURE__*/_jsx(EachWord,{word:word,progress:scrollYProgress,starting:starting,ending:ending,duration:duration,easing:easing,transitionStartIndex:transitionStartIndex,currentCharacterIndex:startIdx},idx);})});}addPropertyControls(Text_Color_Letters,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello Text\"},fontFamily:{title:\"Font Family\",type:ControlType.String,defaultValue:\"Urbanist\"},fontSize:{title:\"Font Size\",type:ControlType.Number,defaultValue:48,min:10,max:100},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:60,min:10,max:100},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 Index\",type:ControlType.Number,defaultValue:22,min:0,max:1e3}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Color_Letters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Reveal_Text.map"],"mappings":"A,uPAAorC,SAAwBe,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,SAAO,WAAS,aAAW,gBAAc,iBAAe,uBAAqB,cAAYC,EAAYC,EAAMC,EAAK,MAAM,GAAG,EAAQC,EAAWF,EAAM,OAAaG,EAAIpB,EAAO,IAAI,EAAO,CAAC,mBAAiBU,EAAU,CAAC,OAAOU,EAAI,OAAO,CAAC,aAAa,YAAY,CAAC,CAAC,EAAEb,MAAc,CAAC,IAAMc,EAAM,SAAS,cAAc,OAAO,EAExgD,OAF0gDA,EAAM,YAAY,SAAS,eAAe;oEAC7hDC,EAAW,QAAQ,KAAK,GAAG,EAAE;SACxF,CAAC,EAAE,SAAS,KAAK,YAAYD,CAAK,MAAY,CAAC,SAAS,KAAK,YAAYA,CAAK,CAAE,CAAE,EAAE,CAACC,CAAU,CAAC,EAAE,IAAIC,EAAsB,EAAE,MAAoB,gBAAK,IAAI,CAAK,MAAI,MAAM,CAAC,WAAW,GAAGD,EAAW,cAAc,SAAS,GAAGE,EAAS,IAAI,MAAM,UAAU,QAAQ,OAAO,SAAS,OAAO,WAAW,GAAGC,EAAW,IAAI,cAAc,GAAGC,EAAc,IAAI,eAAeC,EAAe,OAAO,CAAC,EAAE,SAASV,EAAM,KAAK,EAAK,IAAM,CAAC,IAAMW,EAASC,EAAIV,EAAiBW,GAAQD,EAAI,GAAGV,EAAiBY,EAAWC,EAAK,OAAaC,EAASV,EACphB,MAD0iB,IAAuBQ,EAAW,EACxjB,gBAAKG,EAAS,CAAM,OAAK,SAASC,EAAyB,WAAg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