Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenLayers 2.10 Beginner's Guide
  • Table Of Contents Toc
  • Feedback & Rating feedback
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
close
close
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)

Overview of this book

Table of Contents (18 chapters)
close
close
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for Action – working with Pan animations


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.

  1. Create a new page from the template in Chapter 1. Define your map object like this, passing panMethod and panDuration properties:

    map = new OpenLayers.Map('map_element', {
      panMethod: OpenLayers.Easing.Quad.easeInOut,
      panDuration: 100
    });
  2. 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);)
  3. You should see an animation when panning the map.

What Just Happened?

We just used the panMethod and panDuration properties to customize our map's pan animations. Changing the panDuration will affect how long the animation itself lasts, and changing the panMethod determines which type of animation to use. By using these properties...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY