CSS实现水波纹效果示例

CSS实现水波纹效果
记录如下以供以后使用

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

<!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>
     <style>
      .app {
        width: 100%;
        height: 800px;
        background-color: #262c50;
        position: relative;
        overflow: hidden;
      
     }
      .china-map{width:1000px;height:620px;background:url('./map_black_bg.png') center no-repeat;position:relative;margin: 0 auto;}
      .region-list{position:relative;left:0;top:0}
    
      @-webkit-keyframes warn{
      0%{-webkit-transform:scale(0);transform:scale(0);opacity:1}
      100%{-webkit-transform:scale(1);transform:scale(1);opacity:0}
      }
      @-moz-keyframes warn{
      0%{-moz-transform:scale(0);transform:scale(0);opacity:1}
      100%{-moz-transform:scale(1);transform:scale(1);opacity:0}
      }
      @-o-keyframes warn{
      0%{-o-transform:scale(0);transform:scale(0);opacity:1}
      100%{-o-transform:scale(1);transform:scale(1);opacity:0}
      }
      @keyframes warn{
      0%{-webkit-transform:scale(0);-moz-transform:scale(0);-o-transform:scale(0);transform:scale(0);opacity:1}
      100%{-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);transform:scale(1);opacity:0}
      }
      .area-box .dot{position:absolute;left:0;width:10px;height:10px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:#a2a9b4;opacity:1;filter:alpha(opacity=100)}
      .area-box .pulse{position:absolute;top:-28px;left:-28px;height:66px;width:66px;border:2px solid #b7b7b7;-webkit-border-radius:48px;-moz-border-radius:48px;border-radius:48px;-webkit-box-shadow:0 0 4px #82878f,0 0 10px #82878f inset;-moz-box-shadow:0 0 4px #82878f,0 0 10px #82878f inset;box-shadow:0 0 4px #82878f,0 0 10px #82878f inset;opacity:.12;filter:alpha(opacity=0);-webkit-animation:warn 2s ease-out both;-moz-animation:warn 2s ease-out both;-o-animation:warn 2s ease-out both;animation:warn 2s ease-out both;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-o-animation-iteration-count:infinite;animation-iteration-count:infinite;background:0 0}
      .area-box .delay-01{-webkit-animation-delay:0;-moz-animation-delay:0;-o-animation-delay:0;animation-delay:0}
      .area-box .delay-02{-webkit-animation-delay:.4s;-moz-animation-delay:.4s;-o-animation-delay:.4s;animation-delay:.4s}
      .area-box .delay-03{-webkit-animation-delay:.8s;-moz-animation-delay:.8s;-o-animation-delay:.8s;animation-delay:.8s}
      .area-box .delay-04{-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s;-o-animation-delay:1.2s;animation-delay:1.2s}
      .area-box .delay-05{-webkit-animation-delay:1.6s;-moz-animation-delay:1.6s;-o-animation-delay:1.6s;animation-delay:1.6s}
      .area-box .delay-06{-webkit-animation-delay:2s;-moz-animation-delay:2s;-o-animation-delay:2s;animation-delay:2s}
      .area-box .delay-07{-webkit-animation-delay:2.4s;-moz-animation-delay:2.4s;-o-animation-delay:2.4s;animation-delay:2.4s}
      .area-box .delay-08{-webkit-animation-delay:-.4s;-moz-animation-delay:-.4s;-o-animation-delay:-.4s;animation-delay:-.4s}
      .area-box .delay-09{-webkit-animation-delay:-.8s;-moz-animation-delay:-.8s;-o-animation-delay:-.8s;animation-delay:-.8s}
      .area-box .delay-10{-webkit-animation-delay:-1.2s;-moz-animation-delay:-1.2s;-o-animation-delay:-1.2s;animation-delay:-1.2s}
      .area-box .delay-11{-webkit-animation-delay:4s;-moz-animation-delay:4s;-o-animation-delay:4s;animation-delay:4s}
      .region-list.active .area-box .dot{background:#009fd9}
      .region-list.active .area-box .pulse{border-color:#009fd9;top:-41px;left:-41px;height:88px;width:88px;-webkit-box-shadow:0 0 12px #0080d9,0 0 20px #0080d9 inset;-moz-box-shadow:0 0 12px #0080d9,0 0 20px #0080d9 inset;box-shadow:0 0 12px #0080d9,0 0 20px #0080d9 inset}
      .region-list.waite .area-box .dot{background:#f90}
      .region-list.waite .area-box .pulse{border-color:#f90;top:-41px;left:-41px;height:88px;width:88px;-webkit-box-shadow:0 0 12px #f90,0 0 20px #f90 inset;-moz-box-shadow:0 0 12px #f90,0 0 20px #f90 inset;box-shadow:0 0 12px #f90,0 0 20px #f90 inset}
      .show-regin{position:absolute;left:2px;height:0;top:0;width:11px;opacity:0;-o-transition:all .5s ease-in-out;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;transition:all .5s ease-in-out}
      .online-node .show-regin,.region-list:hover .show-regin,.underline-node .show-regin,.waite-node .show-regin{height:127px;opacity:1}
      .show-regin span{width:80px;position:absolute;left:8px;top:-11px;padding:6px 10px;font-size:14px;color:#ccc;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;text-align:center;white-space:nowrap;}
      .postition-10 .show-regin span{left:0}
      .postition-6 .show-regin span{left:-72px}
      .area-box{z-index:77}
      .show-regin{z-index:66}
      .region-list.active .show-regin span{position:relative;color:#ccc}
      .region-list.waite .show-regin span{position:relative;color:#ccc}
      .postition-4{left:68%;top:38%}
      .postition-4.region-list.active .area-box .pulse{top:-50px;left:-50px;width:110px;height:110px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}
      .postition-7.region-list.active .area-box .pulse{top:-50px;left:-50px;width:110px;height:110px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}
      .postition-8{left:66%;top:84%}
      .postition-9{left:77%;top:61%}
      .postition-11{left:70%;top:48%}
      .solution-header-1 {
          max-width: 1210px;
          margin-left: auto;
          margin-right: auto;
          text-align: center;
      }
      .solution-header-1 h2 {
          margin-bottom: 10px;
          font-size: 36px;
          line-height: 46px;
          text-align: center;
          color: #FAFBFE;
          font-weight: inherit;
      }
      .solution-header-1 p {
          font-size: 18px;
          line-height: 22px;
          text-align: center;
          color: #FFFFFF;
          opacity: 0.6;
      }
     
      @-webkit-keyframes bgScroll {
          from {
              -webkit-transform: translateY(0);
              transform: translateY(0)
          }
      
          to {
              -webkit-transform: translateY(-33.333%);
              transform: translateY(-33.333%)
          }
      }
      @keyframes bgScroll {
          from {
              -webkit-transform: translateY(0);
              transform: translateY(0)
          }
          to {
              -webkit-transform: translateY(-33.333%);
              transform: translateY(-33.333%)
          }
      }
      </style> 
</head>
<body>
  <div class="app">

        <div class="solution-header-1" >
          <h2>纯CSS实现水波纹效果</h2>
            <p>纯CSS实现水波纹效果</p>
        </div>
   

      <div style="text-align: center">
        <div class="china-map">
          <div class="region-list waite postition-4 waite-node">
            <div class="area-box">
              <span class="dot"></span>
              <span class="pulse delay-01"></span>
              <span class="pulse delay-02"></span>
              <span class="pulse delay-03"></span>
            </div>
            <div class="show-regin">
              <span>北京</span>
            </div>
          </div>
          <div class="region-list  active  postition-11 online-node">
            <div class="area-box">
              <span class="dot"></span>
              <span class="pulse delay-06"></span>
              <span class="pulse delay-05"></span>
              <span class="pulse delay-04"></span>
            </div>
            <div class="show-regin">
              <span>山东</span>
            </div>
          </div>
          <div class="region-list active postition-8 online-node">
            <div class="area-box">
              <span class="dot"></span>
              <span class="pulse delay-06"></span>
              <span class="pulse delay-05"></span>
              <span class="pulse delay-04"></span>
            </div>
            <div class="show-regin">
              <span>广州</span>
            </div>
          </div>
          <div class="region-list active postition-9 online-node">
            <div class="area-box">
              <span class="dot"></span>
              <span class="pulse delay-06"></span>
              <span class="pulse delay-05"></span>
              <span class="pulse delay-04"></span>
            </div>
            <div class="show-regin">
              <span>上海</span>
            </div>
          </div>
        </div>
      </div>
  </div>

</body>
</html>

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

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>水波纹效果</title>
        <style>
            * {
                margin: 0;
                padding: 0;
            }           
            html,
            body {
                height: 100%;
                overflow: hidden;
            }           
            @-webkit-keyframes wateranimate {
                0% {
                    -webkit-transform: scale(0);
                    opacity: 0.5;
                }
                100% {
                    -webkit-transform: scale(2);
                    opacity: 0;
                }
            }
            @keyframes wateranimate {
                0% {
                    -webkit-transform: scale(0);
                    transform: scale(0);
                    opacity: 0.5;
                }
                100% {
                    -webkit-transform: scale(2);
                    transform: scale(2);
                    opacity: 0;
                }
            }           
            .container {
                position: relative;
                width: 500px;
                height: 500px;
                margin: 50px auto;
                border: 1px solid yellow;
            }           
            .water1 {
                -webkit-animation: wateranimate 12s 9s ease-out infinite;
                animation: wateranimate 12s 9s ease-out infinite;
            }           
            .water2 {
                -webkit-animation: wateranimate 12s 6s ease-out infinite;
                animation: wateranimate 12s 6s ease-out infinite;
            }           
            .water3 {
                -webkit-animation: wateranimate 12s 3s ease-out infinite;
                animation: wateranimate 12s 3s ease-out infinite;
            }           
            .water4 {
                -webkit-animation: wateranimate 12s 0s ease-out infinite;
                animation: wateranimate 12s 0s ease-out infinite;
            }           
            .water1, .water2, .water3, .water4 {
                padding: 20%;
                position: absolute;
                left: 30%;
                top: 30%;
                border: 1px solid pink;
                box-shadow: 0 0 120px 30px rgba(235, 31, 137, 1) inset;
                border-radius: 100%;
                z-index: 1;
                opacity: 0;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="water1"></div>
            <div class="water2"></div>
            <div class="water3"></div>
            <div class="water4"></div>
        </div>
    </body>
</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值