语言不太好描述,直接给大家看gif把
如果我暂停,车辆轨迹会停止 但是车(marker)会继续走,知道走到车辆轨迹停止的地方才会停止
正常情况下,不是应该车跟随着车辆轨迹一起走吗?
我把车的倍速 赋值给 车(marker)的 duration,但是还是不行
这个 车(marker)好像有自己的想法
/ 速度选择
PickerChange: function(e) {
var that = this;
if (e.detail.value <= 0) {
e.detail.value = 0;
}
that.index = e.detail.value;
if (that.index == 0) {
that.doubleSpeed = 1000;
that.butn = 0;
clearInterval(that.timer);
} else if (that.index == 1) {
that.doubleSpeed = 500;
that.butn = 0;
clearInterval(that.timer);
} else if (that.index == 2) {
that.doubleSpeed = 100;
that.butn = 0;
clearInterval(that.timer);
}
},
//播放
carPlay: function() {
var that = this;
console.log(that.doubleSpeed);
if (that.butn === 0) {
that.butn = 1;
}
if (!that.carFlager) {
that.polyline[1].points = [];
that.markers[0].latitude = that.polyline[0].points[0].latitude;
that.markers[0].longitude = that.polyline[0].points[0].longitude;
that.i = 0;
that.numItem = 0;
that.progress = 0;
}else {
that.i = that.timeI
}
clearInterval(that.timer);
let item = that.polyline[0].points;
// 进度
let allProgress = 100;
let allte = 100 / that.polyline[0].points.length;
that.timer = setInterval(function(){
that.carMap.translateMarker({
markerId: that.markers[0].id,
// 速度
duration:this.doubleSpeed,
// duration:0,
// 指定 marker 移动到的目标点
destination: {
longitude: that.polyline[0].points[that.i].longitude,
latitude: that.polyline[0].points[that.i].latitude
},
// 自动旋转
autoRotate: false,
// 旋转角度
rotate: that.mapList[that.i].directionDegrees,
});
that.latitude = that.polyline[0].points[that.i].latitude;
that.longitude = that.polyline[0].points[that.i].longitude;
that.info = [that.mapList[that.i]];
that.carspeed = that.info[0].speed;
that.carTime = that.info[0].address;
that.polyline[1].color = '#1e83ff';
that.polyline[1].points.push(item[that.numItem]);
that.progress = allte + that.progress;
that.i++;
that.timeI = that.i
that.numItem++;
if (that.numItem >= item.length) {
that.numItem = 0;
that.butn = 0;
that.carFlager = false;
that.carMap.includePoints({
points: that.polyline[0].points,
padding: [30, 20, 20, 30],
success: function(res) {
}
});
clearInterval(that.timer);
return;
}
}, that.doubleSpeed);
},
求助大佬们,这个是什么原因啊?微信官方文档也没有详细的说明