更改 <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 参考:动画方向属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!