尝试使用具有相同背景图像的两个居中的div [svg]制作一个从中心淡入图像的css动画,并为其宽度和背景位置设置动画。问题是,在Chrome上,有一个可怕的抖动问题(也许从铬循环通过动画步骤,而不是同时做它们?)Chrome css动画抖动
这里是jsfiddle:http://jsfiddle.net/evankford/s2uRV/4/,在那里你可以看到左边的抖动问题(它同时具有宽度动画和背景位置动画)。
相关代码(对不起,从它在该网站的一些吃剩的东西)
HTML:
<div class="underheader-wrapper uhw-title">
<div class="underheader uhleft undertitle"> </div>
<div class="underheader uhright undertitle"> </div>
</div>
和CSS:
.undertitle {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0);
background-image:url(http://cereusbright.com/newsite/presskit/images/underheader.svg);
}
.underheader-wrapper {
position: relative;
margin: auto;
width:320px;
height:100px;
}
.underheader {
-webkit-backface-visibility: hidden;
position:absolute;
width: 0px;
height:100px;
opacity: 0;
background-size: 320px 60px;
background-repeat: no-repeat;
-moz-animation-delay: 3s; -webkit-animation-delay:3s;
-moz-animation-duration: 3s; -webkit-animation-duration: 3s;
-moz-animation-name: part1; -webkit-animation-name:part1;
-webkit-animation-fill-mode:forwards;
-moz-animation-fill-mode:forwards}
.uhleft {
background-position: -160px 40px;
right: 160px;
-webkit-backface-visibility: hidden;
-moz-animation-delay: 3s; -webkit-animation-delay:3s;
-moz-animation-duration: 3s; -webkit-animation-duration: 3s;
-moz-animation-name: part2; -webkit-animation-name:part2;
-webkit-animation-fill-mode:forwards;
-moz-animation-fill-mode:forwards}
.uhright {
background-position: -160px 40px;
left: 160px;}
@-webkit-keyframes part1 {
from {
width: 0px;
opacity: 0;
}
to {
width: 160px;
opacity: 1;
}}
@-webkit-keyframes part2 {
from {
background-position:-160px 40px;
width: 0px;
opacity: 0;
}
to {
width: 160px;
background-position: 0px 40px;
opacity: 1;
}}
@-moz-keyframes part1 {
from {
width: 0px;
opacity: 0;
}
to {
width: 160px;
opacity: 1;
}}
@-moz-keyframes part2 {
from {
background-position:-160px 40px;
width: 0px;
opacity: 0;
}
to {
background-position: 0px 40px;
width: 160px;
opacity: 1;
}}
我是不是坚持了这种抖动?我已经做了一个JQuery版本,并发现有人说CSS比较干净/平滑,但抖动仍然发生。
即使改为'-webkit-animation-delay:0s,我仍然可以看到它; – AbdelElrafa