{"version":3,"file":"TextOpacityLetters.CoN5YVSo.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/7LWkECtRchqgZMVIpGxo/DzZ4i1OQboV0ULgbrbgq/TextOpacityLetters.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers\nimport{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})=>{const opacityProgress=useTransform(progress,[start,end],[.1,1]);return /*#__PURE__*/_jsx(motion.span,{style:{opacity:opacityProgress},children:char});};const EachWord=({word,progress,starting,ending})=>{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});}),\"\\xa0\"]});};/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Text_Opacity_Letters(props){const text=props.text;const words=text.split(\" \");const totalWords=words.length;const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[\"start 0.75\",\"start 0.15\"]});return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{...props.font,display:\"flex\",flexWrap:\"wrap\",color:props.textColor},children:words.map((word,idx)=>{const starting=idx/totalWords;const ending=(idx+1)/totalWords;return /*#__PURE__*/_jsx(EachWord,{word:word,progress:scrollYProgress,starting:starting,ending:ending});})});}addPropertyControls(Text_Opacity_Letters,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Hello Text\"},font:{type:\"font\",controls:\"extended\"},textColor:{type:ControlType.Color}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Opacity_Letters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextOpacityLetters.map"],"mappings":"kPAQG,SAAwB,EAAqB,EAAM,CAAuB,IAAM,EAAjB,EAAM,KAAsB,MAAM,IAAI,CAAO,EAAW,EAAM,OAAa,EAAIA,EAAO,KAAK,CAAM,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,aAAa,aAAa,CAAC,CAAC,CAAC,OAAoB,EAAK,IAAI,CAAK,MAAI,MAAM,CAAC,GAAG,EAAM,KAAK,QAAQ,OAAO,SAAS,OAAO,MAAM,EAAM,UAAU,CAAC,SAAS,EAAM,KAAK,EAAK,IAAyF,EAAK,EAAS,CAAM,OAAK,SAAS,EAAgB,SAArH,EAAI,EAAmI,QAA1G,EAAI,GAAG,EAAiH,CAAC,CAAG,CAAC,CAAC,sBANlf,IAAoD,IAAyD,IAA0B,CAAM,GAAe,CAAC,OAAK,QAAM,MAAI,cAAY,CAAC,IAAM,EAAgB,EAAa,EAAS,CAAC,EAAM,EAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAoB,EAAK,EAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAgB,CAAC,SAAS,EAAK,CAAC,EAAS,GAAU,CAAC,OAAK,WAAS,WAAS,YAAU,CAAC,IAAM,EAAW,EAAK,MAAM,GAAG,CAAO,EAAW,EAAK,OAA0C,GAAtB,EAAO,GAA2B,EAAW,OAAoB,EAAM,EAAO,KAAK,CAAC,SAAS,CAAC,EAAW,KAAK,EAAK,IAAiG,EAAK,EAAc,CAAM,OAAK,MAAxG,EAAS,EAAK,EAA0G,IAAxF,EAAS,GAAM,EAAI,GAA0F,WAAS,CAAC,CAAG,CAAC,OAAO,CAAC,CAAC,EAMxQ,EAAoB,EAAqB,CAAC,KAAK,CAAC,MAAM,OAAO,KAAK,EAAY,OAAO,aAAa,aAAa,CAAC,KAAK,CAAC,KAAK,OAAO,SAAS,WAAW,CAAC,UAAU,CAAC,KAAK,EAAY,MAAM,CAAC,CAAC"}