【发布时间】:2018-01-03 02:02:56
【问题描述】:
我正在使用带有步骤的 css 动画...我的问题是:
当 step() == (frame length -1) 时,除了我看不到最后一帧之外,一切都很流畅
当 step() == 帧长度时,我仍然看不到最后一帧,并且动画很混乱...
我正在寻找一种 100% 使用背景的方法(或者至少解释为什么它不起作用),因为我可以将它与具有不同帧数的精灵一起使用,并且只需使用 step() 来调整到实际的精灵..
演示:
#sprite1, #sprite2, #sprite3 {
height: 41px;
width: 41px;
background: url('https://img4.hostingpics.net/thumbs/mini_756487pacanim2.png') 0 center;
}
#sprite1 {
animation: sprite 1s steps(3) infinite;
}
#sprite2 {
animation: sprite 1s steps(4) infinite;
}
#sprite3 {
animation: sprite2 1s steps(4) infinite;
}
@keyframes sprite {
100% { background-position: right center; }
}
@keyframes sprite2 {
100% { background-position: 164px center; }
}
Case1: <br>
<div id="sprite1"></div>
Case2:
<div id="sprite2"></div>
What it should be:
<div id="sprite3"></div>
【问题讨论】:
标签: css css-animations css-sprites