I've got an animation where I'm trying to cycle through an array of strings, animating each one out and the other one in at the same time with opacity and transform: translateY, and it doesn't seem like there's a way to add targets in a for each loop as you
As you can see I've set up each string with an id based index and my plan was to remove .current-string from the visible string add it to the next string, and same for .next-string, but I don't think the targets update per loop.
Is there a different way to target each individual string and run through an entrance and exit animation for the string, and then trigger the next string once the last one was completed?
I found this example on Moving Letters but each target is added individually, meaning it won't function correctly if you add or remove strings without then adding or removing the targets. Or is there another way to add the targets as a node list or through a loop and animate each separately?
I've got an animation where I'm trying to cycle through an array of strings, animating each one out and the other one in at the same time with opacity and transform: translateY, and it doesn't seem like there's a way to add targets in a for each loop as you
As you can see I've set up each string with an id based index and my plan was to remove
.current-string
from the visible string add it to the next string, and same for.next-string
, but I don't think the targets update per loop.Is there a different way to target each individual string and run through an entrance and exit animation for the string, and then trigger the next string once the last one was completed?
I found this example on Moving Letters but each target is added individually, meaning it won't function correctly if you add or remove strings without then adding or removing the targets. Or is there another way to add the targets as a node list or through a loop and animate each separately?