{"version":3,"file":"TextRevealScroll.DoWkAdeT.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/25JEPkKrfa8J9J0EGzti/fl7XIKLe8aA0wPnxMvE1/TextRevealScroll.js"],"sourcesContent":["// Text reveal scroll component that reveals another layer of text as user scrolls down\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef}from\"react\";import{useScroll,useTransform,motion,useInView}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TextRevealScroll(props){const{backgroundText=\"SCROLL TO REVEAL\",revealText=\"AMAZING CONTENT\",backgroundColor=\"#000000\",backgroundTextColor=\"#333333\",revealTextColor=\"#FFFFFF\",backgroundFont,revealFont,alignment=\"center\",revealMode=\"line\",startOffset=0,endOffset=100}=props;const containerRef=useRef(null);const isInView=useInView(containerRef,{once:false,margin:\"0px\"});const isStatic=useIsStaticRenderer();const{scrollYProgress}=useScroll({target:containerRef,offset:[\"start end\",\"end start\"]});// Transform scroll progress to reveal progress with custom start/end offsets\nconst revealProgress=useTransform(scrollYProgress,[startOffset/100,endOffset/100],[0,100]);// Split text based on reveal mode\nconst splitText=text=>{switch(revealMode){case\"line\":return text.split(\"\\n\").map(line=>line||\" \");case\"word\":return text.split(/(\\s+)/);case\"letter\":return text.split(\"\");default:return[text];}};const textParts=splitText(revealText);const backgroundParts=splitText(backgroundText);if(isStatic){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:alignment,overflow:\"hidden\",padding:\"40px 20px\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",textAlign:alignment,...revealFont,color:revealTextColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\"},children:revealText})});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:alignment,overflow:\"hidden\",padding:\"40px 20px\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",textAlign:alignment,...backgroundFont,color:backgroundTextColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",zIndex:1,width:\"calc(100% - 40px)\",display:revealMode===\"line\"?\"block\":\"inline\"},children:revealMode===\"line\"?backgroundParts.map((part,index)=>/*#__PURE__*/_jsx(\"div\",{style:{display:\"block\"},children:part},index)):backgroundParts.map((part,index)=>/*#__PURE__*/_jsx(\"span\",{style:{display:revealMode===\"word\"?\"inline\":\"inline-block\"},children:part},index))}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",textAlign:alignment,...revealFont,color:revealTextColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",zIndex:2,width:\"calc(100% - 40px)\",display:revealMode===\"line\"?\"block\":\"inline\"},children:revealMode===\"line\"?textParts.map((part,index)=>{const partProgress=(index+1)/textParts.length*100;return /*#__PURE__*/_jsx(motion.div,{style:{display:\"block\",opacity:useTransform(revealProgress,[partProgress-100/textParts.length,partProgress],[0,1])},children:part},index);}):textParts.map((part,index)=>{const partProgress=(index+1)/textParts.length*100;return /*#__PURE__*/_jsx(motion.span,{style:{display:revealMode===\"word\"?\"inline\":\"inline-block\",opacity:useTransform(revealProgress,[partProgress-100/textParts.length,partProgress],[0,1])},children:part},index);})})]});}addPropertyControls(TextRevealScroll,{backgroundText:{type:ControlType.String,title:\"Background Text\",defaultValue:\"SCROLL TO REVEAL\",displayTextArea:true},revealText:{type:ControlType.String,title:\"Reveal Text\",defaultValue:\"AMAZING CONTENT\",displayTextArea:true},revealMode:{type:ControlType.Enum,title:\"Reveal Mode\",options:[\"line\",\"word\",\"letter\"],optionTitles:[\"Line by Line\",\"Word by Word\",\"Letter by Letter\"],defaultValue:\"line\",displaySegmentedControl:true},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#000000\"},backgroundTextColor:{type:ControlType.Color,title:\"Background Text Color\",defaultValue:\"#333333\"},revealTextColor:{type:ControlType.Color,title:\"Reveal Text Color\",defaultValue:\"#FFFFFF\"},backgroundFont:{type:ControlType.Font,title:\"Background Font\",defaultValue:{fontSize:\"48px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},revealFont:{type:ControlType.Font,title:\"Reveal Font\",defaultValue:{fontSize:\"48px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},alignment:{type:ControlType.Enum,title:\"Text Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true},startOffset:{type:ControlType.Number,title:\"Start Offset\",defaultValue:0,min:0,max:100},endOffset:{type:ControlType.Number,title:\"End Offset\",defaultValue:100,min:0,max:100}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextRevealScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextRevealScroll.map"],"mappings":"kaAIG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,iBAAe,mBAAmB,aAAW,kBAAkB,kBAAgB,UAAU,sBAAoB,UAAU,kBAAgB,UAAU,iBAAe,aAAW,YAAU,SAAS,aAAW,OAAO,cAAY,EAAE,YAAU,KAAK,EAAY,EAAaA,EAAO,KAAK,CAAgB,EAAU,EAAa,CAAC,KAAK,GAAM,OAAO,MAAM,CA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