{"version":3,"file":"Animated_Text_Gradient_02.B9RkoMBJ.mjs","names":["useState","useRef","React","__esmMin","init_npm_react_18_3_1","_e","de","init_jsx_runtime","c","p","e","ce","addPropertyControls","ControlType","init_framer_CaDWdxiz","AnimatedGradientText","props","applyFontStyles","font","isVisible","setIsVisible","gradientPosition","setGradientPosition","isPaused","setIsPaused","textRef","animationRef","gradientColors","color1","color2","useColor3","color3","useColor4","color4","useColor5","color5","animateOnViewport","observer","entry","startTime","animate","currentTime","progress","animationSpeed","position","createGradient","colorStops","color","index","gradientDirection","handleMouseEnter","pauseOnHover","handleMouseLeave","renderTextWithLineBreaks","lines","text","line","fontStyles","textFont","TextTag","semanticTag","containerStyle","textStyle","init_Animated_Text_Gradient_02"],"sources":["https:/framerusercontent.com/modules/vKR69kF1mirdUEdXSulC/K3Z3l9sF65iXoHxuFKwH/Animated_Text_Gradient_02.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React,{useState,useEffect,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function AnimatedGradientText(props){const{text=\"Beautiful Gradient Text\",textFont,// Accessibility\nsemanticTag=\"h1\",// Gradient colors (up to 5 colors)\ncolor1=\"#ff6b6b\",color2=\"#4ecdc4\",color3=\"#45b7d1\",color4=\"#96ceb4\",color5=\"#feca57\",useColor3=true,useColor4=false,useColor5=false,// Animation settings\nanimateOnViewport=true,animationSpeed=6,gradientDirection=90,// Advanced settings\npauseOnHover=false}=props;// Helper function to apply font styles\nconst applyFontStyles=font=>{if(!font||typeof font===\"string\"){return{fontFamily:font||\"Inter\",fontSize:48,fontWeight:700,lineHeight:1.2,letterSpacing:\"-0.02em\",textAlign:\"center\"};}return{fontFamily:font.family||font.fontFamily||\"Inter\",fontSize:font.size||font.fontSize||48,fontWeight:font.weight||font.fontWeight||700,lineHeight:font.lineHeight||1.2,letterSpacing:font.letterSpacing||\"-0.02em\",textAlign:font.alignment||font.textAlign||\"center\"};};const[isVisible,setIsVisible]=useState(false);const[gradientPosition,setGradientPosition]=useState(0);const[isPaused,setIsPaused]=useState(false);const textRef=useRef(null);const animationRef=useRef(null);// Build gradient colors array\nconst gradientColors=[color1,color2];if(useColor3)gradientColors.push(color3);if(useColor4)gradientColors.push(color4);if(useColor5)gradientColors.push(color5);// Intersection Observer for viewport detection\nuseEffect(()=>{if(!animateOnViewport){setIsVisible(true);return;}const observer=new IntersectionObserver(([entry])=>{setIsVisible(entry.isIntersecting);},{threshold:.1});if(textRef.current){observer.observe(textRef.current);}return()=>{if(textRef.current){observer.unobserve(textRef.current);}};},[animateOnViewport]);// Gradient animation\nuseEffect(()=>{if(!isVisible||isPaused){if(animationRef.current){cancelAnimationFrame(animationRef.current);}return;}let startTime=null;const animate=currentTime=>{if(startTime===null)startTime=currentTime;const elapsed=currentTime-startTime;const progress=elapsed/(animationSpeed*1e3)%1;const position=Math.sin(progress*Math.PI*2)*50;setGradientPosition(position);animationRef.current=requestAnimationFrame(animate);};animationRef.current=requestAnimationFrame(animate);return()=>{if(animationRef.current){cancelAnimationFrame(animationRef.current);}};},[isVisible,animationSpeed,isPaused]);// Create gradient CSS\nconst createGradient=()=>{const colorStops=gradientColors.map((color,index)=>{const position=index/(gradientColors.length-1)*100;return`${color} ${position}%`;}).join(\", \");return`linear-gradient(${gradientDirection}deg, ${colorStops})`;};// Handle mouse events for pause on hover\nconst handleMouseEnter=()=>{if(pauseOnHover){setIsPaused(true);}};const handleMouseLeave=()=>{if(pauseOnHover){setIsPaused(false);}};// Split text into lines for rendering\nconst renderTextWithLineBreaks=()=>{const lines=text.split(\"\\n\");return lines.map((line,index)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[line,index<lines.length-1&&/*#__PURE__*/_jsx(\"br\",{})]},index));};const fontStyles=applyFontStyles(textFont);// Determine which HTML tag to use\nconst TextTag=semanticTag||\"h1\";const containerStyle={display:\"inline-block\",position:\"relative\",textAlign:fontStyles.textAlign,width:fontStyles.textAlign===\"center\"?\"100%\":\"auto\"};const textStyle={...fontStyles,margin:0,padding:0,background:createGradient(),backgroundSize:`200% 200%`,backgroundPosition:`${50+gradientPosition}% ${50+gradientPosition}%`,backgroundClip:\"text\",WebkitBackgroundClip:\"text\",color:\"transparent\",display:\"inline-block\",transition:animateOnViewport&&!isVisible?\"opacity 0.6s ease-out\":\"none\",opacity:animateOnViewport?isVisible?1:.2:1,cursor:pauseOnHover?\"pointer\":\"default\"};return /*#__PURE__*/_jsx(\"div\",{ref:textRef,style:containerStyle,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(TextTag,{style:textStyle,children:renderTextWithLineBreaks()})});}addPropertyControls(AnimatedGradientText,{text:{type:ControlType.String,title:\"Text\",displayTextArea:true,defaultValue:\"Beautiful Gradient Text\"},semanticTag:{type:ControlType.Enum,title:\"Semantic Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\"],optionTitles:[\"H1 (Main Heading)\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\"],defaultValue:\"h1\"},textFont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{family:\"Inter\",size:48,weight:\"700\",lineHeight:1.2,letterSpacing:\"-0.02em\"}},color1:{type:ControlType.Color,title:\"Color 1\",defaultValue:\"#ff6b6b\"},color2:{type:ControlType.Color,title:\"Color 2\",defaultValue:\"#4ecdc4\"},useColor3:{type:ControlType.Boolean,title:\"Use Color 3\",defaultValue:true,enabledTitle:\"Enabled\",disabledTitle:\"Disabled\"},color3:{type:ControlType.Color,title:\"Color 3\",defaultValue:\"#45b7d1\",hidden:props=>!props.useColor3},useColor4:{type:ControlType.Boolean,title:\"Use Color 4\",defaultValue:false,enabledTitle:\"Enabled\",disabledTitle:\"Disabled\"},color4:{type:ControlType.Color,title:\"Color 4\",defaultValue:\"#96ceb4\",hidden:props=>!props.useColor4},useColor5:{type:ControlType.Boolean,title:\"Use Color 5\",defaultValue:false,enabledTitle:\"Enabled\",disabledTitle:\"Disabled\"},color5:{type:ControlType.Color,title:\"Color 5\",defaultValue:\"#feca57\",hidden:props=>!props.useColor5},animateOnViewport:{type:ControlType.Boolean,title:\"Animate on Viewport\",defaultValue:true,enabledTitle:\"On Scroll Into View\",disabledTitle:\"Always Animate\"},animationSpeed:{type:ControlType.Number,title:\"Animation Speed\",min:2,max:30,step:.5,defaultValue:6,unit:\"s\",displayStepper:true},gradientDirection:{type:ControlType.Number,title:\"Gradient Angle\",min:0,max:360,step:15,defaultValue:90,unit:\"\\xb0\",displayStepper:true},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\",defaultValue:false,enabledTitle:\"Enabled\",disabledTitle:\"Disabled\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedGradientText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Animated_Text_Gradient_02.map"],"mappings":"A,sMAIG,SAAwBe,EAAqB,EAAM,CAAC,GAAK,CAAC,OAAK,0BAA0B,WAC5F,cAAY,KACZ,SAAO,UAAU,SAAO,UAAU,SAAO,UAAU,SAAO,UAAU,SAAO,UAAU,YAAU,GAAK,YAAU,GAAM,YAAU,GAC9H,oBAAkB,GAAK,iBAAe,EAAE,oBAAkB,GAC1D,eAAa,IAAOC,EACdC,EAAgB,GAAU,CAACC,GAAM,OAAOA,GAAO,SAAgB,CAAC,WAAWA,GAAM,QAAQ,SAAS,GAAG,WAAW,IAAI,WAAW,IAAI,cAAc,UAAU,UAAU,QAAQ,EAAS,CAAC,WAAWA,EAAK,QAAQA,EAAK,YAAY,QAAQ,SAASA,EAAK,MAA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