CSS实现闪烁的光圈

效果如下:
在这里插入图片描述

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
@keyframes warn {
	0% {transform: scale(0);opacity: 0.0;}
	10% {transform: scale(0.2);opacity: 0.2;}
	20% {transform: scale(0.4);opacity: 0.4;}
	30% {transform: scale(0.6);opacity: 0.6;}
	40% {transform: scale(0.8);opacity: 0.8;}
	50% {transform: scale(1);opacity: 1;}
	60% {transform: scale(1);opacity: 0.8;}
	70% {transform: scale(1);opacity: 0.6;}
	80% {transform: scale(1);opacity: 0.4;}
	90% {transform: scale(1);opacity: 0.2;}
	100% {transform: scale(1);opacity: 0;}
}

 
 
.container {
	position: relative;
	width: 40px;
	height: 40px;
	/*border: 1px solid #000;*/
	animation: warn 0.3s ease-out;
	animation-iteration-count: infinite;
}
/* 保持大小不变的小圆圈  */
.dot {
	position: absolute;
    width: 10px;
    height: 10px;
    left: 14px;
    top: 14px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border: 1px solid #f40d0d;
    background: #f43d3db0;
    border-radius: 20px;
    z-index: 2;
    animation: warn 0.1s ease-out;
	animation-iteration-count: infinite;
}
/* 产生动画(向外扩散变大)的圆圈  */
.pulse {
	position: absolute;
    width: 24px;
    height: 24px;
    left: 7px;
    top: 7px;
    border: 1px solid #f4313169;
    background: #ed2b2b4a;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
    z-index: 1;

}
</style>
</head>
<body>
	<div class="container">
		<div class="dot"></div>
		<div class="pulse"></div>
	</div>
</body>
</html>
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值