{"version":3,"file":"Text_Opacity_Words.ydA91XTe.mjs","names":[],"sources":["https:/framerusercontent.com/modules/AhiGWcblFQsnMc0YX4Z2/vtUn0crw4N6NgGEV6mRI/Text_Opacity_Words.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform}from\"framer-motion\";import{useRef}from\"react\";// Component to handle letter color changes\nconst EachLetter=({letter,starting,ending,progress,isHighlighted,primaryColor,defaultColor,scrollColor,useScrollColor})=>{// Determine the color transition range based on scroll color\nconst interpolatedColor=useTransform(progress,[starting,ending],useScrollColor?[scrollColor,isHighlighted?primaryColor:defaultColor]:[isHighlighted?primaryColor:defaultColor,isHighlighted?primaryColor:defaultColor]);return /*#__PURE__*/_jsx(motion.span,{style:{color:interpolatedColor},children:letter});};// Main component to handle text splitting and scroll color effect\nexport default function Text_Color_Change_Letters(props){const text=props.text;const totalLetters=text.length;const ref=useRef(null);// Scroll progress hook\nconst{scrollYProgress}=useScroll({target:ref,offset:[props.startOffset,props.endOffset]});return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{...props.font,margin:0,padding:0,height:\"auto\",display:\"inline-block\",whiteSpace:\"pre-wrap\",overflow:\"visible\"},children:text.split(\"\").map((letter,idx)=>{const starting=idx/totalLetters// Start progress per letter\n;const ending=(idx+1)/totalLetters// End progress per letter\n;const isHighlighted=idx>=props.startIndex&&idx<=props.endIndex;return /*#__PURE__*/_jsx(EachLetter,{letter:letter,starting:starting,ending:ending,progress:scrollYProgress,isHighlighted:isHighlighted,primaryColor:props.primaryColor,defaultColor:props.defaultColor,scrollColor:props.scrollColor,useScrollColor:props.useScrollColor},idx);})});}// Property Controls for Framer Studio\naddPropertyControls(Text_Color_Change_Letters,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello World, this is a sample sentence\"},font:{type:\"font\",controls:\"extended\"},defaultColor:{type:ControlType.Color,defaultValue:\"#000000\",title:\"Default Color\"},primaryColor:{title:\"Primary Color\",type:ControlType.Color,defaultValue:\"#ff0000\"},scrollColor:{title:\"Scroll Color\",type:ControlType.Color,defaultValue:\"#0000ff\"},useScrollColor:{title:\"Enable Scroll Color\",type:ControlType.Boolean,defaultValue:true},startIndex:{title:\"Highlight Start Index\",type:ControlType.Number,defaultValue:0,min:0},endIndex:{title:\"Highlight End Index\",type:ControlType.Number,defaultValue:11,min:0},startOffset:{title:\"Start Offset\",type:ControlType.String,defaultValue:\"start 0.75\"},endOffset:{title:\"End Offset\",type:ControlType.String,defaultValue:\"start 0.35\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Color_Change_Letters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Opacity_Words.map"],"mappings":"mXAGA,SAAwB,EAA0B,EAAM,CAAC,IAAM,EAAK,EAAM,KAAW,EAAa,EAAK,OAAa,EAAI,EAAO,KAAK,CAC/H,CAAC,kBAAgB,CAAC,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,EAAM,YAAY,EAAM,SAAU,CAAC,EAAC,CAAC,MAAoB,GAAK,IAAI,CAAK,MAAI,MAAM,CAAC,GAAG,EAAM,KAAK,OAAO,EAAE,QAAQ,EAAE,OAAO,OAAO,QAAQ,eAAe,WAAW,WAAW,SAAS,SAAU,EAAC,SAAS,EAAK,MAAM,GAAG,CAAC,IAAI,CAAC,EAAO,IAAM,CAAC,IAAM,EAAS,EAAI,EAC9S,GAAQ,EAAI,GAAG,EACf,EAAc,GAAK,EAAM,YAAY,GAAK,EAAM,SAAS,MAAoB,GAAK,EAAW,CAAQ,SAAgB,WAAgB,SAAO,SAAS,EAA8B,gBAAc,aAAa,EAAM,aAAa,aAAa,EAAM,aAAa,YAAY,EAAM,YAAY,eAAe,EAAM,cAAe,EAAC,EAAI,AAAE,EAAC,AAAC,EAAC,AAAE,gBACtV,AAPA,G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