{"version":3,"file":"TextOpacityLetters.CeNNOXpr.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/elIJFFQHa1AbrCYzoOC3/xd7HmE0Ghpp9yUTu1NIB/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,GAAG,EAAQ,EAAW,EAAM,OAAa,EAAIA,EAAO,IAAI,EAAO,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAI,OAAO,CAAC,aAAa,YAAY,CAAC,CAAC,EAAE,OAAoB,EAAK,IAAI,CAAK,MAAI,MAAM,CAAC,GAAG,EAAM,KAAK,QAAQ,OAAO,SAAS,OAAO,MAAM,EAAM,SAAS,EAAE,SAAS,EAAM,KAAK,EAAK,IAAM,CAAC,IAAM,EAAS,EAAI,EAAiB,GAAQ,EAAI,GAAG,EAAW,OAAoB,EAAK,EAAS,CAAM,OAAK,SAAS,EAAyB,WAAgB,QAAM,CAAC,CAAE,CAAC,CAAC,CAAC,CAAE,qBANpf,IAAoD,IAAyD,IAA0B,EAAO,GAAe,CAAC,OAAK,QAAM,MAAI,cAAY,CAAC,IAAM,EAAgB,EAAa,EAAS,CAAC,EAAM,CAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAoB,EAAK,EAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAe,EAAE,SAAS,CAAI,CAAC,CAAE,EAAQ,GAAU,CAAC,OAAK,WAAS,WAAS,YAAU,CAAC,IAAM,EAAW,EAAK,MAAM,EAAE,EAAQ,EAAW,EAAK,OAA0C,GAAtB,EAAO,GAA2B,EAAW,OAAoB,EAAM,EAAO,KAAK,CAAC,SAAS,CAAC,EAAW,KAAK,EAAK,IAAM,CAAC,IAAM,EAAU,EAAS,EAAK,EAAU,EAAQ,EAAS,GAAM,EAAI,GAAG,OAAoB,EAAK,EAAc,CAAM,OAAK,MAAM,EAAU,IAAI,EAAiB,UAAQ,CAAC,CAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAE,EAMzQ,EAAoB,EAAqB,CAAC,KAAK,CAAC,MAAM,OAAO,KAAK,EAAY,OAAO,aAAa,YAAY,EAAE,KAAK,CAAC,KAAK,OAAO,SAAS,UAAU,EAAE,UAAU,CAAC,KAAK,EAAY,KAAK,CAAC,CAAC"}