纯CSS3手写 管道流水动效

<!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>

效果如下:
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值