{"version":3,"file":"ScrollType.CGAMQz7w.mjs","names":["React.useRef","React.useMemo","React.Fragment"],"sources":["https:/framerusercontent.com/modules/lTqgXSrtuwrQbnOTy3Is/SOsxRU0USnxEE5UVqYDu/ScrollType.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,useScroll,useSpring,useTransform}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";function clamp(value,minimum,maximum){return Math.min(Math.max(value,minimum),maximum);}function RevealWord({children,progress,start,end,revealedColor,unrevealedColor,unrevealedOpacity,blur,verticalOffset}){const safeEnd=Math.max(end,start+.001);const opacity=useTransform(progress,[start,safeEnd],[unrevealedOpacity,1]);const color=useTransform(progress,[start,safeEnd],[unrevealedColor,revealedColor]);const y=useTransform(progress,[start,safeEnd],[verticalOffset,0]);const filter=useTransform(progress,[start,safeEnd],[`blur(${blur}px)`,\"blur(0px)\"]);return /*#__PURE__*/_jsx(motion.span,{style:{display:\"inline\",opacity,color,y,filter,willChange:\"color, opacity, transform, filter\"},children:children});}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ScrollBasedWordReveal({text=\"Every detail reveals itself gradually as you move through the page.\",font={fontFamily:\"Inter\",fontSize:48,fontWeight:500,lineHeight:1.1,letterSpacing:-1,textAlign:\"left\"},revealedColor=\"#111111\",unrevealedColor=\"#D0D0D0\",unrevealedOpacity=1,startViewport=90,endViewport=30,wordTransition=.08,smoothing=.18,blur=0,verticalOffset=0,style}){const containerRef=React.useRef(null);/*\n     * Framer Motion measures the component wherever it is placed\n     * and calculates progress relative to the browser viewport.\n     */const{scrollYProgress}=useScroll({target:containerRef,offset:[`start ${startViewport}%`,`end ${endViewport}%`]});const smoothProgress=useSpring(scrollYProgress,{stiffness:120,damping:30,mass:clamp(smoothing*3,.1,3),restDelta:.001});/*\n     * Preserve spaces, line breaks, and paragraph formatting.\n     */const tokens=React.useMemo(()=>text.split(/(\\s+)/),[text]);const wordCount=React.useMemo(()=>{return tokens.filter(token=>token&&!/^\\s+$/.test(token)).length;},[tokens]);let currentWordIndex=0;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",position:\"relative\",whiteSpace:\"pre-wrap\",overflowWrap:\"break-word\",wordBreak:\"normal\",margin:0,padding:0,/*\n                 * The entire object returned by Framer's font\n                 * control is applied directly to the text.\n                 */...font,/*\n                 * Framer's canvas sizing and positioning props\n                 * remain intact.\n                 */...style},children:tokens.map((token,tokenIndex)=>{const isWhitespace=/^\\s+$/.test(token);if(isWhitespace){return /*#__PURE__*/_jsx(React.Fragment,{children:token},`space-${tokenIndex}`);}const wordIndex=currentWordIndex;currentWordIndex+=1;const normalizedPosition=wordCount<=1?0:wordIndex/Math.max(wordCount-1,1);const duration=clamp(wordTransition,.005,.5);const wordStart=clamp(normalizedPosition*(1-duration),0,1-duration);const wordEnd=clamp(wordStart+duration,wordStart+.001,1);return /*#__PURE__*/_jsx(RevealWord,{progress:smoothProgress,start:wordStart,end:wordEnd,revealedColor:revealedColor,unrevealedColor:unrevealedColor,unrevealedOpacity:unrevealedOpacity,blur:blur,verticalOffset:verticalOffset,children:token},`word-${tokenIndex}`);})});}ScrollBasedWordReveal.defaultProps={text:\"Every detail reveals itself gradually as you move through the page.\",font:{fontFamily:\"Inter\",fontSize:48,fontWeight:500,lineHeight:1.1,letterSpacing:-1,textAlign:\"left\"},revealedColor:\"#111111\",unrevealedColor:\"#D0D0D0\",unrevealedOpacity:1,startViewport:90,endViewport:30,wordTransition:.08,smoothing:.18,blur:0,verticalOffset:0};addPropertyControls(ScrollBasedWordReveal,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Every detail reveals itself gradually as you move through the page.\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultFontSize:\"48px\",displayFontSize:true,displayTextAlignment:true,defaultValue:{fontFamily:\"Inter\",fontSize:48,fontWeight:500,lineHeight:1.1,letterSpacing:-1,textAlign:\"left\"}},revealedColor:{type:ControlType.Color,title:\"Revealed\",defaultValue:\"#111111\"},unrevealedColor:{type:ControlType.Color,title:\"Unrevealed\",defaultValue:\"#D0D0D0\"},unrevealedOpacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.05},startViewport:{type:ControlType.Number,title:\"Start\",defaultValue:90,min:0,max:100,step:1,unit:\"%\"},endViewport:{type:ControlType.Number,title:\"End\",defaultValue:30,min:0,max:100,step:1,unit:\"%\"},wordTransition:{type:ControlType.Number,title:\"Word Blend\",defaultValue:.08,min:.005,max:.5,step:.005},smoothing:{type:ControlType.Number,title:\"Smoothing\",defaultValue:.18,min:.05,max:1,step:.05},blur:{type:ControlType.Number,title:\"Blur\",defaultValue:0,min:0,max:20,step:.5,unit:\"px\"},verticalOffset:{type:ControlType.Number,title:\"Y Offset\",defaultValue:0,min:-100,max:100,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollBasedWordReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollType.map"],"mappings":"8PAA8L,SAAS,EAAM,EAAM,EAAQ,EAAQ,CAAC,OAAO,KAAK,IAAI,KAAK,IAAI,EAAM,CAAO,EAAE,CAAO,CAAE,CAAC,SAAS,EAAW,CAAC,WAAS,WAAS,QAAM,MAAI,gBAAc,kBAAgB,oBAAkB,OAAK,kBAAgB,CAAC,IAAM,EAAQ,KAAK,IAAI,EAAI,EAAM,IAAI,EAAQ,EAAQ,EAAa,EAAS,CAAC,EAAM,CAAO,EAAE,CAAC,EAAkB,CAAC,CAAC,EAAQ,EAAM,EAAa,EAAS,CAAC,EAAM,CAAO,EAAE,CAAC,EAAgB,CAAa,CAAC,EAAQ,EAAE,EAAa,EAA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