【发布时间】:2015-09-16 04:57:55
【问题描述】:
我有两个 css3 关键帧并通过某个按钮触发,但问题是当我尝试添加新关键帧(新类)时,过渡不会以平滑的方式发生变化,如何使过渡顺利进行?
.button {
width:50px;
height:50px;
background:silver;
}
.box {
width: 100px;
height: 100px;
background: green;
position: relative;
top: 10%;
left: 10%;
}
.box {
animation: xx 2s linear infinite;
}
.boxShake {
animation:boxShake 2s linear infinite;
}
【问题讨论】:
-
没有。不可能有两个原因(1)当原始动画被删除(不再适用)时,元素会回弹到其原始位置而不是过渡(FF会但Chrome和其他浏览器不会't) 就像提到的here...
-
(2) 将新值应用于转换属性后,它会覆盖前一个值(如提到的here),因此会再次恢复到原始位置。
-
@Riantori: JS 解决方案可以接受吗?
-
@Riantori: jsfiddle.net/rswmb4sr/2.
-
@Harry 我找到了一个(棘手的)方法来获得它:-)
标签: css css-transitions