目录

style animationDirection 属性

示例

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

document.getElementById("myDIV").style.animationDirection = "reverse";
亲自试一试 »

描述

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

笔记:如果动画设置为仅播放一次,则此属性将不起作用。


语法

返回animationDirection属性:

object.style.animationDirection

设置animationDirection属性:

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

属性值

Value Description
normal Default value. The animation should be played as normal
reverse The animation should play in reverse direction
alternate The animation will be played as normal every odd time (1,3,5,etc..) and in reverse direction every even time (2,4,6,etc...)
alternate-reverse The animation will be played in reverse direction every odd time (1,3,5,etc..) and in a normal direction every even time (2,4,6,etc...)
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

技术细节

默认值: 普通的
返回值: 一个字符串,表示元素的动画方向属性
CSS版本 CSS3

浏览器支持

animationDirection是 CSS3 (1999) 的一项功能。

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

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11

相关页面

CSS 参考:动画方向属性