I'm currently working on creating a staggered opacity effect for three boxes using an infinite keyframe animation and the animation-delay property.
However, I've encountered an unexpected issue where the third box seems to fade away and then reappear faintly ("flicker") before the animation loop starts again. This problem is consistent across different browsers.
I'm considering using pseudo-elements to see if that can resolve the issue. Are there any known solutions to this keyframe bug?
HTML
<div class="container">
<div class="child">
<div></div>
</div>
</div>
SCSS
.container {
position: fixed;
left: 150px;
top: 50px;
.child {
position: absolute;
animation:mymove 1s infinite;
&::before{
display: block;
position: absolute;
width: 25px;
height: 25px;
background-color: red;
content: "";
right: 40px;
animation: inherit;
animation-delay: .15s;
}
div {
width: 25px;
height: 25px;
background-color: red;
animation: inherit;
animation-delay: .30s;
}
&::after{
display: block;
position: absolute;
width: 25px;
height: 25px;
background-color: red;
content: "";
left: 40px;
bottom: 0px;
animation: inherit;
animation-delay: .45s;
}
}
}
@keyframes mymove {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}