-
作用
-
关键帧
-
动画
- animation–name
- animation–duration
- animation–delay
- animation–timing–function
- animation–iteration–count
- animation–direction:alternate
- animation–play–state
- animation–fill–mode
-
第三方动画库
- eg
- 现在第三方类库可以帮助我们快速实现一些复杂动画
样例一
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>吃豆人</title>
<style>
/* 定义动画 */
@keyframes bean_roll1{
/* from{transform: rotate(0);}
to{transform: rotate(45deg);} */
0% {transform: rotate(0);}
50% {transform: rotate(45deg);}
100% {transform: rotate(0);}
}
@keyframes bean_roll2{
/* from{transform: rotate(0);}
to{transform: rotate(-45deg);} */
0% {transform: rotate(0);}
50% {transform: rotate(-45deg);}
100% {transform: rotate(0);}
}
@keyframes dou_move{
0% {left:200px;opacity: 1;}
50% {left: 80px;opacity: 1;}
50.1% {left: 80px;opacity: 0;}
100% {left: 80px;opacity: 0;}
}
.bean{
width: 200px;
height: 200px;
background-color: #222;
position: relative;
}
.bean .cdr{
width: 0;
height: 0;
border: 50px solid gold;
border-right-color:transparent ;
border-radius: 50%;
position: absolute;
left: 30px;
top: 50px;
}
.cdr:nth-of-type(1){
/* animation:动画名称 动画执行时间【延迟时间 infinite(无数次)*/
animation: bean_roll1 2s linear infinite /*alternate*/;
}
.cdr:nth-of-type(2){
/* animation:动画名称 动画执行时间【延迟时间 infinite(无数次)*/
animation: bean_roll2 2s linear infinite /*alternate*/;
}
.eye{
width: 16px;