思路
1、中国地图作为背景,将一个盒子定位到想要的位置;
2、通过三个子盒子,添加阴影,设置时间段对应的动画以及透明度;
3、将后两个盒子适当延时;
效果

代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.map {
position: relative;
margin: auto;
width: 615px;
height: 506px;
background: url("../res/Map.jpg") no-repeat;
}
.dotted {
position: absolute;
left: 270px;
top: 118px;
width: 8px;
height: 8px;
background-color: red;
border-radius: 50%;
}
.map div[class ^= "pulse"] {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 8px;
height: 8px;
box-shadow: 0 0 12px rgb(252, 55, 55);
border-radius: 50%;
animation: hot 1.5s linear infinite;
}
.map .dotted .pulse2 {
animation-delay: 0.4s;
}
.map .dotted .pulse3 {
animation-delay: 0.8s;
}
@keyframes hot {
0%{}
70% {
width: 40px;
height: 40px;
opacity: 1;
}
100% {
width: 70px;
height: 70px;
opacity: 0;
}
}
</style>
</head>
<body>
<div class="map">
<div class="dotted">
<div class="pulse1"></div>
<div class="pulse2"></div>
<div class="pulse3"></div>
</div>
</div>
</body>
</html>

本文详细介绍了一种在网页上实现中国地图上脉冲动画效果的方法。通过使用HTML和CSS,作者展示了如何定位元素,创建动态阴影,并设置动画来模拟脉冲效果。代码示例清晰地说明了每个步骤。
2486

被折叠的 条评论
为什么被折叠?



