[ACCEPTED]-How can I have a smooth animated move between 2 Google Maps locations?-google-maps
Unfortunately, I don't think this is possible 13 (without a change from Google). From the 12 v3 API reference for panTo
:
Changes the center of the map to the 11 given LatLng. If the change is less than 10 both the width and height of the map, the 9 transition will be smoothly animated.
which 8 implies that if that change is not less 7 than the dimensions of the map, the transition 6 won't be smoothly animated. The other pan 5 methods are similar.
You could try moving 4 in multiple steps but that's a bit of a 3 hack and I suspect the result will be poor.
Sorry 2 that's not very helpful (I have the same 1 problem).
For me this method works, but i'm using 2 Google Maps API v2.
LatLng latLng = new LatLng(lat,lng);
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, ZOOM_FACTOR));
This animates the camera 1 from current position to the new one.
If you are using Gmaps API V2, then you 8 can implement smooth animated move very 7 easily by using panBy() method. You have 6 to use fromLatLngToContainerPixel() method 5 to find the amount of pixels to pan by.
Here 4 is the bit of code:
var newLoc = map.fromLatLngToContainerPixel(new GLatLng(lat, lng));
map.panBy(new GSize( newLoc.x, newLoc.y ));
However, what I am trying 3 to do is to achieve the same thing in maps 2 API V3, but sadly fromLatLngToContainerPixel() method 1 does not work anymore the way it did :(
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.