{"version":3,"file":"ScrollRevealText.CSbWPVit.mjs","names":["useRef","useState","__esmMin","window","init_ssg_sandbox_shims","_e","de","init_jsx_runtime","c","init_npm_react_18_3_1","ce","addPropertyControls","init_framer_BisrWwwE","ControlType","RenderTarget","ScrollRevealText","containerRef","progress","setProgress","isCanvas","handleScroll","el","rect","windowHeight","total","raw","italicSet","italicWords","w","words","text","wordCount","fontFamily","letterSpacing","cleanWord","word","isItalic","phrase","wordThreshold","revealStart","i","revealEnd","localProgress","transitionWidth","opacity","inactiveOpacity","blur","maxBlur","activeColor","italicFontFamily","init_ScrollRevealText"],"sources":["https:/framerusercontent.com/modules/QNuIdwZAUw4xJReBTHr4/kECBQQAPhJJkUSiKGSoX/ScrollRevealText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";export default function ScrollRevealText({text=\"As a digital designer, I help brands and companies connect with their audience, achieve their business goals, and know it.\",fontSize=48,fontFamily=\"Inter\",fontWeight=\"500\",activeColor=\"#FFFFFF\",inactiveOpacity=0,maxBlur=8,italicWords=\"digital designer\",italicFontFamily=\"Georgia\",revealStart=.1,revealEnd=.9,transitionWidth=.35,lineHeight=1.15,letterSpacing=0}){const containerRef=useRef(null);const[progress,setProgress]=useState(0);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(isCanvas){setProgress(.45);return;}const handleScroll=()=>{const el=containerRef.current;if(!el)return;const rect=el.getBoundingClientRect();const windowHeight=window.innerHeight;const total=rect.height+windowHeight;const current=windowHeight-rect.top;const raw=current/total;const clamped=Math.max(0,Math.min(1,raw));setProgress(clamped);};handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});window.addEventListener(\"resize\",handleScroll);return()=>{window.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(\"resize\",handleScroll);};},[isCanvas]);const italicSet=new Set(italicWords.toLowerCase().split(\",\").map(w=>w.trim()).filter(Boolean));const words=text.split(\" \");const wordCount=words.length;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",fontFamily:`'${fontFamily}', sans-serif`,fontWeight:fontWeight,fontSize:fontSize,lineHeight:lineHeight,letterSpacing:`${letterSpacing}em`,display:\"flex\",flexWrap:\"wrap\"},children:words.map((word,i)=>{const cleanWord=word.toLowerCase().replace(/[.,!?;:]/g,\"\");let isItalic=false;for(const phrase of italicSet){const phraseWords=phrase.split(\" \");if(phraseWords.includes(cleanWord)){isItalic=true;break;}}const wordThreshold=revealStart+i/Math.max(wordCount-1,1)*(revealEnd-revealStart);const localProgress=Math.max(0,Math.min(1,(progress-wordThreshold)/transitionWidth+.5));const opacity=inactiveOpacity+(1-inactiveOpacity)*localProgress;const blur=maxBlur*(1-localProgress);return /*#__PURE__*/_jsx(\"span\",{style:{color:activeColor,opacity,filter:`blur(${blur}px)`,fontStyle:isItalic?\"italic\":\"normal\",fontFamily:isItalic?`'${italicFontFamily}', serif`:`'${fontFamily}', sans-serif`,marginRight:\"0.28em\",transition:isCanvas?\"none\":\"opacity 0.05s linear, filter 0.05s linear\",whiteSpace:\"pre\",display:\"inline-block\"},children:word},i);})});}addPropertyControls(ScrollRevealText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"As a digital designer, I help brands and companies connect with their audience, achieve their business goals, and know it.\",displayTextArea:true},italicWords:{type:ControlType.String,title:\"Italic words\",defaultValue:\"digital designer\",description:\"Comma-separated phrases to render in italic serif.\"},fontSize:{type:ControlType.Number,title:\"Font size\",defaultValue:48,min:16,max:120,step:1,displayStepper:true},lineHeight:{type:ControlType.Number,title:\"Line height\",defaultValue:1.15,min:.8,max:2,step:.01,displayStepper:true,description:\"Vertical spacing between lines.\"},letterSpacing:{type:ControlType.Number,title:\"Letter spacing\",defaultValue:0,min:-.1,max:.3,step:.005,displayStepper:true,description:\"Spacing between characters, in em units.\"},fontFamily:{type:ControlType.String,title:\"Font family\",defaultValue:\"Inter\",description:\"Google Font name for the non-italic text.\"},fontWeight:{type:ControlType.Enum,title:\"Weight\",options:[\"400\",\"500\",\"600\",\"700\"],defaultValue:\"500\"},italicFontFamily:{type:ControlType.String,title:\"Italic font\",defaultValue:\"Georgia\",description:\"Font for italic phrases (e.g. Playfair Display).\"},activeColor:{type:ControlType.Color,title:\"Text color\",defaultValue:\"#FFFFFF\"},inactiveOpacity:{type:ControlType.Number,title:\"Start opacity\",defaultValue:0,min:0,max:.5,step:.01,displayStepper:true,description:\"Opacity before reveal — 0 means fully invisible at start.\"},maxBlur:{type:ControlType.Number,title:\"Max blur (px)\",defaultValue:8,min:0,max:30,step:.5,displayStepper:true,description:\"Blur amount before each word sharpens into focus.\"},transitionWidth:{type:ControlType.Number,title:\"Fog width\",defaultValue:.35,min:.05,max:.8,step:.01,displayStepper:true,description:\"How wide the foggy transition zone is. Higher = more words blurred at once, slower reveal feel.\"},revealStart:{type:ControlType.Number,title:\"Reveal start\",defaultValue:.1,min:0,max:1,step:.01,displayStepper:true,description:\"Scroll progress (0-1) where the first word starts revealing.\"},revealEnd:{type:ControlType.Number,title:\"Reveal end\",defaultValue:.9,min:0,max:1,step:.01,displayStepper:true,description:\"Scroll progress (0-1) where the last word finishes revealing.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollRevealText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollRevealText.map"],"mappings":"A,8MAAyJ,SAAwBe,EAAiB,CAAC,OAAK,6HAA6H,WAAS,GAAG,aAAW,QAAQ,aAAW,MAAM,cAAY,UAAU,kBAAgB,EAAE,UAAQ,EAAE,cAAY,mBAAmB,mBAAiB,UAAU,cAAY,GAAG,YAAU,GAAG,kBAAgB,IAAI,aAAW,KAAK,gBAAc,GAAG,CAAC,IAAMC,EAAahB,EAAO,IAAI,EAAO,CAACiB,EAASC,GAAajB,EAAS,CAAC,E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