{"version":3,"file":"LiquidHeading.DWuKIYry.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/5kPYCwtTQzkBuoyt2a2K/LdF2C0e8RoawqU3sG686/LiquidHeading.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{motion,useMotionValue,useTransform,useAnimationFrame,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useMemo,useEffect}from\"react\";export default function LiquidHeading({text=\"LIQUID\",font={},textColor=\"#00D9FF\",intensity=1,speed=1,style}){// Detect if user prefers reduced motion for accessibility\nconst[prefersReducedMotion,setPrefersReducedMotion]=useState(false);useEffect(()=>{const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");setPrefersReducedMotion(mediaQuery.matches);const handler=e=>setPrefersReducedMotion(e.matches);mediaQuery.addEventListener(\"change\",handler);return()=>mediaQuery.removeEventListener(\"change\",handler);},[]);// Motion value for time - updates every frame without triggering React re-renders\nconst time=useMotionValue(0);// Track which letter is currently being hovered\nconst[hoveredIndex,setHoveredIndex]=useState(null);// Animation loop - runs at 60fps via requestAnimationFrame\nuseAnimationFrame(t=>{if(!prefersReducedMotion){time.set(t/1e3)// Convert milliseconds to seconds\n;}});// Split text into individual letters (memoized for performance)\nconst letters=useMemo(()=>text.split(\"\"),[text]);// Extract fontSize and textAlign from Framer's Font control\nconst fontSize=font.fontSize||120;const textAlign=font.textAlign||\"left\";// Map text alignment to flexbox justifyContent\nconst alignmentMap={left:\"flex-start\",center:\"center\",right:\"flex-end\"};// Handle empty text gracefully\nif(!text||text.trim().length===0){return /*#__PURE__*/_jsx(\"div\",{style:{...style,color:`${textColor}40`,fontSize:fontSize*.4,display:\"inline-block\"},children:\"Enter text...\"});}return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",display:\"flex\",width:\"100%\",overflow:\"visible\"},role:\"heading\",\"aria-label\":text,children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",position:\"relative\",justifyContent:alignmentMap[textAlign]||\"flex-start\",width:\"100%\"},children:letters.map((letter,index)=>/*#__PURE__*/_jsx(Letter,{letter:letter,index:index,time:time,hoveredIndex:hoveredIndex,onHoverStart:()=>setHoveredIndex(index),onHoverEnd:()=>setHoveredIndex(null),textColor:textColor,font:font,fontSize:fontSize,intensity:intensity,speed:speed,prefersReducedMotion:prefersReducedMotion},index))})});}function Letter({letter,index,time,hoveredIndex,onHoverStart,onHoverEnd,textColor,font,fontSize,intensity,speed,prefersReducedMotion}){const isHovered=hoveredIndex===index;/**\n     * Vertical Position (Y)\n     * Combines three effects:\n     * 1. Base wave - continuous sine wave across all letters\n     * 2. Hover shake - gentle vibration on hovered letter\n     * 3. Ripple - wave effect spreading from hovered letter to neighbors\n     */const y=useTransform(time,t=>{if(prefersReducedMotion)return 0;// Base wave animation\nconst baseWave=Math.sin(t*2*speed+index*.5)*2.5*intensity;// Gentle shake on hover\nconst hoverShake=isHovered?Math.sin(t*4*speed)*.8*intensity:0;// Ripple effect from hovered letter\nlet ripple=0;if(hoveredIndex!==null){const distance=Math.abs(index-hoveredIndex);const strength=Math.max(0,1-distance*.3);ripple=Math.sin(t*5*speed-distance*.4)*6*intensity*strength;}return baseWave+hoverShake+ripple;});/**\n     * Scale\n     * Combines:\n     * 1. Base scale - subtle breathing effect\n     * 2. Hover scale - slight enlargement on hover\n     * 3. Ripple scale - neighbors pulse with the ripple\n     */const scale=useTransform(time,t=>{// Subtle breathing animation\nconst baseScale=prefersReducedMotion?1:1+Math.sin(t*1.5*speed+index*.3)*.03*intensity;// Gentle scale on hover\nconst hoverScale=isHovered?1.05:1;// Ripple scale effect\nlet rippleScale=1;if(hoveredIndex!==null&&!prefersReducedMotion){const distance=Math.abs(index-hoveredIndex);const strength=Math.max(0,1-distance*.3);rippleScale=1+Math.sin(t*5*speed-distance*.4)*.06*intensity*strength;}return baseScale*hoverScale*rippleScale;});/**\n     * Horizontal Skew\n     * Creates liquid wobble effect\n     */const skewX=useTransform(time,t=>prefersReducedMotion?0:Math.sin(t*2.5*speed+index*.4)*1.2*intensity);/**\n     * Vertical Skew\n     * Adds to liquid distortion with different frequency\n     */const skewY=useTransform(time,t=>prefersReducedMotion?0:Math.cos(t*2*speed+index*.6)*.8*intensity);/**\n     * Blur on Hover\n     * Subtle blur for depth effect - uses spring for smooth transitions\n     */const blur=useSpring(isHovered?.2:0,{stiffness:200,damping:25});return /*#__PURE__*/_jsx(motion.span,{onHoverStart:onHoverStart,onHoverEnd:onHoverEnd,style:{display:\"inline-block\",color:textColor,cursor:\"pointer\",userSelect:\"none\",position:\"relative\",transformOrigin:\"center center\",// Apply all transforms via Framer Motion\ny,scale,skewX,skewY,filter:useTransform(blur,b=>`blur(${b}px)`),...font},transition:{type:\"spring\",stiffness:300,damping:25},children:letter===\" \"?\"\\xa0\":letter});}/**\n * Framer Property Controls\n * Clean and focused interface with just the essentials\n */addPropertyControls(LiquidHeading,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"LIQUID\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:{fontSize:120,fontWeight:900,letterSpacing:\"-0.02em\",lineHeight:\"1em\"}},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#00D9FF\"},intensity:{type:ControlType.Number,title:\"Intensity\",defaultValue:1,min:0,max:3,step:.1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:3,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LiquidHeading\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LiquidHeading.map"],"mappings":"mRAAuO,SAAwB,EAAc,CAAC,OAAK,SAAS,OAAK,EAAE,CAAC,YAAU,UAAU,YAAU,EAAE,QAAM,EAAE,SAAO,CACnV,GAAK,CAAC,EAAqB,GAAyBA,EAAS,GAAM,CAAC,MAAc,CAAC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