wrld.js

Animating the camera

Move the camera from its starting location to another location, with a defined animation time.

<!DOCTYPE HTML>
<html>
  <head>
    <script src="https://cdn-webgl.wrld3d.com/wrldjs/dist/latest/wrld.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet" />
  </head>
  
  <body>
  <div style="position: relative">
    <div id="map" style="height: 400px"></div>
    <script>
      var map = L.Wrld.map("map", "your_api_key_here", {
        center: [37.7858, -122.401],
        zoom: 16
      });

      setTimeout(function() {
      	map.setView([37.802, -122.4058], 18, {
          headingDegrees: 270,
          animate: true,
          durationSeconds:5
        });
      }, 5000);
    </script>
  </div>
  </body>
</html>
v0.1.1452