標籤:
animation-name 動畫名稱 none | <identifier>
例:div{ -webkit-animation-name : FromLeftToRight; animation-name : FromLeftToRight;}
keyframes 主要畫面格 @keyframes <identifier> { [ from | to | <percentage> ]{ sRules } ] [,*]}
說明:被稱為主要畫面格,其類似於Flash中的主要畫面格。在CSS3中其主要以“@keyframes”開頭,後面緊跟著是動畫名稱加上一對花括弧“{…}”,括弧中就是一些不同時間段樣式規則。
例:@-webkit-keyframes FromLeftToRight{ 0%{left: 0; } 100%{ left: 800px; }}
animation-duration 動畫時間 <time>
說明:設定對象動畫的期間
例:div{ -webkit-animation-duration:1s; animation-duration:1s}
animation-timing-function 動畫的過渡速度 ease | linear | ease-in | ease-out | ease-in-out
說明:設定對象動畫的過渡速度類型
例:div{ -webkit-animation-timing-function : ease-in; animation-timing-function : ease-in;}
animation-delay 動畫延遲時間 <time>
說明:設定對象動畫的延遲時間
例:div{ -webkit-animation-delay : 1s; animation-delay : ease-in;}
animation-iteration-count 動畫執行次數 infinite | <number>
說明:設定對象動畫的延遲時間
infinite表示無限次數
例:div{ -webkit-animation-iteration-count : 2; animation-iteration-count : 2;}
animation-direction 動畫的順序 normal | reverse | alternate | alternate-reverse
說明:設定對象動畫在迴圈中是否按照相反順序執行
normal:正常方向
reverse:反方向運行
alternate:動畫先正常運行再反方向運行,並持續交替運行
alternate-reverse:動畫先反運行再正方向運行,並持續交替運行
例:div{ -webkit-animation-direction : normal; animation-direction : normal;}
animation-play-state 動畫的狀態 running | paused
說明:設定對象動畫的狀態
running:運動
paused:暫停
例:div:hover{ -webkit-animation-play-state:paused; animation-play-state:paused;}
animation-fill-mode 動畫時間之外的狀態 none | forwards | backwards | both
說明:設定對象動畫時間之外的狀態
none:預設值。不設定對象動畫之外的狀態
forwards:設定對象狀態為動畫結束時的狀態
backwards:設定對象狀態為動畫開始時的狀態
both:設定對象狀態為動畫結束或開始的狀態
例:div { -webkit-animation-fill-mode : both; animation-fill-mode : both;}
animation 動畫複合屬性 [ animation-name ] || [ animation-duration ] || [ animation-timing-function ] || [ animation-delay ] || [animation-iteration-count ] || [ animation-direction ] || <single-animation-fill-mode> || <single-animation-play-state> [ ,*]
說明:通過 animation ,我們能夠建立自訂動畫,這可以在許多網頁中取代動畫圖片gif、Flash 動畫以及 JavaScript。
例:div{ -webkit-animation: FromLeftToRight 2s ease-out forwards; animation: FromLeftToRight 2s ease-out forwards; }
CSS動畫效果