Skip to content

Latest commit

 

History

History
70 lines (54 loc) · 1.44 KB

File metadata and controls

70 lines (54 loc) · 1.44 KB

⚠️ This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

marker.setAnimation()

You can give an animation to the marker.

marker.setAnimation(animation);

Parameters

name type description
animation string One of the following values:
  • plugin.google.maps.Animation.DROP
  • plugin.google.maps.Animation.BOUNCE

Demo code

<div id="map_canvas">
    <span class="smallPanel"><button>Click here</button></span>
</div>
var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div, {
  camera: {
    target: {lat: 35, lng: 137},
    zoom: 15
  }
});


var marker = map.addMarker({
  position: new plugin.google.maps.LatLng(35, 137),
  icon: "https://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png",
  animation: plugin.google.maps.Animation.DROP
});

var button = div.getElementsByTagName('button')[0];
button.addEventListener("click", function() {
  marker.setAnimation(plugin.google.maps.Animation.DROP);
});

marker.on(plugin.google.maps.event.MARKER_CLICK, function() {
  marker.setAnimation(plugin.google.maps.Animation.BOUNCE);
});