{"version":3,"file":"Scroll_Reveal_Text.B1HYOFv7.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","te","_e","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","window","init_framer_DxfB3JJo","useIsStaticRenderer","addPropertyControls","ControlType","RevealText","props","ref","reveal","setReveal","isStatic","onScroll","target","sectionId","rect","windowHeight","elementTop","viewportHeight","startThresholdPx","viewportStart","endThresholdPx","viewportEnd","percent","distance","progress","characters","text","totalChars","revealedChars","style","font","isRevealed","index","useGradient","revealColor","defaultColor","getGradientBackground","gradientStartColor","gradientEndColor","gradientDirection","smooth","transitionDuration","blurEffect","blurAmount","char","direction","startColor","endColor","init_Scroll_Reveal_Text"],"sources":["https:/framerusercontent.com/modules/NmwDeyIkPqxKXlm7s2ag/ebyaR4wTFQi49SM1Wo1V/Scroll_Reveal_Text.js"],"sourcesContent":["// Reveal Scroll Text - Character by Character Reveal\n// Text color reveals as user scrolls, targeting a section by ID, with configurable colors, font, size, and smooth transition.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RevealText(props){const{text=\"Reveal scroll text effect\",sectionId=\"\",defaultColor=\"#CCCCCC\",revealColor=\"#0099FF\",useGradient=false,gradientStartColor=\"#0099FF\",gradientEndColor=\"#8855FF\",gradientDirection=\"horizontal\",font,fontSize=32,smooth=true,transitionDuration=.4,viewportStart=20,viewportEnd=80,blurEffect=false,blurAmount=3,style}=props;const ref=useRef(null);const[reveal,setReveal]=useState(0);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic)return;function onScroll(){if(!ref.current)return;let target=null;if(sectionId&&typeof window!==\"undefined\"){target=document.getElementById(sectionId);}const el=target||ref.current;const rect=el.getBoundingClientRect();const windowHeight=window.innerHeight||document.documentElement.clientHeight;const elementTop=rect.top;const elementBottom=rect.bottom;const viewportHeight=windowHeight;const startThresholdPx=viewportStart/100*viewportHeight;const endThresholdPx=viewportEnd/100*viewportHeight;let percent=0;const distance=startThresholdPx-endThresholdPx;const progress=(startThresholdPx-elementTop)/distance;percent=Math.max(0,Math.min(1,progress));startTransition(()=>setReveal(percent));}window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);onScroll();return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);};},[sectionId,isStatic,viewportStart,viewportEnd]);const characters=text.split(\"\");const totalChars=characters.length;const revealedChars=Math.ceil(totalChars*reveal);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,display:\"block\",width:style?.width===\"100%\"?\"100%\":\"max-content\",...font,fontSize,position:\"relative\",whiteSpace:\"pre-wrap\",lineHeight:1.2,userSelect:\"text\"},\"aria-label\":text,children:characters.map((char,index)=>{const isRevealed=index<revealedChars;return /*#__PURE__*/_jsx(\"span\",{style:{color:isRevealed?useGradient?\"transparent\":revealColor:defaultColor,background:isRevealed&&useGradient?getGradientBackground(gradientStartColor,gradientEndColor,gradientDirection):\"transparent\",backgroundClip:isRevealed&&useGradient?\"text\":\"border-box\",WebkitBackgroundClip:isRevealed&&useGradient?\"text\":\"border-box\",WebkitTextFillColor:isRevealed&&useGradient?\"transparent\":undefined,transition:smooth?`color ${transitionDuration}s ease-out, background ${transitionDuration}s ease-out${blurEffect?`, filter ${transitionDuration}s ease-out`:\"\"}`:undefined,filter:blurEffect&&!isRevealed?`blur(${blurAmount}px)`:\"blur(0px)\"},children:char},index);})});}function getGradientBackground(startColor,endColor,direction){switch(direction){case\"horizontal\":return`linear-gradient(to right, ${startColor}, ${endColor})`;case\"vertical\":return`linear-gradient(to bottom, ${startColor}, ${endColor})`;case\"diagonal\":return`linear-gradient(to bottom right, ${startColor}, ${endColor})`;default:return`linear-gradient(to right, ${startColor}, ${endColor})`;}}addPropertyControls(RevealText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Reveal scroll text effect\",displayTextArea:true},sectionId:{type:ControlType.String,title:\"Section ID\",defaultValue:\"\",placeholder:\"Target section ID\"},defaultColor:{type:ControlType.Color,title:\"Default Color\",defaultValue:\"#CCCCCC\"},revealColor:{type:ControlType.Color,title:\"Reveal Color\",defaultValue:\"#0099FF\",hidden:({useGradient})=>useGradient},useGradient:{type:ControlType.Boolean,title:\"Use Gradient\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},gradientStartColor:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:\"#0099FF\",hidden:({useGradient})=>!useGradient},gradientEndColor:{type:ControlType.Color,title:\"Gradient End\",defaultValue:\"#8855FF\",hidden:({useGradient})=>!useGradient},gradientDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"horizontal\",\"vertical\",\"diagonal\"],optionTitles:[\"Horizontal\",\"Vertical\",\"Diagonal\"],defaultValue:\"horizontal\",displaySegmentedControl:true,hidden:({useGradient})=>!useGradient},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:32,variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:32,min:10,max:120,step:1,unit:\"px\"},smooth:{type:ControlType.Boolean,title:\"Smooth\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},transitionDuration:{type:ControlType.Number,title:\"Transition (s)\",defaultValue:.4,min:0,max:2,step:.05,unit:\"s\",hidden:({smooth})=>!smooth},blurEffect:{type:ControlType.Boolean,title:\"Blur Effect\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},blurAmount:{type:ControlType.Number,title:\"Blur Amount\",defaultValue:3,min:0,max:10,step:.5,unit:\"px\",hidden:({blurEffect})=>!blurEffect},viewportStart:{type:ControlType.Number,title:\"Start (%)\",defaultValue:20,min:0,max:100,step:1,unit:\"%\"},viewportEnd:{type:ControlType.Number,title:\"End (%)\",defaultValue:80,min:0,max:100,step:1,unit:\"%\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RevealText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_Reveal_Text.map"],"mappings":"A,qNAKG,SAAwBgB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,4BAA4B,YAAU,GAAG,eAAa,UAAU,cAAY,UAAU,cAAY,GAAM,qBAAmB,UAAU,mBAAiB,UAAU,oBAAkB,aAAa,OAAK,WAAS,GAAG,SAAO,GAAK,qBAAmB,GAAG,gBAAc,GAAG,cAAY,GAAG,aAAW,GAAM,aAAW,EAAE,SAAOC,EAAYC,EAAIlB,EAAO,IAAI,EAAO,CAACmB,EAAOC,GAAWnB,EAAS,CAAC,EAAQoB,EAASR,EAAoB,EAAEH,MAAc,CAAC,GAAGW,EAAS,OAAO,SAASC,GAAU,CAAC,GAAG,CAACJ,EAAI,QAAQ,OAAO,IAAIK,EAAO,KAAQC,GAAkBb,IAAS,SAAa,EAAO,SAAS,eAAea,CAAS,GAAgC,IAAMC,GAA1BF,GAAQL,EAAI,QAAA,CAAsB,sBAAsB,EAAQQ,EAAaf,EAAO,aAAa,SAAS,gBAAgB,aAAmBgB,EAAWF,EAAK,IAAwBA,EAAK,OAAO,IAAMG,EAAeF,EAAmBG,EAAiBC,EAAc,IAAIF,EAAqBG,EAAeC,EAAY,IAAIJ,EAAmBK,EAAQ,EAAQC,EAASL,EAAiBE,EAAqBI,GAAUN,EAAiBF,GAAYO,EAAS,EAAQ,KAAK,IAAI,EAAE,KAAK,IAAI,EAAEC,CAAQ,CAAC,EAAE/B,MAAoBgB,EAAUa,CAAO,CAAC,CAAE,CAAiH,OAAhHtB,EAAO,iBAAiB,SAASW,EAAS,CAAC,QAAQ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