0

How can I rotate marker with animation in Google Map? Following is the my code snippet. I am using ionic native google map plugin.

moveMarker() {
let prevLat = new LatLng(this.prevPosition[0], this.prevPosition[1]);
this.prevPosition[0] += this.deltaLat;
this.prevPosition[1] += this.deltaLng;
let latlng = new LatLng(this.prevPosition[0], this.prevPosition[1]);
let heading = Spherical.computeHeading(prevLat, latlng);
this.marker.setRotation(heading);
this.marker.setPosition(latlng);

if (this.i != this.numDeltas) {
  this.i++;
  setTimeout(this.moveMarker(), this.delay);
 }
}
azhar
  • 1,709
  • 1
  • 19
  • 41

1 Answers1

0

I think This might helps you.

Moving markers smoothly by dividing the distance into chunks

Muhammad Shaharyar
  • 1,044
  • 1
  • 8
  • 23