作者: 文章来源:
本文原地址:https://www.mimiwuqi.com/webqianduan/196539.html
目录文章目录animation-iteration-count属性主要用来定义动画的播放次数。
animation-iteration-count: infinite | <number> [, infinite | <number>]*
infinite,动画将会无限次的播放。通过animation-iteration-count属性让动画 move 只播放 5 次,代码设置为:
animation-iteration-count:5;
注意:Chrome 或 Safari 浏览器,需要加入-webkit-前缀!
让动画 move 无限次数的播放。
HTML 代码:
<div><span></span></div>
CSS 代码:
@keyframes move {
0%{
transform: translate(0);
}
15%{
transform: translate(100px,180px);
}
30%{
transform: translate(150px,0);
}
45%{
transform: translate(250px,180px);
}
60%{
transform:translate(300px,0);
}
75%{
transform: translate(450px,180px);
}
100%{
transfrom: translate(480px,0);
}
}
div {
width: 500px;
height: 200px;
border: 1px solid red;
margin: 20px auto;
}
div span {
display: inline-block;
width: 20px;
height: 20px;
background: green;
border-radius: 100%;
animation-name:move;
animation-duration: 10s;
animation-timing-function:ease;
animation-delay:.1s;
animation-iteration-count:infinite;
}
更多 建站教程 请访问 https://www.mimiwuqi.com/webqianduan/