首頁  >  文章  >  web前端  >  animation-iteration-count屬性怎麼用

animation-iteration-count屬性怎麼用

青灯夜游
青灯夜游原創
2019-01-31 11:25:164486瀏覽

animation-iteration-count屬性是用來定義動畫播放次數的,設定animation-iteration-count屬性的值為infinite,就可實現動畫的無限循環播放。

animation-iteration-count屬性怎麼用

CSS3 animation-iteration-count屬性

作用:animation- iteration-count 屬性定義動畫的播放次數。

語法:

animation-iteration-count: n|infinite;

n:定義動畫播放次數的數值。

infinite:規定動畫應該無限次播放。    

附註:Internet Explorer 9 以及更早的版本不支援 animation-iteration-count 屬性。

CSS3 animation-iteration-count屬性的使用範例

設定動畫迴圈3次

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 3s;
animation-iteration-count:3;

/* Safari and Chrome */
-webkit-animation:mymove 3s;
-webkit-animation-iteration-count:3;
}

@keyframes mymove
{
from {top:0px;}
to {top:200px;}
}

@-webkit-keyframes mymove /* Safari and Chrome */
{
from {top:0px;}
to {top:200px;}
}
</style>
</head>
<body>

<div></div>

</body>
</html>

效果圖:

animation-iteration-count屬性怎麼用

#以上就是這篇文章的全部內容,希望能對大家的學習有所幫助。更多精彩內容大家可以追蹤php中文網相關教學欄位! ! !

以上是animation-iteration-count屬性怎麼用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn