CSS3 animation、transform
阿新 • • 發佈:2018-12-12
1、animation 動畫
舉例:
animation: test 1s ease 2s infinite ;
第一個引數是 動畫的名字這裡命名為test,與 @keyframes 搭配使用
第二個引數是 動畫的持續時間
第三個引數是 動畫的過渡型別 這裡的ease是平滑過渡
第四個引數是 動畫的延遲時間
第五個引數是 動畫的迴圈次數 這裡表示無限迴圈
還可以設定第六個引數 表示是否反向運動
@keyframes test {
0%{
width: 100px;
}
50% {
width: 600px;
}
100%{
width: 100px;
}
}
@keyframes test {
from
等效於 0%.
to
等效於 100%.
}
2、transform 變換
當想讓div變形狀時(可以是2d的,也可以是3d的),就可以用這個屬性。
比如,
transform: translate(10px,10px);----你想讓這個div向右平移10畫素,向下也平移10畫素,
transform: rotate(90deg);-----你想讓這個div旋轉一下,預設會按照幾何中心順時針旋轉
常用引數: