O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating animated maps

The best way to understand these animation functions is to try them out. Start from the previous example:

  1. First, add some buttons to trigger the animation effects:
    <button onclick="doBounce(london);">Bounce To London</button>
    <button onclick="doBounce(rome);">Bounce To Rome</button
    <button onclick="doPan(london);">Pan To London</button>
    <button onclick="doPan(rome);">Pan To Rome</button>
    <button onclick="doRotate();">Rotate</button>
    <button onclick="doZoom(2);">Zoom Out</button>
    <button onclick="doZoom(0.5);">Zoom In</button>

    These are regular HTML buttons that call a function when clicked. We'll add the functions in a moment.

  2. Next, add a new location for Rome, next to the line where we defined the location ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required