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

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

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

css3 animation屬性 語法

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

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

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

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

css3 animation屬性是一個簡寫屬性,通過設(shè)置六個動畫屬性來實現(xiàn)動畫效果。這六個屬性分別為動畫名稱、動畫時間、速度曲線、動畫延遲、播放次數(shù)及動畫是否反向播放。

css3 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>

運行實例 ?

點擊 "運行實例" 按鈕查看在線實例