<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>动画</title>
<link rel="stylesheet" href="css/trans.css">
</head>
<body>
<div class="box">
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>
</div>
</body>
</html>
*{
padding: 0;
margin: 0;
}
.box{
margin: 50px auto;
width: 500px;
height: 150px;
border: 2px solid;
position: relative;
}
.box1{
width: 50px;
height: 60px;
background-color: rgb(0,0,0);
position: absolute;
left: 50px;
top: 40px;
animation: ssing 1s ease 0s infinite;
border-radius: 10px;
}
.box2{
width: 50px;
height: 60px;
background-color: rgb(255,0,0);
position: absolute;
left: 140px;
top:40px;
animation: ssing 1s ease 0.2s infinite;
border-radius: 10px;
}
.box3{
width: 50px;
height: 60px;
background-color: rgb(0,255,0);
position: absolute;
left: 230px;
top:40px;
animation: ssing 1s ease 0.4s infinite;
border-radius: 10px;
}
.box4{
width: 50px;
height: 60px;
background-color: rgb(0,0,255);
position: absolute;
left: 320px;
top:40px;
animation: ssing 1s ease 0.6s infinite;
border-radius: 10px;
}
.box5{
width: 50px;
height: 60px;
background-color: rgb(168,168,0);
position: absolute;
left: 410px;
top:40px;
animation: ssing 1s ease 0.8s infinite;
border-radius: 10px;
}
@keyframes ssing{
0%{
transform: scaleY(1);
}
50%{
transform: scaleY(0.5);
}
100%{
transform: scaleY(1);
}
}