1h1:before{
2 content: 'Original Text';
3 font-size: 600%;
4 animation-name: head;
5 animation-duration: 4s;
6 animation-iteration-count: infinite;
7}
8
9@keyframes head {
10 0% {font-size:600%; opacity:1;}
11 25% {font-size:570%; opacity:0;}
12 50% {font-size:600%; opacity:1;}
13 65% {font-size:570%; opacity:0;}
14 80% {font-size:600%; opacity:1; content: "Changed Text"}
15 90% {font-size:570%; opacity:0;}
16 100% {font-size:600%;opacity:1; content: "Original Text"}
17}
1// Wrap every letter in a span
2var textWrapper = document.querySelector('.ml3');
3textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
4
5anime.timeline({loop: true})
6 .add({
7 targets: '.ml3 .letter',
8 opacity: [0,1],
9 easing: "easeInOutQuad",
10 duration: 2250,
11 delay: (el, i) => 150 * (i+1)
12 }).add({
13 targets: '.ml3',
14 opacity: 0,
15 duration: 1000,
16 easing: "easeOutExpo",
17 delay: 1000
18 });