I've written a small algorithm that animates markers' movement from one point to another. The algorithm looks like this in pseudocode:
lat_delta = new_lat - old_lat;
lng_delta = new_lng - old_lng;
for(alpha=0; alpha < 1; alpha += 0.1) {
lat = old_lat + (alpha * lat_delta);
lng = old_lng + (alpha * lng_delta);
update_marker(lat, lng);
}
The full code is available at http://dev.syskall.com/map/ and http://dev.syskall.com/map/commute.js.
The problem I have run into is that when the map is zoomed out, the animation seems to "zig zag". That being said, when you zoom in, the animation is much smoother.
I believe it may be due to the fact that my animation is based on lat,lng coordinates and not pixels on the screen. When you zoom out, Google Maps is not as precise and must round the latlng position somehow.
Of course, the current implementation is just fine when the map is zoomed in but not so good when it's zoomed out.
Is there any way around this problem?