波纹扩散效果

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>波纹扩散</title>
    <style>
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        background: rgba(32, 33, 47, 0.9);
      }

      .circle-container {
        position: relative;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        /* overflow: hidden; */
      }

      .circle {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        animation: rotate 6s linear infinite;
      }

      .circle-container > span {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 50%;
        border: 2px solid #00bfff; /* 设置边框颜色为蓝色 */
        z-index: -1;
        animation: ripple 2s linear infinite;
      }

      @keyframes rotate {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(360deg);
        }
      }
      @keyframes ripple {
        0% {
          transform: scale(1);
          opacity: 1;
        }
        100% {
          transform: scale(1.5);
          opacity: 0;
        }
      }
    </style>
  </head>
  <body>
    <div class="circle-container">
      <img class="circle" src="../assets/img/童话.jpg" alt="Circle Image" />
      <span class="ripple"></span>
      <span class="ripple"></span>
      <span class="ripple"></span>
    </div>
  </body>
  <script>
    const allRippleDom = document.querySelectorAll(".ripple");
    if (allRippleDom) {
      allRippleDom.forEach((item, index) => {
        item.style.animation = `ripple ${index + 1.5}s linear infinite`;
      });
    }
  </script>
</html>
相关推荐
洛小豆18 分钟前
Git 打标签完全指南:从本地创建到远端推送
前端·git·github
世间小小鱼26 分钟前
【爬坑指南】亚马逊文件中心 AWS S3 预签名URL 前端直传
前端·云计算·aws
华仔啊35 分钟前
前端登录token到底应该存在哪?LocalStorage、SessionStorage还是Cookie?一篇说透!
前端·javascript
BeefyBytes43 分钟前
动态组件库建设
前端
懒大王95271 小时前
uni-app + Vue3 开发展示 echarts 图表
前端·uni-app·echarts
yinuo1 小时前
Uni-App跨端实战:微信小程序WebView与H5通信全流程解析(01)
前端
xkroy1 小时前
ajax
前端·javascript·ajax
Yvonne爱编码2 小时前
AJAX入门-URL、参数查询、案例查询
前端·javascript·ajax
闲人编程2 小时前
前端形态与样式风格:从古典到现代的视觉语言演进
前端·css·状态模式·组件·js·风格·响应式
JudithHuang2 小时前
Mac版微信开发者工具登录二维码不显示问题解决方案
前端