-class CaptureText{constructor(e,t,s=.7){this.textArray=e,this.selectors=t,this.speed=s,this.currentWordIndex=0,this.elements=document.querySelectorAll(this.selectors)}animateText(e){e.innerHTML=this.textArray[this.currentWordIndex].replace(/\S/g,"<span class='inline-block'>$&</span>"),anime.timeline({loop:!1}).add({targets:".animated-text .inline-block",scale:[4,1],opacity:[0,1],translateZ:0,easing:"easeOutExpo",duration:950/this.speed,delay:(e,t)=>70/this.speed*t}).add({targets:".animated-text .inline-block",opacity:0,duration:1e3,easing:"easeOutExpo",delay:1e3})}start(){let e=()=>{this.elements.forEach(e=>{this.animateText(e)}),this.currentWordIndex=(this.currentWordIndex+1)%this.textArray.length};e(),setInterval(()=>{e()},2750/this.speed)}}window.CaptureText=CaptureText;
0 commit comments