咨询热线:15811653920

2009-2017

我们一直走在国际设计的前沿,追求与研究从未停止

我的位置:首页 > 学院 > 建站知识

【CSS3教程】之animation的animation-direction属性

反向或交替运行动画

animation-direction 属性指定是向前播放、向后播放还是交替播放动画。


animation-direction 属性可接受以下值:

normal - 动画正常播放(向前)。默认值

reverse - 动画以反方向播放(向后)

alternate - 动画先向前播放,然后向后

alternate-reverse - 动画先向后播放,然后向前

下例将以相反的方向(向后)运行动画:


实例

div {

  width: 100px;

  height: 100px;

  position: relative;

  background-color: red;

  animation-name: example;

  animation-duration: 4s;

  animation-direction: reverse;

}

亲自试一试

下面的例子使用值 "alternate" 使动画先向前运行,然后向后运行:


实例

div {

  width: 100px;

  height: 100px;

  position: relative;

  background-color: red;

  animation-name: example;

  animation-duration: 4s;

  animation-iteration-count: 2;

  animation-direction: alternate;

}


下面的例子使用值 "alternate-reverse" 使动画先向后运行,然后向前运行:

实例

div {

  width: 100px;

  height: 100px;

  position: relative;

  background-color: red;

  animation-name: example;

  animation-duration: 4s;

  animation-iteration-count: 2;

  animation-direction: alternate-reverse;

}

想了解更多,请访问齐创互联,需要网站建设,浏览快速建站模板快速建站
点击在线客服联系客服,联系电话:15811653920 联系人: 丁生.


感谢您关注我们,如果您有建站需求,请与我们取得联系。
扫一扫上面的二维码图案,加我微信
扫一扫上面的二维码图案,加我微信
咨询直线:15811653920 丁生

建站模板

Web Templates

建站龙头,低价保证,贴心服务

权威认证建站龙头企业,合理定价,实现与客户的长期合作,30万家企业级用户优选!