[OpenLayers-Dev] smooth pan (animated)
bluecarto at gmail.com
Fri Dec 21 12:12:24 EST 2007
Beginning the review of the great code already written to handle the
google-like popups, I figured out that there was many different thing
In the code graciously provided by Tim Coulter (and written with the
help of many other guys), different features are mixed and I think
this would be better if we get into trunk one at a time.
One first functionnality I found was the map slide. This is
specifically used to get the popup entirely visible but this smooth
panning thing is something many people has been asking for for long
I worked on this and I want to propose what follows.
First, I imagined having a panTo method allow user to pan to a new
given center. Like in google API, I wanted this pan to be smooth only
if the new center is in the current visible extent. (quite easy).
For the transition effect, I relied on the Robert Penner's famous
Tween and Easing algorithms. Given an easing mode (linear, exponential
...), two objects (from and to) with one or more properties, a time
interval and a number of steps, it returns intermediate objects with
This transition handler is imagined to be used for different purposes.
For example, it could also be used to manage the popup size update.
Paul (and other folks) are probably interested in testing it for the
transition zoom effect. This might simplify code.
An working example is already available .
I'm looking for feedbacks.
More information about the Dev