波纹扩散效果

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>
相关推荐
sunbyte2 小时前
Tailwind CSS 初学者入门指南:项目集成,主要变更内容!
前端·css
可爱的秋秋啊3 小时前
vue3,element ui框架中为el-table表格实现自动滚动,并实现表头汇总数据
前端·vue.js·笔记·elementui
一夜枫林3 小时前
uniapp自定义拖拽排列
前端·javascript·uni-app
IT瘾君5 小时前
JavaWeb:Html&Css
前端·html
264玫瑰资源库5 小时前
问道数码兽 怀旧剧情回合手游源码搭建教程(反查重优化版)
java·开发语言·前端·游戏
喝拿铁写前端5 小时前
从圣经Babel到现代编译器:没开玩笑,普通程序员也能写出自己的编译器!
前端·架构·前端框架
HED6 小时前
VUE项目发版后用户访问的仍然是旧页面?原因和解决方案都在这啦!
前端·vue.js
拉不动的猪6 小时前
前端自做埋点,我们应该要注意的几个问题
前端·javascript·面试
王景程6 小时前
如何测试短信接口
java·服务器·前端
安冬的码畜日常6 小时前
【AI 加持下的 Python 编程实战 2_10】DIY 拓展:从扫雷小游戏开发再探问题分解与 AI 代码调试能力(中)
开发语言·前端·人工智能·ai·扫雷游戏·ai辅助编程·辅助编程