Style animationDirection 属性

定义和用法

animationDirection 属性设置或返回动画是否应在交替循环中反向播放。

注释:如果动画设置为只播放一次,此属性将无效。

实例

更改 <div> 元素的 animationDirection 属性:

document.getElementById("myDIV").style.animationDirection = "reverse";

亲自试一试

语法

返回 animationDirection 属性:

object.style.animationDirection

设置 animationDirection 属性:

object.style.animationDirection = "normal|reverse|alternate|alternate-reverse|initial|inherit"

属性值

描述
normal 默认值。动画应该正常播放。
reverse 动画应该反向播放。
alternate 动画将在每个奇数次(1、3、5 等)正向播放,并在每个偶数次(2、4、6 等...)反向播放。
alternate-reverse 动画将在每个奇数次(1、3、5 等)反向播放,并在每个偶数次(2、4、6 等...)正向播放。
initial 将此属性设置为其默认值。请参阅 initial
inherit 从其父元素继承此属性。请参阅 inherit

技术细节

默认值: normal
返回值: 字符串,表示元素的 animation-direction 属性
CSS 版本: CSS3

浏览器支持

animationDirection 是 CSS3 (1999) 特性。

所有浏览器都完全支持它:

Chrome Edge Firefox Safari Opera IE
Chrome Edge Firefox Safari Opera IE
支持 支持 支持 支持 支持 11

相关页面

CSS 参考手册:animation-direction 属性


http://www.vxiaotou.com