Thank you again.
I've been playing a bit around with the code. But can you explain to me like I am 5 what this line does
if(i !== words.length - 1) {
If the word is not equal to number of words minus 1? I know it will skip the first line but its still a bit confusing to me
I tried to upgrade to 3.0.1 but my code generates a gap in the middle of the animation. I cant make a codepen because I cant add gsap 3.0.1 as a dependency and the CDN isn't working. I get an ngix error 404: https://cdnjs.cloudflare.com/ajax/libs/gsap/3.0.1/gsap.min.js
Here is my code 3.0.1:
const words = document.querySelectorAll('.rotator > span')
let main = gsap.timeline({repeat: -1});
for (let i = 0; i < words.length; i++) {
let delay = i - 1;
let wordTL = gsap.timeline();
if(i !== 0) {
wordTL.from(words, 1, { y: '-100%', opacity: 0, ease: 'power2.out' });
}
if(i !== words.length - 1) {
wordTL.to(words, 1, { y: '100%', opacity: 0, ease: 'power2.out' });
}
main.add(wordTL, delay);
}