CSS3 animation 屬性
實例
使用簡寫屬性,將動畫與 div 元素綁定:
div
{
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /* Safari 和 Chrome */
}
瀏覽器支持
Internet Explorer 10、Firefox 以及 Opera 支持 animation 屬性。
Safari 和 Chrome 支持替代的 -webkit-animation 屬性。
注釋:Internet Explorer 9 以及更早的版本不支持 animation 屬性。
定義和用法
animation 屬性是一個簡寫屬性,用于設(shè)置六個動畫屬性:
- animation-name
- animation-duration
- animation-timing-function
- animation-delay
- animation-iteration-count
- animation-direction
注釋:請始終規(guī)定 animation-duration 屬性,否則時長為 0,就不會播放動畫了。
默認(rèn)值: | none 0 ease 0 1 normal |
---|---|
繼承性: | no |
版本: | CSS3 |
JavaScript 語法: | object.style.animation="mymove 5s infinite" |
語法
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ān)頁面
CSS3 教程:CSS3 動畫