Stop animation symbol on polyline - googlemaps

前端 未结 2 446
攒了一身酷
攒了一身酷 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:50

    For me "id" is a polyline itself. All I need is to keep the output from "setInterval", that should be the input for "clearInterval". These are the two functions:

    function animateCircle(id) {
        var count = 0;
        window.clearInterval(id.offsetId);
        id.offsetId = window.setInterval(function () {
            count = (count+1) % 200;
            id.setOptions({
                icons: [{
                    offset: (count/2)+'%'
                }]
            });
        }, 20);
    };
    
    function stopCircle(id) {
        window.clearInterval(id.offsetId);
        id.setOptions({
            icons: null
        });
    };
    

提交回复
热议问题