我正在尝试通过无限关键帧动画和animation-delay属性,使三个框的透明度(淡入淡出)错开。
不过,当第三个框淡出时,它会突然微弱地重新出现("闪烁"),然后动画再次开始。我在各种浏览器中都遇到了这种情况。
如果可能,我想使用伪元素来解决这个问题,请问有没有已知的修复这个关键帧错误的方法?
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;
}
}