<!DOCTYPE html>
<html>
<head>
<title>MoveLineOverlay</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body,
html {
width: 100%;
height: 100%;
margin: 0;
font-family: "微软雅黑";
}
#allmap {
width: 100%;
height: 100%;
}
p {
margin-left: 5px;
font-size: 14px;
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=U3q69k0Dv0GCYNiiZeHPf7BS"></script>
<script src="../dist/inmap.js"></script>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script>
var inmap = new inMap.Map({
id: 'allmap',
skin: "Blueness",
center: [112.03956, 26.063677],
zoom: {
value: 6,
show: true,
max: 18,
min: 5
},
});
var data = [{
from: {
name: '广州',
coordinates: [113.270793, 23.135308]
},
to: {
name: '衡山',
coordinates: [112.612787, 27.317599]
},
count: 1,
}, {
from: {
name: '广州',
coordinates: [113.270793, 23.135308]
},
to: {
name: '北京',
coordinates: [116.413554, 39.911013]
},
count: 2,
}, {
from: {
name: '广州',
coordinates: [113.270793, 23.135308]
},
to: {
name: '三亚',
coordinates: [109.518646, 18.258217]
},
count: 3,
}, {
from: {
name: '广州',
coordinates: [113.270793, 23.135308]
},
to: {
name: '上海',
coordinates: [121.480237, 31.236305]
},
count: 4,
}, {
from: {
name: '广州',
coordinates: [113.270793, 23.135308]
},
to: {
name: '韶关',
coordinates: [113.603757, 24.816174]
},
count: 5,
}
];
var overlay = new inMap.MoveLineOverlay({
style: {
point: { //散点配置
tooltip: {
show: true,
formatter: "{name}"
},
style: {
normal: {
backgroundColor: 'rgba(200, 200, 50, 1)',
borderWidth: 1,
borderColor: "rgba(255,255,255,1)",
size: 6,
label: {
show: true,
color: 'rgba(255,255,255,1)'
},
},
mouseOver: {
backgroundColor: 'rgba(200, 200, 200, 1)',
borderColor: "rgba(255,255,255,1)",
borderWidth: 4,
},
selected: {
backgroundColor: 'rgba(184,0,0,1)',
borderColor: "rgba(255,255,255,1)"
},
},
event: {
onMouseClick: function (item) {}
}
},
line: { //线的配置
style: {
normal: {
borderColor: 'rgba(200, 200, 50, 1)',
borderWidth: 1,
// shadowColor: 'rgba(255, 250, 50, 1)',
// shadowBlur: 20,
lineOrCurive: "curve"
},
}
},
lineAnimation: {
style: {
size: 2,
//移动点颜色
fillColor: '#fff',
//移动点阴影颜色
shadowColor: '#fff',
//移动点阴影大小
shadowBlur: 10,
lineOrCurve: 'curve',
}
},
},
data: data,
});
inmap.add(overlay);
setTimeout(() => {
overlay.setOptionStyle({
style: {
point: { //散点配置
tooltip: {
show: true,
formatter: "{name}"
},
style: {
normal: {
backgroundColor: 'rgba(200, 200, 50, 1)',
borderWidth: 1,
borderColor: "rgba(255,255,255,1)",
size: 6,
label: {
show: true,
color: 'rgba(255,255,255,1)'
},
},
mouseOver: {
backgroundColor: 'rgba(200, 200, 200, 1)',
borderColor: "rgba(255,255,255,1)",
borderWidth: 4,
},
selected: {
backgroundColor: 'rgba(184,0,0,1)',
borderColor: "rgba(255,255,255,1)"
},
},
event: {
onMouseClick: function (item) {}
}
},
line: { //线的配置
style: {
normal: {
borderColor: 'rgba(200, 200, 50, 1)',
borderWidth: 1,
// shadowColor: 'rgba(255, 250, 50, 1)',
// shadowBlur: 20,
lineOrCurive: "curve"
},
mouseOver: {
borderColor: 'rgba(255, 255, 255, 1)'
},
selected: {
borderColor: 'rgba(184,0,0,1)',
},
splitList: [{
start: 0,
end: 1,
borderWidth: 5,
borderColor: 'rgba(156,200,249,1)'
},
{
start: 1,
end: 2,
borderWidth: 6,
borderColor: 'rgba(93,158,247,1)'
},
{
start: 2,
end: 3,
borderWidth: 3,
borderColor: 'rgba(134,207,55,1)'
},
{
start: 3,
borderWidth: 4,
borderColor: "rgba(252,198,10,1)"
}
]
},
},
lineAnimation: {
style: {
size: 2,
//移动点颜色
fillColor: '#fff',
//移动点阴影颜色
shadowColor: '#fff',
//移动点阴影大小
shadowBlur: 10,
lineOrCurve: 'curve',
}
},
}
})
}