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

n.生氣,活潑;動(dòng)畫(huà)片制作,動(dòng)畫(huà)片攝制;[影視]動(dòng)畫(huà)片

復(fù)數(shù): animations

css animation屬性 語(yǔ)法

animation屬性怎么用?

animation屬性是一個(gè)簡(jiǎn)寫(xiě)屬性,用于設(shè)置六個(gè)動(dòng)畫(huà)屬性,基本語(yǔ)法為:animation: name duration timing-function delay iteration-count direction;

作用:animation 屬性是一個(gè)簡(jiǎn)寫(xiě)屬性,用于設(shè)置六個(gè)動(dòng)畫(huà)屬性。

語(yǔ)法:animation: name duration timing-function delay iteration-count direction;

說(shuō)明:animation-name ? ?規(guī)定需要綁定到選擇器的 keyframe名稱。? ? ?animation-duration ? ?規(guī)定完成動(dòng)畫(huà)所花費(fèi)的時(shí)間,以秒或毫秒計(jì)。? ? animation-timing-function ? ?規(guī)定動(dòng)畫(huà)的速度曲線。? ? animation-delay ? ?規(guī)定在動(dòng)畫(huà)開(kāi)始之前的延遲。? ? animation-iteration-count ? ?規(guī)定動(dòng)畫(huà)應(yīng)該播放的次數(shù)。? ? animation-direction ? ?規(guī)定是否應(yīng)該輪流反向播放動(dòng)畫(huà)。? ??

注釋:請(qǐng)始終規(guī)定 animation-duration 屬性,否則時(shí)長(zhǎng)為 0,就不會(huì)播放動(dòng)畫(huà)了。

css animation屬性 示例

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /*Safari and Chrome*/
}

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

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

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

<div></div>

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例