Exploring the Challenge
In my coding journey, I encountered an interesting dilemma involving two css keyframe animations operating on a single element:
.fade-bg {
animation-name: fade-bg-1, fade-bg-2;
animation-delay: 0, 6s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
The description of the animations is as follows:
@keyframes fade-bg-1 {
from {
opacity: 0;
background-image: url(image-1.jpg);
}
50% {
opacity: 1;
background-image: url(image-1.jpg);
}
to {
opacity: 0;
background-image: url(image-1.jpg);
}
}
@keyframes fade-bg-2 { /* Similar to fade-bg-1 but with image-2.jpg */ }
While this setup technically works, it encounters a roadblock where upon reaching the second animation, it continuously replays that particular animation without circling back to fade-bg-1
.
Various attempts at manipulating animation-direction
have been made, yet none have yielded the desired outcome.
Pondering the Solution
I am left wondering: How can I configure the animation to return to fade-bg-1
and restart the looping process?