【发布时间】:2015-03-07 16:39:09
【问题描述】:
在动画实际开始之前,动画从目标点到初始点有闪烁。如果你第二次运行它,它会很明显。
我必须在同一页面上多次使用它。因此我需要它不闪烁。
@-webkit-keyframes sjl {
from {
background-position: 0px -5000px;
}
to {
background-position: 0px 0px;
}
}
@-moz-keyframes sjl {
from {
background-position: 0px -5000px;
}
to {
background-position: 0px 0px;
}
}
@-ms-keyframes sjl {
from {
background-position: 0px -5000px;
}
to {
background-position: 0px 0px;
}
}
@-o-keyframes sjl {
from {
background-position: 0px -5000px;
}
to {
background-position: 0px 0px;
}
}
@keyframes sjl {
from {
background-position: 0px -5000px;
}
to {
background-position: 0px 0px;
}
}
.sjl
/*Squirrel jump left*/
{
width: 300px;
height: 250px;
-webkit-perspective: 1000; //tried to use this and the 3 lines below but in every combination, even placing it in body but doesn't solve the problem
-webkit-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
-webkit-transform:translate3d(0, 0, 0);
-webkit-animation: sjl 1.5s steps(20) alternate;
-moz-animation: sjl 1.5s steps(20) alternate;
-ms-animation: sjl 1.5s steps(20) alternate;
-o-animation: sjl 1.5s steps(20) alternate;
animation: sjl 1.5s steps(20) alternate;
background-image:url(http://s9.postimg.org/io6wluqhb/Sjl.png) !important;
position: absolute;
float: left;
top: 120px;
left: 10px;
z-index: 999;
}
【问题讨论】:
-
请参阅"Should questions include “tags” in their titles?",其中的共识是“不,他们不应该”!
-
虽然 CSS 动画闪烁可能是一个常见问题,但尝试缓解它的一种方法是使用
translate3d(0, 0, 0)davidwalsh.name/translate3d 在元素上实例化硬件加速 -
我尝试使用 translate3d(0, 0, 0) ,动画根本不播放。点击按钮后,只有动画的结束位置可见