代码
const map = new BMap.Map('map');
map.centerAndZoom(new BMap.Point(116.404, 39.915), 6);
map.enableScrollWheelZoom(true);
map.setMapStyle({
styleJson: darkStyle,
merge: true,
});
const pathData = {
type: 'LineString',
coordinates: [
[116.404, 39.915],
[117.201, 39.085],
[118.796, 32.059],
[121.472, 31.231],
[119.306, 26.075],
[113.264, 23.129],
],
};
const flyLineLayer = new BMap.FlyLineLayer({
mode: 'path',
strokeColor: 'rgba(120, 160, 255, 0.9)',
strokeWeight: 4,
blend: 'lighter',
});
map.addLayer(flyLineLayer);
flyLineLayer.setData(pathData);
通过 mode: path 设置飞线展示路径流动
预览