xxxxxxxxxx
<h1 class="ml9">
<span class="text-wrapper">
<span class="letters">Coffee mornings</span>
</span>
</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>
xxxxxxxxxx
// inside HTML tag
<p>Here is a sentence <span id="rotate">this</span> is what changes</p>
// inside script tag
var terms = ["term 1", "term 2", "term 3"];
function rotateTerm() {
var ct = $("#rotate").data("term") || 0;
$("#rotate")
.data("term", ct == terms.length -1 ? 0 : ct + 1)
.text(terms[ct]).fadeIn()
.delay(2000).fadeOut(200, rotateTerm);
}
$(rotateTerm);