【发布时间】:2023-03-20 20:54:01
【问题描述】:
问题
我有两个在单个元素上运行的 css 关键帧动画:
.fade-bg {
animation-name: fade-bg-1, fade-bg-2;
animation-delay: 0, 6s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
动画是这样定义的:
@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 { /* Same as fade-bg-1 only with image-2.jpg */ }
上面的方法有效,但是当它到达第二个动画时,它只会重复那个动画并且不会循环回到fade-bg-1。
我尝试了animation-direction 的许多不同组合,但无济于事。
问题
如何使动画返回fade-bg-1 并重复播放?
示例
【问题讨论】:
-
LMAO 你的问题是我的解决方案 XD,好吧,我想要一些东西淡入然后在循环动画 2 时留在屏幕上,但我想它应该能够做到这一点。谢谢:)
标签: css animation css-animations