animation

英[??n??me??n]? ?美[??n??me??n]??

n.生氣,活潑;卡通製作,卡通攝製;[影視]卡通片

複數: animations

duration

英[dju?re??n]? ?美[du?re??n]??

n.持續(xù),持續(xù)的時間,期間期間;(時間的)持續(xù),持久,連續(xù);[語音學]音長,音延

複數: durations

CSS 動畫持續(xù)時間屬性 語法

animation-duration屬性怎麼用?

animation-duration屬性是用來定義動畫完成一個週期所需的時間,以秒或毫秒計;基本語法為animation-duration: time。

作用:animation-duration 屬性定義動畫完成一個週期所需的時間,以秒或毫秒計。

語法:animation-duration: time

#說明:time ? ?規(guī)定完成動畫所花費的時間。預設值是 0,意味著沒有動畫效果。? ??

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

CSS 動畫持續(xù)時間屬性 範例

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove infinite;
animation-duration:2s;

/* Safari and Chrome */
-webkit-animation:mymove infinite;
-webkit-animation-duration:2s;
}

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

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

<p><strong>注釋:</strong>Internet Explorer 9 以及更早的版本不支持 animation-name 屬性。</p>

<div></div>

<p><b>注釋:</b>始終規(guī)定 animation-duration 屬性,否則時長為 0,就不會播放動畫了。</p>

</body>
</html>

執(zhí)行實例 ?

點擊 "執(zhí)行實例" 按鈕查看線上實例