animation
animation:动画名 运动时间 持续次数 运动曲线 延迟 ;
a
animation-timing-function
配置动画的时间;也就是说,通过建立加速曲线,动画如何在关键帧之间过渡。
animation-delay
配置元素加载时间与动画序列开始之间的延迟。
animation-play-state
使您可以暂停和恢复动画序列。
盒子运行一周案例代码
<!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>Document</title>
<link rel="stylesheet" href="./base.css">
<style>
.w{
width: 200px;
height: 200px;
background: red;
animation: dh 5s infinite;
margin: 0 auto;
}
@keyframes dh{
0%{
transform: translate(0,0);
}
25%{
transform: translate(100px ,0);
}
50%{
transform: translate(100px ,200px);
}
75%{
transform: translate(0 ,200px);
}
100%{
transform: translate( 0 ,0);
}
}
</style>
</head>
<body>
<div class="w">
</div>
</body>
</html>
热点代码
在这里插入代码片
<!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>Document</title>
<link rel="stylesheet" href="./base.css">
<style>
.w {
width: 800px;
height: 500px;
margin: 0 auto;
background: #666;
}
.w ul {
width: 300px;
height: 200px;
position: relative;
top: 200px;
left: 50%;
transform: translate(-50% ,0);
}
.w ul li {
width: 16px;
height: 16px;
position: absolute;
background-color: red;
border-radius: 50%;
box-shadow: yellow 0 0 10px 0;
}
.w ul li:first-child {
z-index: 999;
width: 10px;
height: 10px;
top: 4px;
left: 4px;
}
.w ul li:nth-child(n+2){
background: #666;
border: 1px solid yellow;
animation: rd .6s infinite;
}
.w ul li:nth-child(2){
animation-delay: .1s;
}
.w ul li:nth-child(2){
animation-delay: .2s;
}
.w ul li:nth-child(2){
animation-delay: .3s;
}
@keyframes rd{
0%{
transform: scale(1);
opacity: 0.8;
}
25%{
transform: scale(1.5);
opacity: 0.8;
}
50%{
transform: scale(2);
opacity: 0.6;
}
75%{
transform: scale(2.5);
opacity: 0.2;
}
100%{
transform: scale(3);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="w ">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>