波纹扩散效果

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>
相关推荐
Uyker1 小时前
从零开始制作小程序简单概述
前端·微信小程序·小程序
EndingCoder5 小时前
React从基础入门到高级实战:React 实战项目 - 项目三:实时聊天应用
前端·react.js·架构·前端框架
阿阳微客6 小时前
Steam 搬砖项目深度拆解:从抵触到真香的转型之路
前端·笔记·学习·游戏
德育处主任Pro7 小时前
『React』Fragment的用法及简写形式
前端·javascript·react.js
CodeBlossom7 小时前
javaweb -html -CSS
前端·javascript·html
打小就很皮...7 小时前
HBuilder 发行Android(apk包)全流程指南
前端·javascript·微信小程序
集成显卡8 小时前
PlayWright | 初识微软出品的 WEB 应用自动化测试框架
前端·chrome·测试工具·microsoft·自动化·edge浏览器
前端小趴菜059 小时前
React - 组件通信
前端·react.js·前端框架
Amy_cx10 小时前
在表单输入框按回车页面刷新的问题
前端·elementui
dancing99910 小时前
cocos3.X的oops框架oops-plugin-excel-to-json改进兼容多表单导出功能
前端·javascript·typescript·游戏程序