Animation between 2 points on Google maps

I need to have a map with a list of markers on it. He should move between them smoothly.

I have the following code that currently moves around markers.

var x = 0;
function pan_to() {

    if(x >= addresses.length){
        x=0;
    }
    $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address='+addresses[x]+'&sensor=false', null, function (data) {
        var p = data.results[0].geometry.location
        var latlng = new google.maps.LatLng(p.lat, p.lng);

        map.panTo(latlng);

    });
    x++;

} setInterval(pan_to,3000);

A working example here is http://jsfiddle.net/shanejones/khX2K/

I need a map for a smooth transition within 1 second between them with some form of attenuation. Does anyone have any ideas

+4
source share

Source: https://habr.com/ru/post/1546892/


All Articles