{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Z31MPLIICwc4hRXdJUtr/qkfG75FAM6iOor3qlsYm/TextScrollReveal.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform,useSpring}from\"framer-motion\";import{useRef}from\"react\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerIntrinsicWidth 600\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicHeight 300\n */export default function TextScrollReveal(props){const{text,type,font,color,htmlTag,maxOpacity,minOpacity,style,start,end,transition}=props;const container=useRef(null);const{scrollYProgress}=useScroll({target:container,offset:[`0 ${start}`,`0 ${end}`]});const words=text.split(\" \");const Tag=htmlTag;return /*#__PURE__*/_jsx(Tag,{ref:container,style:style,children:words.map((word,wordIndex)=>{return /*#__PURE__*/_jsx(_Fragment,{children:type===\"word\"?/*#__PURE__*/_jsx(Word,{word:word,wordIndex:wordIndex,wordsLength:words.length,scrollYProgress:scrollYProgress,minOpacity:minOpacity,maxOpacity:maxOpacity,style:{color,...font},transition:transition}):/*#__PURE__*/_jsx(Character,{word:word,wordIndex:wordIndex,wordsLength:words.length,scrollYProgress:scrollYProgress,minOpacity:minOpacity,maxOpacity:maxOpacity,style:{color,...font},transition:transition})});})});}const Character=({word,wordIndex,wordsLength,scrollYProgress,minOpacity,maxOpacity,style,transition})=>{const wordStart=wordIndex/wordsLength;const wordEnd=wordStart+1/wordsLength;return /*#__PURE__*/_jsxs(motion.span,{style:style,children:[word.split(\"\").map((char,charIndex)=>{const charStart=wordStart+charIndex/word.length*(wordEnd-wordStart);const charEnd=wordStart+(charIndex+1)/word.length*(wordEnd-wordStart);const scaleY=useSpring(scrollYProgress,transition);const opacity=useTransform(scaleY,[charStart,charEnd],[minOpacity,maxOpacity]);return /*#__PURE__*/_jsx(motion.span,{style:{opacity,...style},children:char},`${wordIndex}-${charIndex}`);}),wordIndex<wordsLength-1&&\" \"]},wordIndex);};const Word=({word,wordIndex,wordsLength,scrollYProgress,minOpacity,maxOpacity,style,transition})=>{const wordStart=wordIndex/wordsLength;const wordEnd=wordStart+1/wordsLength;const scaleY=useSpring(scrollYProgress,transition);const opacity=useTransform(scaleY,[wordStart,wordEnd],[minOpacity,maxOpacity]);return /*#__PURE__*/_jsxs(motion.span,{style:{opacity,...style},children:[word,wordIndex<wordsLength-1&&\" \"]},wordIndex);};TextScrollReveal.displayName=\"Text Scroll Reveal\";addPropertyControls(TextScrollReveal,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"},htmlTag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"h1\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"span\",\"p\"],optionTitles:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"span\",\"p\"]},type:{title:\"Type\",type:ControlType.Enum,defaultValue:\"word\",displaySegmentedControl:true,options:[\"word\",\"character\"],optionTitles:[\"Word\",\"Character\"]},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#000\"},maxOpacity:{title:\"Max Opacity\",type:ControlType.Number,defaultValue:1,min:0,max:1,step:.1,displayStepper:true},minOpacity:{title:\"Min Opacity\",type:ControlType.Number,defaultValue:.2,min:0,max:1,step:.1,displayStepper:true},start:{title:\"Start\",type:ControlType.Enum,defaultValue:\"1\",options:[\"1\",\"0.75\",\"0.5\"],optionTitles:[\"Bottom\",\"Bottom/Center\",\"Center\"]},end:{title:\"End\",type:ControlType.Enum,defaultValue:\"0\",options:[\"0\",\"0.25\",\"0.5\"],optionTitles:[\"Top\",\"Top/Center\",\"Center\"]},transition:{title:\"Transition\",type:ControlType.Transition}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextScrollReveal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextScrollReveal.map"],
  "mappings": "0IAOkB,SAARA,EAAkCC,EAAM,CAAC,GAAK,CAAC,KAAAC,EAAK,KAAAC,EAAK,KAAAC,EAAK,MAAAC,EAAM,QAAAC,EAAQ,WAAAC,EAAW,WAAAC,EAAW,MAAAC,EAAM,MAAAC,EAAM,IAAAC,EAAI,WAAAC,CAAU,EAAEX,EAAYY,EAAUC,EAAO,IAAI,EAAO,CAAC,gBAAAC,CAAe,EAAEC,EAAU,CAAC,OAAOH,EAAU,OAAO,CAAC,KAAKH,CAAK,GAAG,KAAKC,CAAG,EAAE,CAAC,CAAC,EAAQM,EAAMf,EAAK,MAAM,GAAG,EAAoB,OAAoBgB,EAA5BZ,EAAqC,CAAC,IAAIO,EAAU,MAAMJ,EAAM,SAASQ,EAAM,IAAI,CAACE,EAAKC,IAAiCF,EAAKG,EAAU,CAAC,SAASlB,IAAO,OAAoBe,EAAKI,EAAK,CAAC,KAAKH,EAAK,UAAUC,EAAU,YAAYH,EAAM,OAAO,gBAAgBF,EAAgB,WAAWP,EAAW,WAAWD,EAAW,MAAM,CAAC,MAAAF,EAAM,GAAGD,CAAI,EAAE,WAAWQ,CAAU,CAAC,EAAeM,EAAKK,EAAU,CAAC,KAAKJ,EAAK,UAAUC,EAAU,YAAYH,EAAM,OAAO,gBAAgBF,EAAgB,WAAWP,EAAW,WAAWD,EAAW,MAAM,CAAC,MAAAF,EAAM,GAAGD,CAAI,EAAE,WAAWQ,CAAU,CAAC,CAAC,CAAC,CAAG,CAAC,CAAC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", "useScroll", "words", "p", "word", "wordIndex", "l", "Word", "Character", "wordsLength", "wordStart", "wordEnd", "u", "motion", "char", "charIndex", "charStart", "charEnd", "scaleY", "useSpring", "opacity", "useTransform", "addPropertyControls", "ControlType"]
}
