So, on my website, i have 8 title strings, and i want to give for each one type write effect by scrolling (only one time).
I have already written some code to detect only title that i need by scrolling, so by scrolling, i start typeWriteEffect function with param string (so i only get title that i want to animate):
let titleStrings = [];
function typeWriteEffect(string) {
if (!titleStrings.includes(string)) {
titleStrings.push(string);
}
console.log(titleStrings);
}
And now one question, how is it better to give effect for each title only once?