我使用浮动图像,然后淡出。 (有些人则相反,渐渐淡入)。它在循环中第一次工作,但是当第二次到达时,衰落就被切掉了。在CSS循环上运行两个不同的同时动画?
.candycane {
width: 128px;
height: 128px;
position: absolute;
background: transparent url(https://i.stack.imgur.com/qM90U.png) 0 0 no-repeat;
}
.candycane_drift {
top: 55px;
z-index: 100;
animation: drift 15s linear infinite, 3s fadeOut 12s ease-in;
}
@keyframes drift {
from {
transform: translateX(-175px);
}
to {
transform: translateX(400px);
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
<div class="candycane candycane_drift"></div>
你是什么意思 “删去了”?尝试在第二组参数中加入'infinite'到'animation'。 '动画:漂移15s线性无限,3s fadeOut 12s缓解无限;' –
@BrettEast这只是让它闪烁。 – user70848
你是对的,无限无法解释延迟,然而使用%keyframes确实 - 见Squarecandy的答案。 –