OpenLayers gives us the ability to use different types of animations when the user pans the map. Using the properties we just discussed, let's learn how to customize the pan animations.
Create a new page from the template in Chapter 1. Define your map object like this, passing
panMethod
andpanDuration
properties:map = new OpenLayers.Map('map_element', { panMethod: OpenLayers.Easing.Quad.easeInOut, panDuration: 100 });
Pan the map by clicking on one of the arrows in the control on the top left. In Firebug, call the following
panTo
function to pan the map to pass in a coordinate:map.panTo(new OpenLayers.LonLat(-18,42);)
You should see an animation when panning the map.