1费彼、要想用css 完成一個動畫,那么先來聲明一個動畫:
/*
* 要支持不同的瀏覽器請在 @keyframes / animation 前面添加前綴
* Safari 與 Chrome: -webkit-
* 火狐:-moz-
*/
@keyframes 動畫名 {
從{css 樣式 ( 可以寫多個樣式 ) }
到{css 樣式}
}
// 例
@keyframes customAnimation {
from {width: 100px;}
to {width: 200px}
}
2箍铲、開始使用動畫
div {
//
animation-name: customAnimation; // 該div 綁定的要執(zhí)行的動畫名
animation-duration: 2s; // 動畫執(zhí)行時長
animation-timing-function: ease; // 動畫的執(zhí)行速度
animation-delay: 2s; // 多長時間后開始執(zhí)行動畫
animation-iteration-count: 3; // 動畫的播放次數(shù)
animation-direction: alternate; // 反向動畫
animation-play-state: paused; //動畫是暫停 或播放
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者