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

n.生氣,活潑;動畫片制作,動畫片攝制;[影視]動畫片

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

css animation屬性 語法

animation屬性怎么用?

animation屬性是一個簡寫屬性,用于設(shè)置六個動畫屬性,基本語法為:animation: name duration timing-function delay iteration-count direction;

作用:animation 屬性是一個簡寫屬性,用于設(shè)置六個動畫屬性。

語法:animation: name duration timing-function delay iteration-count direction;

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

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

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í)例