{"version":3,"file":"ScrollRevealText_2.BsStuqqx.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/zY8N7JTYW6R4AMgLuFlx/jaZCLxGgIsPcmTWQ1vb4/ScrollRevealText_2.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,useRef,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform}from\"framer-motion\";/**\n * Scroll Reveal Text\n *\n * A text component that reveals itself as you scroll, transitioning through three colors:\n * Unrevealed -> Highlight -> Revealed.\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 200\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function ScrollRevealText(props){const{text,colorUnrevealed,colorRevealed,font,spread,startOffset,endOffset,textAlign,scrollTarget,easing}=props;const containerRef=useRef(null);const externalTargetRef=useRef(null);useEffect(()=>{if(scrollTarget){const element=document.getElementById(scrollTarget);if(element){externalTargetRef.current=element;}}},[scrollTarget]);// Track scroll progress of the component relative to the viewport\nconst{scrollYProgress}=useScroll({target:scrollTarget?externalTargetRef:containerRef,offset:[`start ${startOffset}%`,`end ${endOffset}%`]});const characters=useMemo(()=>Array.from(text),[text]);const colors=useMemo(()=>[colorUnrevealed,colorRevealed],[colorUnrevealed,colorRevealed]);return /*#__PURE__*/_jsx(\"p\",{ref:containerRef,style:{...font,textAlign,margin:0,padding:0,position:\"relative\",wordWrap:\"break-word\",whiteSpace:\"pre-wrap\"},\"aria-label\":text,children:characters.map((char,i)=>{// Calculate the relative position of this character in the text (0 to 1)\nconst p=i/(characters.length-1||1);// Define the range where this character should transition\n// Scale ranges to fit within [0, 1] so all characters start unrevealed\nconst start=p*(1-spread*2);const end=start+spread*2;const range=[start,end];return /*#__PURE__*/_jsx(Character,{progress:scrollYProgress,range:range,colors:colors,easing:easing,children:char},`${i}-${colorUnrevealed}-${colorRevealed}`);})});}function Character({children,progress,range,colors,easing}){const easingFunction=useMemo(()=>{const easingMap={linear:[0,0,1,1],easeIn:[.42,0,1,1],easeOut:[0,0,.58,1],easeInOut:[.42,0,.58,1],circIn:[.55,0,1,.45],circOut:[0,.55,.45,1],circInOut:[.85,0,.15,1],backIn:[.6,-.28,.735,.045],backOut:[.175,.885,.32,1.275],backInOut:[.68,-.55,.265,1.55]};return easingMap[easing]||easingMap.linear;},[easing]);// Map the global scroll progress to the specific color for this character\nconst color=useTransform(progress,range,colors,{ease:easingFunction});// Add opacity fade effect - starts partially visible, fades to fully visible\nconst opacity=useTransform(progress,range,[.3,1],{ease:easingFunction});return /*#__PURE__*/_jsx(motion.span,{style:{color,opacity,display:\"inline\"},children:children});}addPropertyControls(ScrollRevealText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"The UNION Pflegebund\\xae Is Regarded As A Leading Organization For Church-Sponsored Care Institutions Seeking Qualified And Verified Nursing Professionals From India.\",displayTextArea:true},colorUnrevealed:{type:ControlType.Color,title:\"Unrevealed\",defaultValue:\"#BBBBBB\"},colorRevealed:{type:ControlType.Color,title:\"Revealed\",defaultValue:\"#000000\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\",\"circIn\",\"circOut\",\"circInOut\",\"backIn\",\"backOut\",\"backInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\",\"Circ In\",\"Circ Out\",\"Circ In Out\",\"Back In\",\"Back Out\",\"Back In Out\"],defaultValue:\"linear\",displaySegmentedControl:false,description:\"Controls the acceleration/deceleration of the reveal animation\"},spread:{type:ControlType.Number,title:\"Spread\",min:.01,max:.5,step:.01,defaultValue:.15,displayStepper:true,description:\"Width of the reveal fade\"},startOffset:{type:ControlType.Number,title:\"Start %\",min:0,max:100,defaultValue:90,unit:\"%\",displayStepper:true,description:\"Viewport position to start revealing\"},endOffset:{type:ControlType.Number,title:\"End %\",min:0,max:100,defaultValue:40,unit:\"%\",displayStepper:true,description:\"Viewport position to finish revealing\"},font:{type:ControlType.Font,controls:\"extended\",defaultValue:{fontSize:32,variant:\"Semibold\",lineHeight:1.2,letterSpacing:\"-0.02em\"}},textAlign:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\",\"justify\"],defaultValue:\"left\",displaySegmentedControl:true},scrollTarget:{type:ControlType.String,title:\"Scroll Target\",placeholder:\"ID of element\",description:\"Optional: ID of an element to track scroll progress for\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollRevealText\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollRevealText_2.map"],"mappings":"kPAWG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,OAAK,kBAAgB,gBAAc,OAAK,SAAO,cAAY,YAAU,YAAU,eAAa,UAAQ,EAAY,EAAaA,EAAO,IAAI,EAAQ,EAAkBA,EAAO,IAAI,EAAE,MAAc,CAAC,GAAG,EAAa,CAAC,IAAM,EAAQ,SAAS,eAAe,CAAY,EAAK,IAAS,EAAkB,QAAQ,EAAS,CAAC,EAAE,CAAC,CAAY,CAAC,EAC5X,GAAK,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAa,EAAkB,EAAa,OAAO,CAAC,SAAS,EAAY,GAAG,OAAO,EAAU,EAAE,CAAC,CAAC,EAAQ,EAAWC,MAAY,MAAM,KAAK,CAAI,EAAE,CAAC,CAAI,CAAC,EAAQ,EAAOA,MAAY,CAAC,EAAgB,CAAa,EAAE,CAAC,EAAgB,CAAa,CAAC,EAAE,OAAoB,EAAK,IAAI,CAAC,IAAI,EAAa,MAAM,CAAC,GAAG,EAAK,YAAU,OAAO,EAAE,QAAQ,EAAE,SAAS,WAAW,SAAS,a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