{"version":3,"file":"Text_Chr_Reveal.CSgF7v_p.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/7BMt3JVm7zyNgfciwYd2/hHA8Ksfq7rREe9gVMZB1/Text_Chr_Reveal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,motion,RenderTarget}from\"framer\";import{useRef,useEffect,useState,memo,useMemo}from\"react\";import{useInView}from\"framer-motion\";const CharacterRow=/*#__PURE__*/memo(({characters,yOffset,top,color,textStyle,keyPrefix,isInView,duration,isLooping,repeat,direction,delay})=>{// Determine initial and target Y positions based on direction\nconst initialY=direction===\"top-to-bottom\"?-yOffset:yOffset;const targetY=direction===\"top-to-bottom\"?0:0;return /*#__PURE__*/_jsx(\"div\",{style:{position:top===true?\"relative\":\"absolute\",top:top===true?undefined:`${top}%`,left:top===true?undefined:\"50%\",transform:top===true?undefined:\"translate(-50%, -50%)\",display:\"flex\",justifyContent:\"center\",textTransform:\"uppercase\",color,willChange:\"transform\",...textStyle},children:characters.map((char,index)=>/*#__PURE__*/_jsx(motion.span,{initial:{y:initialY},animate:{y:isInView?targetY:initialY},transition:{type:\"tween\",ease:[.2,.8,0,1],duration:duration,delay:delay+index*.06,repeat:isLooping?repeat:0,repeatType:\"reverse\"},style:{position:\"relative\",display:\"inline-block\",willChange:\"transform\"},children:char},`${keyPrefix}-${index}`))});});CharacterRow.displayName=\"CharacterRow\";export default function Text_Chr_Reveal({text=\"SELECTED\",textStyle={fontSize:26,lineHeight:\"1\"},color=\"#ECEBEB\",yOffset1=290,yOffset2=290,yOffset3=300,duration=2.5,loopDelay=1,isLooping=false,repeat=0,direction=\"top-to-bottom\",delay=0}){const ref=useRef(null);const isInView=useInView(ref,{once:!isLooping});const[key,setKey]=useState(0);// Memoize characters array to avoid recalculating on every render\nconst characters=useMemo(()=>text.split(\"\"),[text]);// Reset animation periodically if looping is enabled\nuseEffect(()=>{if(isInView&&isLooping){const interval=setInterval(()=>{setKey(prev=>prev+1);},(duration+loopDelay)*1e3);return()=>clearInterval(interval);}},[isInView,duration,loopDelay,isLooping]);if(RenderTarget.current()===\"CANVAS\"){return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",textTransform:\"uppercase\",color,willChange:\"transform\",...textStyle},children:characters.map((char,index)=>/*#__PURE__*/_jsx(motion.span,{style:{position:\"relative\",display:\"inline-block\"},children:char}))});}return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{display:\"flex\",flexDirection:\"column\",width:\"100%\",height:\"auto\",justifyContent:\"center\",overflow:\"hidden\",position:\"relative\"},children:[/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset1,top:true,color:color,textStyle:textStyle,keyPrefix:`${key}-top`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay}),/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset2,top:180,color:color,textStyle:textStyle,keyPrefix:`${key}-middle`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay}),/*#__PURE__*/_jsx(CharacterRow,{characters:characters,yOffset:yOffset3,top:250,color:color,textStyle:textStyle,keyPrefix:`${key}-bottom`,isInView:isInView,duration:duration,isLooping:isLooping,repeat:repeat,direction:direction,delay:delay})]});}addPropertyControls(Text_Chr_Reveal,{textStyle:{type:\"font\",title:\"Font\",controls:\"extended\",defaultValue:{fontSize:26,lineHeight:\"1\"}},delay:{type:ControlType.Number,defaultValue:0,title:\"Delay\"},duration:{type:ControlType.Number,defaultValue:2.5,title:\"Animation Duration\"},isLooping:{type:ControlType.Boolean,defaultValue:false,title:\"Loop\"},loopDelay:{type:ControlType.Number,defaultValue:1,title:\"Delay Between Loops\"},repeat:{type:ControlType.Number,defaultValue:0,title:\"Repeat Time\"},yOffset1:{type:ControlType.Number,defaultValue:290,title:\"Top Row Offset\"},yOffset2:{type:ControlType.Number,defaultValue:290,title:\"Middle Row Offset\"},yOffset3:{type:ControlType.Number,defaultValue:300,title:\"Bottom Row Offset\"},color:{type:ControlType.Color,defaultValue:\"#ECEBEB\",title:\"Text Color\"},text:{type:ControlType.String,title:\"Text Content\"},direction:{type:ControlType.Enum,defaultValue:\"top-to-bottom\",title:\"Transition Direction\",options:[\"top-to-bottom\",\"bottom-to-top\"],optionTitles:[\"Top to Bottom\",\"Bottom to Top\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text_Chr_Reveal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Text_Chr_Reveal.map"],"mappings":"yZACm0B,SAAwB,EAAgB,CAAC,OAAK,WAAW,YAAU,CAAC,SAAS,GAAG,WAAW,IAAI,CAAC,QAAM,UAAU,WAAS,IAAI,WAAS,IAAI,WAAS,IAAI,WAAS,IAAI,YAAU,EAAE,YAAU,GAAM,SAAO,EAAE,YAAU,gBAAgB,QAAM,GAAG,CAAC,IAAM,EAAIA,EAAO,KAAK,CAAO,EAAS,EAAU,EAAI,CAAC,KAAK,CAAC,EAAU,CAAC,CAAM,CAAC,EAAI,GAAQC,EAAS,EAAE,CAC9oC,EAAWC,MAAY,EAAK,MAAM,GAAG,CAAC,CAAC,EAAK,CAAC,CACwd,OAA3gB,MAAc,CAAC,GAAG,GAAU,EAAU,CAAC,IAAM,EAAS,gBAAgB,CAAC,EAAO,GAAM,EAAK,EAAE,GAAI,EAAS,GAAW,IAAI,CAAC,UAAU,cAAc,EAAS,GAAI,CAAC,EAAS,EAAS,EAAU,EAAU,CAAC,CAAI,EAAa,SAAS,GAAG,SAA8B,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,eAAe,SAAS,cAAc,YAAY,QAAM,WAAW,YAAY,GAAG,EAAU,CAAC,SAAS,EAAW,KAAK,EAAK,IAAqB,EAAK,EAAO,KAAK,CAAC,MAAM,C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