Animation between 2 points on Google maps

ぐ巨炮叔叔 提交于 2019-12-23 15:17:12

问题


I need to have a map with a list of markers on it. It needs to transition between these smoothly.

I have the following code which currently loops around the 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);

Working example here - http://jsfiddle.net/shanejones/khX2K/

What I need is the map to smoothly transition for 1 seconds between them with some form of easing too. Anyone have any ideas

来源:https://stackoverflow.com/questions/24536287/animation-between-2-points-on-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!