var textWrapper = document.querySelector('.theselector .letters'); textWrapper.innerHTML = textWrapper.textContent.replace(/([^\x00-\x80]|\w)/g, "$&"); anime.timeline({loop: loopvalue}) .add({ targets: '.theselector .line', scaleY: [0,1], opacity: [0.5,1], easing: "easeOutExpo", duration: 700 }) .add({ targets: '.theselector .line', translateX: [0, document.querySelector('.theselector .letters').getBoundingClientRect().width + 10], easing: "easeOutExpo", duration: 700, delay: 100 }).add({ targets: '.theselector .letter', opacity: [0,1], easing: "easeOutExpo", duration: 600, offset: '-=775', delay: (el, i) => 34 * (i+1) }).add({ targets: '.theselector', opacity: 0, duration: 1000, easing: "easeOutExpo", delay: 5000000000000 });