CSS雷达光波效果(前端雷达光波效果)

前言

CSS雷达光波效果是一种视觉动画效果,常用于模仿雷达扫描或检测的视觉反馈。这种效果通常涉及到动态的圆形或弧形图案,它们从一个中心点向外扩散,类似于水面上的涟漪或雷达扫描线。以下是创建CSS雷达光波效果的一些关键技术和步骤,这里提供两种效果 ,简单记录一下


一. First

1. HTML 结构

html 复制代码
<div class="radar_container">
      <div class="radar_wave"></div>
      <div class="radar_wave"></div>
      <div class="radar_wave"></div>
</div>

2. CSS 内容

css 复制代码
  .radar_container {
    margin: auto;
    position: relative;
    width: 200px;
    height: 200px;
    // background-color: #000;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .radar_wave {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid #00ff00;
    border-radius: 50%;
    transform: scale(0); // 初始状态改为从中间开始
    box-shadow: inset 0 0 5px 1px #00ff00; // 添加阴影
    animation: radar_wave-animation 3s infinite;
  }

  .radar_wave:nth-child(1) {
    animation-delay: 0s;
  }
  .radar_wave:nth-child(2) {
    animation-delay: 1s;
  }
  .radar_wave:nth-child(3) {
    animation-delay: 2s;
  }

  @keyframes radar_wave-animation {
    0% {
      transform: scale(0); // 从中间开始
      opacity: 1;
    }
    100% {
      transform: scale(10); // 扩散到原来的10倍大小
      opacity: 0;
    }
  }

二. Second

1. HTML 结构同上,CSS 内容请看以下

css 复制代码
  .radar_container {
    margin: auto;
    position: relative;
    width: 200px;
    height: 200px;
    // background-color: #000;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
  }
  .radar_wave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background-color: #8080ff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    animation: radar_wave-animation 3s infinite;
  }

  .radar_wave:nth-child(1) {
    animation-delay: 0s;
  }

  .radar_wave:nth-child(2) {
    animation-delay: 1s;
  }

  .radar_wave:nth-child(3) {
    animation-delay: 2s;
  }

  @keyframes radar_wave-animation {
    0% {
      transform: scale(0); // 从中间开始
      opacity: 1;
    }
    100% {
      transform: scale(10); // 扩散到原来的10倍大小
      opacity: 0;
    }
  }

感觉有用,就一键三连,感谢(●'◡'●)

相关推荐
纯粹的热爱2 分钟前
Ubuntu 安装 Node.js 22.x(通过 NodeSource 官方源)
前端
Highcharts4 分钟前
如何选择正确的图表:驱动理解和洞察力的三部分框架(第3部分)
前端·数据可视化
JavaGuide23 分钟前
Github 史诗级故障,与此同时,Cursor 版「GitHub」正式上线!
前端·后端
郭邯25 分钟前
用 AI 写了一个经纬度格式转换工具,从需求到落地的完整过程
前端
不一样的少年_27 分钟前
修了 Bug、做了重构,为什么老板还是觉得你没产出?
前端·后端·程序员
马可家的菠萝30 分钟前
Vue3 + Canvas 手绘笔记工程化实践:别把画布只当成一张 PNG
前端·vue.js·算法
IMPYLH38 分钟前
HTML 的 <h1>–<h6> 元素
前端·javascript·html
IMPYLH41 分钟前
HTML 的 <head> 元素
前端·html
卸任1 小时前
AI英语学习助手:从翻译工具到 AI 英语学习助手
前端·electron
计算机魔术师1 小时前
A股人形机器人第一股来了!宇树科技8月19日上市,一签或赚20万
前端