{"version":3,"file":"Text_Color.DCNJfbiM.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/wiCQtBrL0wzGjneKCxwP/GvIp4hWpKwKYFnzXgdvx/Text_Color.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{motion,useAnimation}from\"framer-motion\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function getFontFamily(font,fallback){if(!font)return fallback;return font.fontFamily||fallback;}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 120\n */export default function TextColorAnimation({text,fontSize,fontWeight,textAlign,color01,color02,Duration,delay,replays,triggerOnce,inViewThreshold,font,fallbackFontFamily,letterSpacing}){const controls=useAnimation();const textRef=useRef(null);const hasPlayedRef=useRef(false);useEffect(()=>{if(RenderTarget.hasRestrictions())return;if(!textRef.current)return;const node=textRef.current;const observer=new IntersectionObserver(async([entry])=>{const isInView=entry.isIntersecting;if(isInView){if(triggerOnce&&hasPlayedRef.current)return;await new Promise(resolve=>setTimeout(resolve,Math.max(0,delay)*1e3));controls.start(\"visible\");hasPlayedRef.current=true;return;}if(!isInView&&replays&&!triggerOnce){controls.start(\"hidden\");}},{threshold:Math.min(1,Math.max(0,inViewThreshold))});observer.observe(node);return()=>observer.disconnect();},[controls,delay,replays,triggerOnce,inViewThreshold]);const resolvedFontFamily=getFontFamily(font,fallbackFontFamily);const weightMap={Light:300,Regular:400,Bold:700,ExtraBold:800,Heavy:900};return /*#__PURE__*/_jsxs(\"div\",{ref:textRef,style:{width:\"100%\",height:\"100%\",boxSizing:\"border-box\",fontSize:`${fontSize}px`,...font,textAlign:textAlign,letterSpacing:`${letterSpacing}px`,whiteSpace:\"pre-wrap\",overflowWrap:\"anywhere\",wordBreak:\"break-word\",color:color01,position:\"relative\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",width:\"100%\"},children:text}),/*#__PURE__*/_jsx(motion.span,{style:{position:\"absolute\",top:0,left:0,display:\"block\",width:\"100%\",whiteSpace:\"pre-wrap\",overflowWrap:\"anywhere\",wordBreak:\"break-word\",color:color02,pointerEvents:\"none\"},animate:controls,initial:\"hidden\",variants:{hidden:{clipPath:\"inset(0 100% 0 0)\"},visible:{clipPath:\"inset(0 0% 0 0)\"}},transition:{duration:Duration},children:text})]});}addPropertyControls(TextColorAnimation,{text:{type:ControlType.String,defaultValue:\"Hello,\\nWorld!\",displayTextArea:true},// ✅ Only for picking the font from Framer list\nfont:{type:ControlType.Font,defaultFontType:\"sans-serif\"},fallbackFontFamily:{type:ControlType.String,title:\"Fallback Font\",defaultValue:\"Arial\"},fontSize:{type:ControlType.Number,defaultValue:16,min:1,max:200,unit:\"px\"},fontWeight:{title:\"Weight\",type:ControlType.Enum,defaultValue:\"Regular\",options:[\"Light\",\"Regular\",\"Bold\",\"ExtraBold\",\"Heavy\"]},textAlign:{title:\"Text Align\",type:ControlType.Enum,displaySegmentedControl:true,optionTitles:[\"Left\",\"Center\",\"Right\"],options:[\"left\",\"center\",\"right\"],defaultValue:\"left\"},color01:{title:\"Color 01\",type:ControlType.Color,defaultValue:\"#333\"},color02:{title:\"Color 02\",type:ControlType.Color,defaultValue:\"#fff\"},Duration:{type:ControlType.Number,defaultValue:1,min:.1,max:10,step:.1},delay:{title:\"Delay\",type:ControlType.Number,defaultValue:0,min:0,max:10,step:.1},replays:{title:\"Replays\",type:ControlType.Boolean,defaultValue:true},triggerOnce:{title:\"Trigger Once\",type:ControlType.Boolean,defaultValue:false},inViewThreshold:{title:\"In-View %\",type:ControlType.Number,defaultValue:.2,min:0,max:1,step:.05},letterSpacing:{title:\"Letter Spacing\",type:ControlType.Number,defaultValue:0,min:-10,max:20,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextColorAnimation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"au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