Android map: how to animate a polyline on a map?

When I draw my polyline on the map from point A -> B, I have a requirement to draw the polyline with animation. As if from A-> B the polyline continues to draw.

I used the link below for the link:

https://github.com/amalChandran/google-maps-route-animation

      

Using the solution, I can animate the polyline, but the polyline itself is not correct. It doesn't go across the road. The original APK of the solution also has the same error.

Can anyone help me with a suitable solution

+3


source to share


1 answer


You can try with this link also https://github.com/mohak1712/UberUX?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=6129

ValueAnimator - for animating overlays and polylines

ValueAnimator tAnimator = ValueAnimator.ofFloat(0, 1);
       tAnimator.setRepeatCount(ValueAnimator.INFINITE);
       tAnimator.setRepeatMode(ValueAnimator.RESTART);
       tAnimator.setInterpolator(new LinearInterpolator());
       tAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
           @Override
           public void onAnimationUpdate(ValueAnimator valueAnimator) {
              // animate here
           }
       });

      



PolyLines - for drawing lines on the map

 PolylineOptions greyOptions = new PolylineOptions();
        greyOptions.width(10);
        greyOptions.color(Color.GRAY);
        greyOptions.startCap(new SquareCap());
        greyOptions.endCap(new SquareCap());
        greyOptions.jointType(ROUND);
        greyPolyLine = mMap.addPolyline(greyOptions);

      

+3


source







All Articles