网站底部的水波纹效果,结尾附带源代码

效果展示

wave

思路

同样的图片,当作背景,设置关键帧一直往右运动即可,延迟时间透明度和 bottom,速度也就是animation总持续时长微调可达到波纹效果

html + css

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="style.css">
  <title>WaterWaveAnimation</title>
</head>

<body>
  <section>
    <div class="wave wave1 "></div>
    <div class="wave wave2 "></div>
    <div class="wave wave3 "></div>
    <div class="wave wave4"></div>
  </section>
</body>

</html>

<style>
  * {
    margin: 0;
    padding: 0;
  }

  section {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #3586ff;
    overflow: hidden;
  }

  section .wave {
    width: 100%;
    height: 100px;
    position: absolute;
    bottom: 0;
    left: 0;
    background: url(wave.png);
    background-size: 1800px 100px;
  }

  section .wave.wave1 {
    animation: animate1 15s linear infinite;
    z-index: 1000;
    opacity: 1;
    animation-delay: 0s;
    bottom: 0;
  }

  section .wave.wave2 {
    animation: animate2 15s linear infinite;
    z-index: 999;
    opacity: 0.5;
    animation-delay: -3s;
    bottom: 20px;
  }

  section .wave.wave3 {
    animation: animate1 10s linear infinite;
    z-index: 998;
    opacity: 0.2;
    animation-delay: -7s;
    bottom: 30px;
  }

  section .wave.wave4 {
    animation: animate2 5s linear infinite;
    z-index: 997;
    opacity: 0.71;
    animation-delay: -5s;
    bottom: 25px;
  }

  @keyframes animate1 {
    0% {
      background-position-x: 0;
    }

    100% {
      background-position-x: 1800px;
    }
  }

  @keyframes animate2 {
    0% {
      background-position-x: 0;
    }

    100% {
      background-position-x: -1800px;
    }
  }
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值