[OpenLayers-Dev] smooth pan (animated)

Pierre GIRAUD bluecarto at gmail.com
Fri Dec 21 12:12:24 EST 2007


Hi all,

Beginning the review of the great code already written to handle the
google-like popups, I figured out that there was many different thing
addressed there.
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
[1].
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
updated properties.
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 [3].

I'm looking for feedbacks.

Regards,
Pierre

[1] http://trac.openlayers.org/ticket/110
[2] http://www.robertpenner.com/easing/
[3] http://dev.openlayers.org/sandbox/camptocamp/panto/examples/tween.html



More information about the Dev mailing list