css3实现类似地图定位循环扩散光圈效果

1.效果图,重点opacity,animation,transform:scale

2.html

html 复制代码
<div class="icon-warnCom">
        <icon class="icon-warns"><i class="dot"></i><i class="pulse"></i></icon>
    </div>
    <div class="icon-warnCom1">
        <icon class="icon-warns"><i class="dot"></i><i class="pulse"></i></icon>
    </div>
    <div class="icon-warnCom2">
        <icon class="icon-warns"><i class="dot"></i><i class="pulse"></i></icon>
    </div>

3.css

css 复制代码
 body {
            width: 100%;
            height: 100%;
            background-color: black;
        }
        
        @keyframes warn {
            0% {
                transform: scale(0);
                opacity: 0.0;
            }

            25% {
                transform: scale(0);
                opacity: 0.1;
            }

            50% {
                transform: scale(0.1);
                opacity: 0.3;
            }

            75% {
                transform: scale(0.2);
                opacity: 0.5;
            }

            100% {
                transform: scale(0.3);
                opacity: 0.0;
            }
        }
        
        .icon-warnCom {
            position: absolute;
            width: 12px;
            height: 12px;
            background-color: #ffd803;
            border-radius: 100%;
            top: 100px;
            left: 100px;
        }

        .icon-warns {
            position: relative;
            width: 100%;
            height: 100%;
            display: block;
        }
        /* 保持大小不变的小圆圈  */
        .dot {
            position: absolute;
            left: -44px;
            top: -44px;
            width: 60px;
            height: 60px;
            -webkit-border-radius: 100;
            -moz-border-radius: 100;
            border: 20px solid #f6c100;
            border-radius: 100%;
            z-index: 2;
            opacity: 0;
            -webkit-animation: warn 2.5s ease-out;
            -moz-animation: warn 2.5s ease-out;
            animation: warn 2.5s ease-out;
            -webkit-animation-iteration-count: infinite;
            -moz-animation-iteration-count: infinite;
            animation-iteration-count: infinite;
        }

        /* 产生动画(向外扩散变大)的圆圈  */
        .pulse {
            position: absolute;
            left: -44px;
            top: -44px;
            width: 60px;
            height: 60px;
            border: 20px solid #f6c100;
            -webkit-border-radius: 100%;
            -moz-border-radius: 100%;
            border-radius: 100%;
            z-index: 1;
            opacity: 1;
            -webkit-animation: warn 1.5s ease-out;
            -moz-animation: warn 1.5s ease-out;
            animation: warn 1.5s ease-out;
            -webkit-animation-iteration-count: infinite;
            -moz-animation-iteration-count: infinite;
            animation-iteration-count: infinite;
        }

       

        .icon-warnCom1 {
            position: absolute;
            width: 12px;
            height: 12px;
            background-color: #ffd803;
            border-radius: 100%;
            top: 50px;
            left: 50px;
        }

        .icon-warnCom2 {
            position: absolute;
            width: 12px;
            height: 12px;
            background-color: #ffd803;
            border-radius: 100%;
            top: 100px;
            left: 50px;
        }
相关推荐
Alair‎4 分钟前
前端开发之环境配置
前端·react.js
麦兜*7 分钟前
SpringBoot Profile多环境配置详解,一套配置应对所有场景
java·数据库·spring boot
MetaverseMan7 分钟前
rpc节点: synchronized (this) + 双检锁,在 race condition 的情况下分析
java·区块链
笃行客从不躺平7 分钟前
Seata + AT 模式 复习记录
java·分布式
Deca~8 分钟前
VueVirtualLazyTree-支持懒加载的虚拟树
前端·javascript·vue.js
CTO Plus技术服务中10 分钟前
强悍的Go语言开发面试题和答案
java·面试·职场和发展
爱上妖精的尾巴16 分钟前
7-11 WPS JS宏 对象的属性值为函数的写法与用法
前端·javascript·wps·js宏·jsa
zuozewei17 分钟前
零基础 | 使用LangChain框架实现ReAct Agent
前端·react.js·langchain
坠入暮云间x18 分钟前
React Native for OpenHarmony开发环境搭建指南(一)
前端·react native·开源
黎雁·泠崖20 分钟前
Java static入门:概述+静态变量特点与基础实战
java·开发语言