Here is a CodePen that uses nth-child
to animate a scrolling list.
Here is the relevant CSS:
.element:nth-child(1){animation-delay:0s;opacity:0;}
.element:nth-child(2){animation-delay:5s;opacity:0;}
.element:nth-child(3){animation-delay:10s;opacity:0;}
.element:nth-child(4){animation-delay:15s;opacity:0;}
.element:nth-child(5){animation-delay:20s;opacity:0;}
.element:nth-child(6){animation-delay:25s;opacity:0;}
.element:nth-child(7){animation-delay:30s;opacity:0;}
with an animation-roll
.element{grid-column:1/-1; grid-row:1/-1; margin-right:auto; animation:roll 35s cubic-bezier(.25,.1,.25,1) 1s infinite backwards;}
As you see, the previous child is overwriting the next child. Said another way, the duration for the current child is too long and is stepped-on by the next child.
How to modify the animation so that each child is properly sequenced and no child conflicts with the next child?
Note: I have spend hours and tried many different combinations of animation-delay
and animation:roll
and they all fail. Something else is going on that I do not understand, so am looking for education as well as a working solution.