语法项目 | 说明 |
---|---|
初始值 | normal |
适用于 | 所有元素 |
可否继承 | 否 |
媒介 | 视觉 |
版本 | CSS3.0 |
检索或设置对象动画循环播放次数大于1次时,动画是否反向运动。
如果提供多个属性值,以逗号进行分隔。
normal:正常方向。
reverse:动画反向运行,方向始终与normal相反。(FF14.0.1以下不支持)
alternate:动画会循环正反方向交替运动,奇数次(1、3、5……)会正常运动,偶数次(2、4、6……)会反向运动,即所有相关联的值都会反向。
alternate-reverse:动画从反向开始,再正反方向交替运动,运动方向始终与alternate定义的相反。(FF14.0.1以下不支持)
- .demo_box{
- -webkit-animation:f1 2s 0.5s 10 forwards linear;
- -moz-animation:f1 2s 0.5s 10 forwards linear;
- position:relative;
- left:10px;
- width:100px;
- height:100px;
- margin:10px 0;
- overflow:hidden;
- }
- .normal{
- -webkit-animation-direction:normal;
- -moz-animation-direction:normal;
- }
- .reverse{
- -webkit-animation-direction:reverse;
- -moz-animation-direction:reverse;
- }
- .alternate{
- -webkit-animation-direction:alternate;
- -moz-animation-direction:alternate;
- }
- .alternate-reverse{
- -webkit-animation-direction:alternate-reverse;
- -moz-animation-direction:alternate-reverse;
- }
- @-webkit-keyframes f1{
- 0%{left:10px;}
- 100%{left:500px;}
- }
- @-moz-keyframes f1{
- 0%{left:10px;}
- 100%{left:500px;}
- }
- <div class="demo_box normal">normal</div>
- <div class="demo_box reverse">reverse</div>
- <div class="demo_box alternate">alternate</div>
- <div class="demo_box alternate-reverse">alternate-reverse</div>
IE | Firefox | Opera | Safari | Chrome |
---|---|---|---|---|
IE 10+ | Firefox 3.5+ | 目前暂无版本支持 | Safari 10+ | Chrome 2.0+ |