当前阅读教程:CSS3教程 > animation-direction 属性 | |||||||||||||||||||||||||
阅读(22555525) 收藏 赞(5685) 分享 | |||||||||||||||||||||||||
上一篇: animation-iteration-count 属性 | 下一篇: animation-play-state 属性 | ||||||||||||||||||||||||
浏览器支持表格中的数字表示支持该属性的第一个浏览器版本号。 紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。 定义和用法animation-direction 属性定义是否循环交替反向播放动画。 注意:如果动画被设置为只播放一次,该属性将不起作用。
CSS 语法animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit; 属性值
实例先执行一遍动画,然后再反向执行一遍动画 <!doctype html> <html> <head> <meta charset="utf-8"> <title>animation-direction 属性</title> <!--定义内部样式--> <style> div { width:100px; height:100px; background:red; position:relative; animation:myfirst 5s infinite; animation-direction:alternate;/*先执行一遍动画,然后再反向执行一遍动画*/ /* Safari 和 Chrome */ -webkit-animation:myfirst 5s infinite; -webkit-animation-direction:alternate; } @keyframes myfirst { 0% {background:red; left:0px; top:0px;} 25% {background:yellow; left:200px; top:0px;} 50% {background:blue; left:200px; top:200px;} 75% {background:green; left:0px; top:200px;} 100% {background:red; left:0px; top:0px;} } @-webkit-keyframes myfirst /* Safari 和 Chrome */ { 0% {background:red; left:0px; top:0px;} 25% {background:yellow; left:200px; top:0px;} 50% {background:blue; left:200px; top:200px;} 75% {background:green; left:0px; top:200px;} 100% {background:red; left:0px; top:0px;} } </style> </head> <body> <p><strong>注意:</strong>Internet Explorer 9 及其之前的版本不支持 animation-direction 属性。</p> <div></div> </body> </html> |
|||||||||||||||||||||||||
上一篇: animation-iteration-count 属性 | 下一篇: animation-play-state 属性 |