{"version":3,"file":"TextReveal.CS7vROwT.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/bA1AykTyx0FljEyOuhzx/DzU2xX3fSyzPYKKT5HRm/TextReveal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useMemo}from\"react\";import{motion,useScroll,useTransform,useSpring,useReducedMotion}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Text Reveal on Scroll\n * \n * Words or letters progressively reveal with smooth color and opacity transitions as you scroll.\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TextReveal(props){const{text=\"Framify is a Framer Component Library with 1500+ ready-to-use Framer Components. Access them all in one powerful Framer Plugin.\",revealedColor=\"#FFFFFF\",unrevealedColor=\"#333333\",font,staggerDelay=.08,smoothness=2,animationType=\"word\",easing=\"smooth\",blurAmount=1}=props;const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const shouldReduceMotion=useReducedMotion();const tokens=useMemo(()=>{if(animationType===\"letter\"){return text.split(\"\");}return text.split(\" \");},[text,animationType]);const{scrollYProgress}=useScroll({target:containerRef,offset:[\"start 0.9\",\"start 0.25\"]});const springConfig=useMemo(()=>{const configs={smooth:{stiffness:100,damping:20},snappy:{stiffness:300,damping:25},bouncy:{stiffness:120,damping:10}};const base=configs[easing]||configs.smooth;return{stiffness:base.stiffness*smoothness,damping:base.damping,restDelta:.001};},[easing,smoothness]);// Spring-smoothed scroll progress for smoother animation\nconst smoothProgress=useSpring(scrollYProgress,springConfig);if(isStatic||shouldReduceMotion){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,...containerStyles},children:/*#__PURE__*/_jsx(\"div\",{style:{maxWidth:\"100%\",textAlign:\"left\",...font,color:revealedColor},children:animationType===\"word\"?tokens.map((word,i)=>/*#__PURE__*/_jsx(\"span\",{style:{...wordStyles,color:revealedColor},children:word},`${word}-${i}`)):tokens.map((letter,i)=>/*#__PURE__*/_jsx(\"span\",{style:{...letterStyles,color:revealedColor,whiteSpace:letter===\" \"?\"pre\":\"normal\"},children:letter},`${letter}-${i}`))})});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,...containerStyles},children:/*#__PURE__*/_jsx(\"div\",{style:{maxWidth:\"100%\",textAlign:\"left\",...font},children:tokens.map((token,index)=>/*#__PURE__*/_jsx(Token,{token:token,index:index,totalTokens:tokens.length,smoothProgress:smoothProgress,revealedColor:revealedColor,unrevealedColor:unrevealedColor,staggerDelay:staggerDelay,blurAmount:blurAmount,animationType:animationType},`${token}-${index}`))})});}// Shared styles\nconst containerStyles={position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",boxSizing:\"border-box\"};const wordStyles={display:\"inline-block\",marginRight:\"0.3em\",marginBottom:\"0.2em\"};const letterStyles={display:\"inline-block\"};function Token({token,index,totalTokens,smoothProgress,revealedColor,unrevealedColor,staggerDelay,blurAmount,animationType}){const start=index/totalTokens;const end=start+1/totalTokens;const opacity=useTransform(smoothProgress,[start,end],[0,1]);const blurValue=useTransform(smoothProgress,[start,end],[blurAmount,0]);const filter=useTransform(blurValue,v=>blurAmount>0?`blur(${v}px)`:\"none\");const isSpace=token===\" \";const styles=animationType===\"word\"?wordStyles:letterStyles;return /*#__PURE__*/_jsxs(\"span\",{style:{...styles,position:\"relative\",display:\"inline-block\",whiteSpace:isSpace?\"pre\":\"normal\",color:unrevealedColor},children:[token===\" \"?\"\\xa0\":token,/*#__PURE__*/_jsx(motion.span,{style:{position:\"absolute\",inset:0,color:revealedColor,opacity,filter,willChange:\"opacity, filter\"},children:token===\" \"?\"\\xa0\":token})]});}addPropertyControls(TextReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Framify is a Framer Component Library with 1500+ ready-to-use Framer Components. Access them all in one powerful Framer Plugin.\",displayTextArea:true},animationType:{type:ControlType.Enum,title:\"Animate\",options:[\"word\",\"letter\"],optionTitles:[\"Word by Word\",\"Letter by Letter\"],defaultValue:\"word\"},revealedColor:{type:ControlType.Color,title:\"Revealed\",defaultValue:\"#FFFFFF\"},unrevealedColor:{type:ControlType.Color,title:\"Unrevealed\",defaultValue:\"#333333\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"48px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\",textAlign:\"left\"}},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"smooth\",\"snappy\",\"bouncy\"],optionTitles:[\"Smooth\",\"Snappy\",\"Bouncy\"],defaultValue:\"smooth\"},staggerDelay:{type:ControlType.Number,title:\"Stagger\",defaultValue:.08,min:.005,max:.1,step:.005,unit:\"s\"},smoothness:{type:ControlType.Number,title:\"Smoothness\",defaultValue:2,min:.1,max:2,step:.1},blurAmount:{type:ControlType.Number,title:\"Blur Effect\",defaultValue:1,min:0,max:10,step:1,unit:\"px\",description:\"Blur amount when unrevealed\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextReveal\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"600\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextReveal.map"],"mappings":"gRAUG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,kIAAkI,gBAAc,UAAU,kBAAgB,UAAU,OAAK,eAAa,IAAI,aAAW,EAAE,gBAAc,OAAO,SAAO,SAAS,aAAW,GAAG,EAAY,EAAaA,EAAO,IAAI,EAAQ,EAAS,EAAoB,EAAQ,EAAmB,EAAiB,EAAQ,EAAOC,MAAgB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