-webkit-animation的使用

來源:互聯網
上載者:User

標籤:style   io   color   ar   使用   for   sp   div   on   

-webkit-animation: name duration timing-function delay iteration_count direction;

(name duration timing-function delay iteration-count direction play-state)myfirst 5s linear 2s infinite alernate running

包括以下幾個屬性

(1)  -webkit-animation-name    這個屬性的使用必須結合@-webkit-keyframes一起使用

eg:  @-webkit-keyframes fontchange{

0%{font-size:10px;}

30%{font-size:15px;}

100%{font-siez:12px;}

}

百分比的意思就是duration的百分比,如果沒有設定duration的話,則表示為無窮大

div{ -webkit-animation-name:fontchange;}

(2)-webkit-animation-duration   表示動畫持續的時間

(3)-webkit-animation-timing-function  表示動畫使用的時間曲線

【文法】: -webkit-animation-timing-function: ease | linear | ease-in | ease-out | ease-in-out

(4)-webkit-animation-delay    表示開始動畫之前的延時

【文法】 -webkit-animation-delay: delay_time;

(5)-webkit-animation-iteration-count  表示動畫要重複幾次

【文法】-webkit-animation-iteration-count: times_number;

(6) -webkit-animation-direction   表示動畫的方向

【文法】-webkit-animation-direction: normal(預設)  | alternate

normal  方向始終向前

alternate 當重複次數為偶數時方向向前,奇數時方向相反

【另外】跟animation有關的其他屬性

(1)-webkit-animation-fill-mode : none (預設)| backwards | forwards | both  設定動畫開始之前和結束之後的行為(測試結

果不是很清晰)

(2)-webkit-animation-play-state: running(預設) | paused  設定動畫的運行狀態

綜合案例:

@-webkit-keyframes fontbulger {
0% {
font-size: 10px;
}
30% {
font-size: 15px;
}
100% {
font-size: 12px;
}
}

#box {
-webkit-animation-name:  fontbulger;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count:3;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
-webkit-animation-fill-mode: both;
-webkit-animation-delay: 2s;
}

<div id=”box”>文字變化</div>

-webkit-animation的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.