效果
要在百度地图上实现下列效果,直接开撸
代码段
<map id="map" class="map"></map>
let map = new window.BMapGL.Map('map') // 创建地图实例
let point = new window.BMapGL.Point(this.longitude, this.latitude) // 创建点坐标
map.centerAndZoom(point, 15)
map.enableScrollWheelZoom(true)
// 创建小图标
let myIcon = new window.BMapGL.Icon(
'static/map/marker2.png',
new window.BMapGL.Size(52, 52)
)
// 创建Marker标注,使用小图标
let pt = new window.BMapGL.Point(lon, lat)
let marker = new window.BMapGL.Marker(pt, {
icon: myIcon,
})
map.addEventListener('tilesloaded', function () {
marker .domElement.className =
marker .domElement.className + ' mapBGFault'
})
<style>
.map :deep() .mapBGFault {
width: 50px;
height: 50px;
background: red;
border-radius: 25px;
transform: scale(0);
animation: myfirst 2s;
animation-iteration-count: infinite;
}
@keyframes myfirst {
to {
background: rgba(0, 0, 0, 0);
transform: scale(2);
}
}
</style>