微信小程序地图轨迹绘制闪烁

图片描述
1.开发环境mpvue+微信小程序
2.markers里的轨迹通过定时器绘制时,有闪烁问题。
3.具体代码

        <map id="map" :longitude="longitude" :latitude="latitude"  :scale="localScale"  :polyline="polyline"   :markers="localMarker" style="width: 100%; height: 88%;">
            let  show= () => {
                this.playTrajectory=setTimeout(() => {
                    // console.log(this.polyline[0].points[this.markerIndex].longitude,this.polyline[0].points[this.markerIndex].latitude)
                    // this.movePoints(this.polyline[0].points[this.markerIndex].longitude,this.polyline[0].points[this.markerIndex].latitude)
                    this.localMarker[1].latitude= this.polyline[0].points[this.markerIndex].latitude
                    this.localMarker[1].longitude= this.polyline[0].points[this.markerIndex].longitude
                    this.markerIndex++;
                    if(this.markerIndex<this.polyline[0].points.length){
                        show()
                    }else{
                        this.changeIcon=playIcon;
                        this.markerIndex=0;
                        this.isPlayNow=false;
                    }
                },200)
            }
            if(this.isPlayNow){
                clearTimeout(this.playTrajectory);
            }else{
                show();
            }

4.尝试过通过官方APImapCtx.translateMarker去移动坐标点到下一个目的地(上述代码注释部分)。但是没啥卵用,连动也不动了,一直在原地闪烁。
具体代码:

        movePoints(lon,lat) {
            let mapCtx = wx.createMapContext("map");
            mapCtx.translateMarker({
                markerId:0,
                destination:{longitude:lon,latitude:lat},
                autoRotate:true,
                rotate:0
            })            
        },
阅读 13.4k
8 个回答

我想请问作者如何实现这种回放功能的?

新手上路,请多包涵

楼主,我也想要一份代码参考学习,O(∩_∩)O谢谢,百度网盘失效了

啥做到的?楼主方便开源一下供大家学习一下吗?

请问这个闪烁的问题解决了吗?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题