Here is how did it in google map
I think this should work in your case as well ... or at least you will get idea
if you have all lat lng ... loop through the list with some delay and then apply animation to marker
here is code snippet if you want i can post whole logic
// animate marker between two points to avoid jumpimg or shaking movement of marker while playing trip
private void moveMarkerPlay(double lat, double lng, Marker marker, double latNew, double lngNew) {
marker.setRotation((float) bearingBetweenLocations(new LatLng(lat, lng), new LatLng(latNew, lngNew)));
animateMarkerToICS(marker, new LatLng(latNew, lngNew), new LatLngInterpolator.Spherical());
if (playCount % (5 * playSpeed) == 0) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latNew, lngNew), mMap.getCameraPosition().zoom));
}
}
public static ObjectAnimator animator;
public void animateMarkerToICS(Marker marker, LatLng finalPosition, final LatLngInterpolator latLngInterpolator) {
TypeEvaluator<LatLng> typeEvaluator = (fraction, startValue, endValue) -> latLngInterpolator.interpolate(fraction, startValue, endValue);
Property<Marker, LatLng> property = Property.of(Marker.class, LatLng.class, "position");
animator = ObjectAnimator.ofObject(marker, property, typeEvaluator, finalPosition);
animator.setDuration(330 / playSpeed);
animator.start();
}
//Calculate bearing (angle) between two lat lng used for rotating marker as car moves
private double bearingBetweenLocations(LatLng latLng1, LatLng latLng2) {
double PI = 3.14159;
double lat1 = latLng1.latitude * PI / 180;
double long1 = latLng1.longitude * PI / 180;
double lat2 = latLng2.latitude * PI / 180;
double long2 = latLng2.longitude * PI / 180;
double dLon = (long2 - long1);
double y = Math.sin(dLon) * Math.cos(lat2);
double x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)
* Math.cos(lat2) * Math.cos(dLon);
double brng = Math.atan2(y, x);
brng = Math.toDegrees(brng);
brng = (brng + 360) % 360;
return brng;
}