波纹扩散效果

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>
相关推荐
永不停歇的蜗牛13 分钟前
Maven的POM文件相关标签作用
服务器·前端·maven
芳草萋萋鹦鹉洲哦30 分钟前
【vue/js】文字超长悬停显示的几种方式
前端·javascript·vue.js
HIT_Weston1 小时前
47、【Ubuntu】【Gitlab】拉出内网 Web 服务:Nginx 事件驱动分析(一)
前端·ubuntu·gitlab
开发者小天1 小时前
React中的 闭包陷阱
前端·javascript·react.js
翔云 OCR API1 小时前
承兑汇票识别接口技术解析-开发者接口
开发语言·前端·数据库·人工智能·ocr
涔溪1 小时前
Vue3 的核心语法
前端·vue.js·typescript
G***E3162 小时前
前端在移动端中的React Native Web
前端·react native·react.js
云烟飘渺o2 小时前
JPA 的脏检查:一次“没 save() 却更新了”的排查记录
前端
Neptune12 小时前
深入浅出:理解js的‘万物皆对象’与原型链
前端·javascript
王霸天2 小时前
扒一扒 Vue3 大屏适配插件 vfit 的源码:原来这么简单?
前端