{"version":3,"file":"TextReveal.70Ouctd7.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/rVql31JQ90JcIvwpYYYJ/NBXXwVkbF52R1zlHwt9G/TextReveal.js"],"sourcesContent":["// Animated Text Reveal — distance-mapped version\n// fullRevealDistance now *actually* controls when everything becomes fully visible.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,useScroll,useTransform,useSpring,useMotionValue}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AnimatedTextReveal(props){const{text=\"Scroll down to reveal this beautiful animated text word by word\",color=\"#000000\",font,textAlign=\"left\",initialBlur=10,initialOpacity=.2,fadeDelay=.05,fadeDuration=.5,fadeEasing=\"easeOut\",fullRevealDistance=500,style}=props;const containerRef=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;// Stable offset: progress is 0 when top hits viewport bottom, 1 when top hits top.\nconst{scrollYProgress}=useScroll({target:containerRef,offset:[\"start end\",\"start start\"]});// Smooth the progress for nicer feel.\nconst smooth=useSpring(scrollYProgress,{stiffness:100,damping:30,restDelta:.001});// Map progress (0→1) to a virtual distance (0→fullRevealDistance px).\nconst dist=useTransform(smooth,[0,1],[0,fullRevealDistance]);const words=useMemo(()=>text.split(\" \"),[text]);// Gap based on the provided font size if present, with a safe fallback.\nconst wordGap=useMemo(()=>{const sz=font?.fontSize;if(typeof sz===\"string\"){const n=parseFloat(sz);return isFinite(n)?`${Math.max(0,n*.2)}px`:\"10px\";}else if(typeof sz===\"number\"){return`${Math.max(0,sz*.2)}px`;}return\"10px\";},[font?.fontSize]);// Easing map for transition prop.\nconst easingMap={linear:[0,0,1,1],easeIn:[.42,0,1,1],easeOut:[0,0,.58,1],easeInOut:[.42,0,.58,1]};const easingCurve=easingMap[fadeEasing]||easingMap.easeOut;// Per-word reveal window in pixels (overlap so words don't pop).\n// You can tune this or even expose as a control if needed.\nconst windowPx=60;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"sticky\",top:0,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\",overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",gap:wordGap,textAlign,width:\"100%\",justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\"},children:words.map((word,index)=>{// Target distance where this word should be fully revealed\nconst target=(index+1)/words.length*fullRevealDistance;// Build opacity/blur from the virtual distance\nconst opacityMV=isCanvas?useMotionValue(1):useTransform(dist,[target-windowPx,target],[initialOpacity,1]);const blurMV=isCanvas?useMotionValue(0):useTransform(dist,[target-windowPx,target],[initialBlur,0]);return /*#__PURE__*/_jsx(motion.span,{style:{display:\"inline-block\",color,...font,opacity:opacityMV,filter:isCanvas?\"none\":useTransform(blurMV,b=>`blur(${b}px)`),willChange:\"filter, opacity\"},transition:{delay:index*fadeDelay,duration:fadeDuration,ease:easingCurve},children:word},`${word}-${index}`);})})});}addPropertyControls(AnimatedTextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Scroll down to reveal this beautiful animated text word by word\",displayTextArea:true},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Bold\",fontSize:\"48px\",lineHeight:\"1.2em\",letterSpacing:\"-0.02em\"}},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},initialBlur:{type:ControlType.Number,title:\"Initial Blur\",defaultValue:10,min:0,max:50,step:1,unit:\"px\"},initialOpacity:{type:ControlType.Number,title:\"Initial Opacity\",defaultValue:.2,min:0,max:1,step:.1},fadeDelay:{type:ControlType.Number,title:\"Fade Delay\",defaultValue:.05,min:0,max:.5,step:.01,unit:\"s\"},fadeDuration:{type:ControlType.Number,title:\"Fade Duration\",defaultValue:.5,min:.1,max:2,step:.1,unit:\"s\"},fadeEasing:{type:ControlType.Enum,title:\"Fade Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\"},fullRevealDistance:{type:ControlType.Number,title:\"Full Reveal Distance\",defaultValue:500,min:0,max:2e3,step:30,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedTextReveal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextReveal.map"],"mappings":"qQAKG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,kEAAkE,QAAM,UAAU,OAAK,YAAU,OAAO,cAAY,GAAG,iBAAe,GAAG,YAAU,IAAI,eAAa,GAAG,aAAW,UAAU,qBAAmB,IAAI,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAO,EAAS,EAAa,SAAS,GAAG,EAAa,OAChX,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAa,OAAO,CAAC,YAAY,cAAc,CAAC,CAAC,CAEpF,EAAK,EADE,EAAU,EAAgB,CAAC,UAAU,IAAI,QAAQ,GAAG,UAAU,KAAK,CAAC,CAClD,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAmB,CAAC,CAAO,EAAMC,MAAY,EAAK,MAAM,IAAI,CAAC,CAAC,EAAK,CAAC,CACtG,EAAQA,MAAY,CAAC,IAAM,EAAG,GAAM,SAAS,GAA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