I'm trying to get a cycle/loop effect on 3 H1 elements, displaying a purple font color for each H1 for some seconds and then change to another H1 right below the first one.
I wanted this effect to be infinite and I thought about using for loop and setInterval but I'm getting anywhere.
setInterval(changeColorLoop(), 2000);
function changeColorLoop() {
const titleArtArray = document.querySelectorAll(".art-text");
for (var i = 0; i < titleArtArray.length; i++) {
titleArtArray[i].classList.toggle = ".purple";
}
}
<div class="art-column">
<h1 class="art-text">Think</h1>
<h1 class="art-text">Design</h1>
<h1 class="art-text">Code</h1>
</div>
.purple {
color: purple;
}