Stop animation symbol on polyline - googlemaps

前端 未结 2 424
攒了一身酷
攒了一身酷 2021-01-22 21:57

I used the animation for symbols on polylines according to this answer that was very useful: Animate symbol on multiple geodesic polylines

What i would like is to have s

2条回答
  •  再見小時候
    2021-01-22 22:55

    id is an index into your array of polylines. To access the polyline you need to use polylines[id] (i.e polylines[id].setOptions.

    You probably also want to stop the timer, for that you need to keep a reference to the value returned by setInterval.

    working example

    function stopCircle(id) {
        clearInterval(polylines[id].handle);
        polylines[id].polyline.setOptions({
            icons: null});
    };
    

    Where the polylines array now contains:

        polylines[i] = new Object();
        polylines[i].polyline = polyline;
        polylines[i].handle = animateCircle(i);
    

提交回复
热议问题