CSS水波纹效果

效果图:

1.创建一个div

javascript 复制代码
 <div class="point1" @click="handlePoint(1)"></div>

2.设置样式

javascript 复制代码
  .point1{
    width: 1rem;
    height: 1rem;
    background: #2ce92f;
    position: absolute;
    border-radius: 50%;
    z-index: 999;
    cursor: pointer;
  }

3.设置伪元素样式

javascript 复制代码
  .point1::after {
    width: 100%;
    height: 100%;
    content: "";
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -2;
    background-color: #2ce92f;
    animation: dot-play 4s linear 400ms infinite;
  }
  .point1::before {
    width: 100%;
    height: 100%;
    content: "";
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    background-color: #2ce92f;
    animation: dot-play 4s linear 200ms infinite;
    animation-delay: 2s; /* 延迟 2s */
  }

4.设置动画效果

javascript 复制代码
  @keyframes dot-play {
    from {
      transform: scale(1);
      opacity: 0.8;
    }
    to {
      transform: scale(4);
      opacity: 0.1;
    }
  }
相关推荐
Wect14 分钟前
LeetCode 39. 组合总和:DFS回溯解法详解
前端·算法·typescript
Wect17 分钟前
LeetCode 46. 全排列:深度解析+代码拆解
前端·算法·typescript
IT_陈寒18 分钟前
Vite 凭什么比 Webpack 快50%?揭秘闪电构建背后的黑科技
前端·人工智能·后端
hi大雄1 小时前
我的 2025 —— 名为《开始的勇气》🌱
前端·年终总结
从文处安1 小时前
「前端何去何从」一直写 Vue ,为何要在 AI 时代去学 React?
前端·react.js
aircrushin1 小时前
OpenClaw“养龙虾”现象的社会技术学分析
前端·后端
明君879971 小时前
#Flutter 的官方Skills技能库
前端·flutter
yuki_uix2 小时前
重新认识 React Hooks:从会用到理解设计
前端·react.js
林太白2 小时前
ref和reactive对比终于学会了
前端
Apifox2 小时前
测试数据终于不用到处复制了,Apifox 自动化测试新增「共用测试数据」
前端·后端·测试