<!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>管道流水css3</title>
<style type="text/css">
.example {
position: relative;
width: 500px;
height: 40px;
border: 5px solid #bbb;
display: flex;
overflow: hidden;
border-radius: 10px;
}
.example div{
position: absolute;
bottom: 0;
left: 0;
background-color: rgb(115, 159, 224);
border-radius: 50%;
height: 100%;
}
.example div:nth-child(1){
border-radius: 0;
border-top-right-radius: 80%;
}
.example div:nth-child(2){
left: 100px;
}
.example div:nth-child(3){
left: 200px;
}
.example div:nth-child(4){
left: 300px;
}
.example div:nth-child(5){
left: 400px;
}
/* animation: name duration timing-function delay iteration-count direction fill-mode; */
/* animation: 动画名 耗时 速度 延时 次数(infinite) 循环方向 等待或结束时的状态; */
.example div:nth-child(2),.example div:nth-child(4),.example div:nth-child(6){
animation: flow .8s linear infinite alternate;
}
.example div:nth-child(1),.example div:nth-child(3),.example div:nth-child(5){
animation: flow1 1s linear infinite alternate;
}
@keyframes flow {
from {
width:100px
}
to {
width:300px
}
}
@keyframes flow1 {
from {
width:300px
}
to {
width:100px
}
}
.example .bg{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 50%;
background-color: rgb(115, 159, 224);
border-radius: 0;
}
</style>
</head>
<body>
<div class="example">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="bg"></div>
</div>
</body>
</html>
效果如下: