{"version":3,"file":"Text_Opacity_Letters.BqS_cFDt.mjs","names":["useRef","__esmMin","de","init_jsx_runtime","c","p","init_npm_react_18_3_1","useTransform","motion","useScroll","init_framer_motion_DhsWWWsN","addPropertyControls","ControlType","init_framer_DxfB3JJo","Text_Color_Letters","props","words","text","totalWords","ref","currentCharacterIndex","fontFamily","fontSize","lineHeight","letterSpacing","toColor","textAlign","starting","idx","ending","wordLength","word","startIdx","EachWord","scrollYProgress","EachCharacter","init_Text_Opacity_Letters","colorProgress","progress","start","end","fromColor","initialColor","index","transitionStartIndex","easing","char","characters","step","charStart","charEnd"],"sources":["https:/framerusercontent.com/modules/Vn8Q3RtmOV2dKyAhsSgN/p0sw7V5he78f8hW6u6K0/Text_Opacity_Letters.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}from\"react\";const EachCharacter=({char,start,end,progress,duration,easing,index,transitionStartIndex,fromColor,toColor})=>{// Animate from `fromColor` → `toColor` over this character's scroll range\nconst colorProgress=useTransform(progress,[start,end],[fromColor,toColor]);// Anything before `transitionStartIndex` is already in \"final\" color\nconst initialColor=index<transitionStartIndex?toColor:fromColor;return /*#__PURE__*/_jsx(motion.span,{style:{color:index<transitionStartIndex?initialColor:colorProgress},transition:{duration,ease:easing},children:char});};const EachWord=({word,progress,starting,ending,duration,easing,transitionStartIndex,currentCharacterIndex,fromColor,toColor})=>{const characters=word.split(\"\");const wordLength=characters.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,fromColor:fromColor,toColor:toColor},idx);}),\"\\xa0\"]});};export default function Text_Color_Letters(props){const{text,duration,easing,fontSize,lineHeight,letterSpacing,textAlign,transitionStartIndex,fontFamily,fromColor,toColor}=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\"]});let currentCharacterIndex=0;return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{// This uses your Framer font / text style:\n// In the Font control you can pick any project text style you’ve created.\nfontFamily:fontFamily?.fontFamily,fontWeight:fontFamily?.fontWeight,fontStyle:fontFamily?.fontStyle,fontSize:`${fontSize}px`,lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,color:toColor,display:\"flex\",flexWrap:\"wrap\",justifyContent:textAlign,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// +1 for space\n;return /*#__PURE__*/_jsx(EachWord,{word:word,progress:scrollYProgress,starting:starting,ending:ending,duration:duration,easing:easing,transitionStartIndex:transitionStartIndex,currentCharacterIndex:startIdx,fromColor:fromColor,toColor:toColor},idx);})});}addPropertyControls(Text_Color_Letters,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello Text\"},// Pick any font / text style from your project here\nfontFamily:{title:\"Font\",type:ControlType.Font},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},textAlign:{title:\"Align\",type:ControlType.Enum,options:[\"flex-start\",\"center\",\"flex-end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"flex-start\"},// 🎨 Color controls for both modes\nfromColor:{title:\"From Color\",type:ControlType.Color,defaultValue:\"#73799B\"},toColor:{title:\"To Color\",type:ControlType.Color,defaultValue:\"#F4F7FF\"},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:\"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=./Text_Opacity_Letters.map"],"mappings":"A,gPAEi3B,SAAwBc,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,WAAS,SAAO,WAAS,aAAW,gBAAc,YAAU,uBAAqB,aAAW,YAAU,WAASC,EAAYC,EAAMC,EAAK,MAAM,GAAG,EAAQC,EAAWF,EAAM,OAAaG,EAAInB,EAAO,IAAI,EAAO,CAAC,mBAAiBS,EAAU,CAAC,OAAOU,EAAI,OAAO,CAAC,aAAa,YAAY,CAAC,CAAC,EAAMC,EAAsB,EAAE,MAAoB,gBAAK,IAAI,CAAK,MAAI,MAAM,CAE9wC,WAAWC,GAAY,WAAW,WAAWA,GAAY,WAAW,UAAUA,GAAY,UAAU,SAAS,GAAGC,EAAS,IAAI,WAAW,GAAGC,EAAW,IAAI,cAAc,GAAGC,EAAc,IAAI,MAAMC,EAAQ,QAAQ,OAAO,SAAS,OAAO,eAAeC,EAAU,OAAO,CAAC,EAAE,SAASV,EAAM,KAAK,EAAK,IAAM,CAAC,IAAMW,EAASC,EAAIV,EAAiBW,GAAQD,EAAI,GAAGV,EAAiBY,EAAWC,EAAK,OAAaC,EAASZ,EACtZ,MAD4a,IAAuBU,EAAW,EAC1b,gBAAKG,EAAS,CAAM,OAAK,SAASC,EAAyB,WAAgB,SAAgB,WAAgB,SAA4B,uBAAqB,sBAAsBF,EAAmB,YAAkB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