I am looking to implement css keyframe animation for a set of logo images, logos must infinitely slide, here is how I am doing it:
.animated-logo-set {
display: flex;
flex-direction: column;
height: 20px;
overflow: hidden;
}
.animated-logo-set span {
font-size: 20px;
line-height: 20px;
background-color: red;
height: 20px;
animation: slideup 5s infinite;
}
@keyframes slideup {
0%,
15% {
transform: translateY(0);
}
50%,
66% {
transform: translateY(-20px);
}
90%,
100% {
transform: translateY(-40px);
}
}
<div class="animated-logo-set">
<span>Samsung</span>
<span>Toyota</span>
<span>Samsung</span>
</div>
This works fine if I know exactly how many logo images are to be animated. In my case, it can be any number of logo image from 2 to 20 for example, how do I deal with dynamic elements for such animation? is there a way we can do it using just the CSS or do we need to do it using JS? any pointer in here is appreciated.
Here is the link to CodeSandbox: https://codesandbox.io/s/blazing-forest-6oyk7w?file=/index.html:0-836.
Thank you.