{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Z31MPLIICwc4hRXdJUtr/1zwTLIKY1GHwcA8AStJZ/TextScrollReveal.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform,useSpring}from\"framer-motion\";import{useRef,Fragment}from\"react\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer\n * @framerIntrinsicWidth 600\n * @framerSupportedLayoutHeight any-prefer\n * @framerIntrinsicHeight 300\n */export default function TextScrollReveal({text,type,font,color,htmlTag,opacity:{minOpacity,maxOpacity},style,appear:{start,end,transition}}){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,textAlign:font.textAlign},children:words.map((word,wordIndex)=>{return /*#__PURE__*/_jsx(Fragment,{children:type===\"word\"?/*#__PURE__*/_jsx(Word,{word:word,wordIndex:wordIndex,numberOfWords:words.length,scrollYProgress:scrollYProgress,minOpacity:minOpacity,maxOpacity:maxOpacity,style:{color,...font},transition:transition}):/*#__PURE__*/_jsx(Character,{word:word,wordIndex:wordIndex,numberOfWords:words.length,scrollYProgress:scrollYProgress,minOpacity:minOpacity,maxOpacity:maxOpacity,style:{color,...font},transition:transition})},word+wordIndex);})});}const Character=({word,wordIndex,numberOfWords,scrollYProgress,minOpacity,maxOpacity,style,transition})=>{const wordStart=wordIndex/numberOfWords;const wordEnd=wordStart+1/numberOfWords;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<numberOfWords-1&&\" \"]},word+wordIndex);};const Word=({word,wordIndex,numberOfWords,scrollYProgress,minOpacity,maxOpacity,style,transition})=>{const wordStart=wordIndex/numberOfWords;const wordEnd=wordStart+1/numberOfWords;const scaleY=useSpring(scrollYProgress,transition);const opacity=useTransform(scaleY,[wordStart,wordEnd],[minOpacity,maxOpacity]);return /*#__PURE__*/_jsxs(motion.span,{style:{opacity,...style},children:[word,wordIndex<numberOfWords-1&&\" \"]},word+wordIndex);};TextScrollReveal.displayName=\"Text Scroll Reveal\";addPropertyControls(TextScrollReveal,{text:{title:\"Text\",type:ControlType.String,displayTextArea:true,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\",options:[\"word\",\"character\"],optionTitles:[\"Word\",\"Character\"]},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#000\"},opacity:{title:\"Opacity\",type:ControlType.Object,controls:{minOpacity:{title:\"Min\",type:ControlType.Number,defaultValue:.2,min:0,max:1,step:.1,displayStepper:true},maxOpacity:{title:\"Max\",type:ControlType.Number,defaultValue:1,min:0,max:1,step:.1,displayStepper:true}}},appear:{title:\"Appear\",type:ControlType.Object,controls:{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}},description:\"Full tutorial on [FramerMart](https://framermart.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextScrollReveal\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any-prefer\",\"framerSupportedLayoutWidth\":\"any-prefer\",\"framerIntrinsicWidth\":\"600\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"300\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextScrollReveal.map"],
  "mappings": "0IAOkB,SAARA,EAAkC,CAAC,KAAAC,EAAK,KAAAC,EAAK,KAAAC,EAAK,MAAAC,EAAM,QAAAC,EAAQ,QAAQ,CAAC,WAAAC,EAAW,WAAAC,CAAU,EAAE,MAAAC,EAAM,OAAO,CAAC,MAAAC,EAAM,IAAAC,EAAI,WAAAC,CAAU,CAAC,EAAE,CAAC,IAAMC,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,MAAM,CAAC,GAAGJ,EAAM,UAAUL,EAAK,SAAS,EAAE,SAASa,EAAM,IAAI,CAACE,EAAKC,IAAiCF,EAAKG,EAAS,CAAC,SAASlB,IAAO,OAAoBe,EAAKI,EAAK,CAAC,KAAKH,EAAK,UAAUC,EAAU,cAAcH,EAAM,OAAO,gBAAgBF,EAAgB,WAAWR,EAAW,WAAWC,EAAW,MAAM,CAAC,MAAAH,EAAM,GAAGD,CAAI,EAAE,WAAWQ,CAAU,CAAC,EAAeM,EAAKK,EAAU,CAAC,KAAKJ,E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C,SAAS,gBAAgB,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,MAAM,KAAKA,EAAY,KAAK,aAAa,IAAI,QAAQ,CAAC,IAAI,OAAO,KAAK,EAAE,aAAa,CAAC,MAAM,aAAa,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,aAAa,KAAKA,EAAY,UAAU,CAAC,EAAE,YAAY,uDAAuD,CAAC,CAAC",
  "names": ["TextScrollReveal", "text", "type", "font", "color", "htmlTag", "minOpacity", "maxOpacity", "style", "start", "end", "transition", "container", "pe", "scrollYProgress", "useScroll", "words", "p", "word", "wordIndex", "x", "Word", "Character", "numberOfWords", "wordStart", "wordEnd", "u", "motion", "char", "charIndex", "charStart", "charEnd", "scaleY", "useSpring", "opacity", "useTransform", "addPropertyControls", "ControlType"]
}
