CSS animation-direction

css animation-direction 定义和用法

animation-direction 属性定义是否循环交替反向播放动画。

注意:如果动画被设置为只播放一次,该属性将不起作用。

默认值: normal
继承:
可动画化: 否。请参阅 可动画化(animatable)
版本: CSS3
JavaScript 语法: object.style.animationDirection="reverse"尝试一下

 

css animation-direction 语法

animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;

 

css animation-direction 属性值

描述 测试
normal 默认值。动画按正常播放。 测试 »
reverse 动画反向播放。  
alternate 动画在奇数次(1、3、5...)正向播放,在偶数次(2、4、6...)反向播放。  
alternate-reverse 动画在奇数次(1、3、5...)反向播放,在偶数次(2、4、6...)正向播放。  
initial 设置该属性为它的默认值。请参阅 initial  
inherit 从父元素继承该属性。请参阅 inherit  

 

css animation-direction 浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10、Firefox 和 Opera 支持 animation-direction 属性。

Safari 和 Chrome 支持另一个可替代该属性的属性,即 -webkit-animation-direction 属性。

注意:Internet Explorer 9 及其之前的版本不支持 animation-direction 属性。

 

css animation-direction 实例

先执行一遍动画,然后再反向执行一遍动画:

animation-direction:alternate;
-webkit-animation-direction:alternate; /* Safari 和 Chrome */

在线运行

 

相关文章

CSS3 教程:CSS3 动画(Animations)