CSS動畫效果

來源:互聯網
上載者:User

標籤:

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動畫效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.