views:

45

answers:

1

I've got two points on a google map and I want to transition between them using a smooth animation. Using the map.panTo() method I can pan to them but the animation only works if the second point is less than the width/height of the map.

So the idea i've come up with is to break the transition up into something like:

 var destination = next point 
 get center

 check if the destination is in bounds
 if so
   panTo it
 else
   get the midpoint between center and point
   if midpoint in bounds pan 
   else get midpoint etc....

So here the travelling is broken up into as little steps as possible. Problem is, i cant get my head around how to implement this in code(the recursive midpoint checking that is) Any help would be great.

the page im having this problem with is http://amishh4cker.com/geocaching.html

A: 
Kogitsune