Web速查-索引

Alt text

定义

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

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

语法

animation-direction: 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 设置该属性为它的默认值。
inherit 从父元素继承该属性。

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>鱼C-零基础入门学习Web(Html5+Css3)</title>
<style>
div
{
width:100px;
height:100px;
border-radius: 50%;
background:green;
position:relative;
animation:fishcMovie 6s infinite;
animation-direction:alternate;
/* Safari 和 Chrome */
-webkit-animation:fishcMovie 6s infinite;
-webkit-animation-direction:alternate;
}
@keyframes fishcMovie
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:red; left:0px; top:200px;}
100% {background:green; left:0px; top:0px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>







浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号

Safari Chrome FireFox IE
4.0 4.0 4.0 10.0