{"version":3,"file":"Text_Opacity_Letters.yiXzp1aI.mjs","names":["line","React"],"sources":["https:/framerusercontent.com/modules/7UvrFCglDS83nxcbsYqO/J6yneqNKhA5L2owqIULN/Text_Opacity_Letters.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";import React,{useRef,useEffect,useState,useMemo}from\"react\";const easingFunctions={linear:t=>t,easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,easeInQuad:t=>t*t,easeOutQuad:t=>1-(1-t)*(1-t),easeInOutQuad:t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2,easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,easeInExpo:t=>t===0?0:Math.pow(2,10*t-10),easeOutExpo:t=>t===1?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,easeInElastic:t=>t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*(2*Math.PI/3)),easeOutBounce:t=>{const n1=7.5625;const d1=2.75;if(t<1/d1){return n1*t*t;}else if(t<2/d1){return n1*(t-=1.5/d1)*t+.75;}else if(t<2.5/d1){return n1*(t-=2.25/d1)*t+.9375;}else{return n1*(t-=2.625/d1)*t+.984375;}},stepReveal:t=>Math.floor(t*10)/10};const Letter=({char,opacity})=>/*#__PURE__*/_jsx(motion.span,{style:{opacity,display:\"inline-block\"},children:char});const Word=({word,startIndex,progress,totalLetters,revealRange,easingFunction,isEmphasized,emphasisColor,emphasisStyle})=>{const style={display:\"inline-block\",whiteSpace:\"normal\",marginLeft:0,paddingLeft:0,...isEmphasized?{color:emphasisColor,...emphasisStyle}:{}};return /*#__PURE__*/_jsx(\"span\",{style:style,children:word.split(\"\").map((char,charIndex)=>{const index=startIndex+charIndex;const adjustedRevealRange=revealRange*9;const start=Math.max(0,(index-adjustedRevealRange)/totalLetters);const end=Math.min(1,(index+adjustedRevealRange)/totalLetters);let opacity;if(progress>=start&&progress<=end){const transitionProgress=(progress-start)/(end-start);opacity=easingFunctions[easingFunction](transitionProgress);}else if(progress>end){opacity=1;}else{opacity=0;}return /*#__PURE__*/_jsx(Letter,{char:char,opacity:opacity},charIndex);})});};export default function TextOpacityLetters(props){const{content,font,weight,color,size,letter,line,align,balance,easingFunction,designMode,emphasisColor,emphasisWeight,emphasisStyle}=props;const containerRef=useRef(null);const[progress,setProgress]=useState(1);const{words,totalLetters}=useMemo(()=>{const lines=content.split(\"\\n\");let wordIndex=0;let letterIndex=0;const processedWords=lines.flatMap((line,lineIndex)=>{const lineWords=line.split(/(\\s+)/).filter(s=>s.length>0);return lineWords.map((word,index)=>{const isEmphasized=word.startsWith(\"*\")&&word.endsWith(\"*\");const cleanWord=isEmphasized?word.slice(1,-1):word;const result={text:cleanWord,isEmphasized,startIndex:letterIndex,wordIndex:wordIndex++,isSpace:/^\\s+$/.test(word),isLastInLine:index===lineWords.length-1};letterIndex+=cleanWord.length;return result;});});return{words:processedWords,totalLetters:letterIndex};},[content]);const revealRange=useMemo(()=>{const percentageToReveal=.03;return Math.max(1,Math.floor(totalLetters*percentageToReveal));},[totalLetters]);useEffect(()=>{setProgress(1);const handleScroll=()=>{if(containerRef.current){const rect=containerRef.current.getBoundingClientRect();const windowHeight=window.innerHeight;const containerHeight=rect.height;const offsetTopPercentage=.9999;const offsetBottomPercentage=.3407;const offsetTop=windowHeight*offsetTopPercentage;const offsetBottom=windowHeight*offsetBottomPercentage;const start=windowHeight-offsetTop;const end=offsetBottom;const current=windowHeight-rect.top;const newProgress=Math.min(Math.max((current-start)/(end-start+containerHeight),0),1);setProgress(newProgress);}};if(RenderTarget.current()!==RenderTarget.canvas){window.addEventListener(\"scroll\",handleScroll);return()=>window.removeEventListener(\"scroll\",handleScroll);}},[]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{fontFamily:font,fontWeight:weight,color:color,fontSize:`${size}em`,letterSpacing:`${letter}em`,lineHeight:line,justifyContent:align===\"left\"?\"flex-start\":align===\"right\"?\"flex-end\":align===\"center\"?\"center\":\"space-between\",textJustify:balance?\"inter-word\":\"auto\",whiteSpace:\"pre-wrap\",width:\"100%\",minHeight:\"auto\",padding:\"0px\",wordBreak:\"break-word\",overflowWrap:\"break-word\",display:\"flex\",flexWrap:\"wrap\",alignItems:\"flex-start\"},children:words.map((word,index)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[word.isSpace?/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"pre\"},children:word.text}):/*#__PURE__*/_jsx(Word,{word:word.text,startIndex:word.startIndex,progress:progress,totalLetters:totalLetters,revealRange:revealRange,easingFunction:easingFunction,designMode:designMode,isEmphasized:word.isEmphasized,emphasisColor:emphasisColor,emphasisStyle:{fontWeight:emphasisWeight,fontStyle:emphasisStyle}}),word.isLastInLine&&/*#__PURE__*/_jsx(\"br\",{})]},word.wordIndex))});}addPropertyControls(TextOpacityLetters,{content:{title:\"Content\",type:ControlType.String,defaultValue:\"We remove the struggle, while you drive the impact.\\nGlobal talent transcends borders, we minimize the burden of settling-in.\"},font:{title:\"Font\",type:ControlType.Enum,options:[\"General Sans\",\"Frank Ruhl Libre\",\"Noto Serif Display\",\"Times New Roman\",\"Courier\"],defaultValue:\"General Sans\"},weight:{title:\"Weight\",type:ControlType.Enum,options:[\"normal\",\"bold\",\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Normal\",\"Bold\",\"Thin\",\"Extra Light\",\"Light\",\"Regular\",\"Medium\",\"Semibold\",\"Bold\",\"Extra Bold\",\"Black\"],defaultValue:\"600\"},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#FFFFFF\"},size:{title:\"Size\",type:ControlType.Number,defaultValue:3.75,min:1,max:16,step:.01,unit:\"em\"},letter:{title:\"Letter\",type:ControlType.Number,defaultValue:-.022,min:-.2,max:.2,step:.001,unit:\"em\"},line:{title:\"Line\",type:ControlType.Number,defaultValue:1.2,min:.5,max:3,step:.1,unit:\"em\"},align:{title:\"Align\",type:ControlType.Enum,options:[\"left\",\"center\",\"right\",\"justify\"],defaultValue:\"left\",displaySegmentedControl:true},balance:{title:\"Balance\",type:ControlType.Boolean,defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},easingFunction:{title:\"Easing Function\",type:ControlType.Enum,options:Object.keys(easingFunctions),optionTitles:[\"Linear\",\"Ease In-Out Quint\",\"Ease In Quad\",\"Ease Out Quad\",\"Ease In-Out Quad\",\"Ease In Cubic\",\"Ease Out Cubic\",\"Ease In-Out Cubic\",\"Ease In Expo\",\"Ease Out Expo\",\"Ease In-Out Expo\",\"Ease In Elastic\",\"Ease Out Bounce\",\"Step Reveal\"],defaultValue:\"easeInOutQuint\"},emphasisColor:{title:\"Emphasis Color\",type:ControlType.Color,defaultValue:\"#FF0000\"},emphasisWeight:{title:\"Emphasis Weight\",type:ControlType.Enum,options:[\"normal\",\"bold\",\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Normal\",\"Bold\",\"Thin\",\"Extra Light\",\"Light\",\"Regular\",\"Medium\",\"Semibold\",\"Bold\",\"Extra Bold\",\"Black\"],defaultValue:\"bold\"},emphasisStyle:{title:\"Emphasis Style\",type:ControlType.Enum,options:[\"normal\",\"italic\"],defaultValue:\"normal\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextOpacityLetters\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Opacity_Letters.map"],"mappings":"kbAAs8D,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,U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