我用Angular制作了一个简单的幻灯片,其中包含CSS动画.它工作得很好,但我会在图像之间遇到白色闪烁,我想这取决于图像加载. 有没有方法可以避免这种闪烁并使其无缝?
CSS file
.bg{
background-size: 100%;
background-repeat: no-repeat;
background-attachment: fixed;
height: 100vh;
animation: BgAnimation forwards;
animation-duration: 8s;
animation-iteration-count: 1;
animation-timing-function: linear;
animation-direction: normal;
}
@keyframes BgAnimation {
0% { background-image: url(../../assets/outro/1.jpg); }
33% { background-image: url(../../assets/outro/2.png); }
66% { background-image: url(../../assets/outro/3.jpg); }
100% { background-image: url(../../assets/outro/4.png); }
}
HTML file
<div class="bg"></div>