CSS-动画/动画方向/反向

Sak*_*ONE 0 css css3 css-animations

#div {
position: absolute; top: 50px;
width: 100px; height: 100px; background: blue;
    -webkit-animation-name: shift;
    -webkit-animation-duration: 10s;
    -webkit-animation-iteration-count: 2;
    -webkit-animation-direction: reverse;
  }
 @-webkit-keyframes shift{
    from{
        top: 50px;
        left: 0px;    
    }
    20% {
        top: 150px;
        left: 100px;
    }
    to {
        top: 400px;
        left: 300px;
    }   
 }
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/uVv65/2/ 为什么反向动画方向与正常相同?我以为它会来自

top: 400px;
left: 300px;
Run Code Online (Sandbox Code Playgroud)

top: 50px;
left: 0px;  
Run Code Online (Sandbox Code Playgroud)

小智 5

直到最近,"逆转"才是一个方向."alternate"一直是一个方向,所以实现"反向"的人会使迭代计数为2,然后给动画一个迭代的负起始偏移(在你的情况下是-10s),这样动画将从"交替"部分开始.希望很快"反向"渗透到浏览器!