2

I am trying to achieve an animated circular path to be drawn in 2 seconds in an ImageView in my application. Currently I have achieved to draw it but it just appears in my ImageView and I'd like to animate it using some kind of radial wiping in.

I can refer to this question asked based on an iOS application: How do you achieve a "clock wipe"/ radial wipe effect in iOS?

I'd like to have my circular path animated the same way with a duration of 2 seconds. How do I achieve that?

Currently this is my code.

private void createBitMap() {
        Bitmap bitMap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);  //creates bmp
        bitMap = bitMap.copy(bitMap.getConfig(), true);     //lets bmp to be mutable
        Canvas canvas = new Canvas(bitMap);                 //draw a canvas in defined bmp

        Paint paint = new Paint();
        // smooths
        paint.setAntiAlias(true);
        paint.setColor(Color.WHITE);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(2.5f);
        // opacity
        //p.setAlpha(0x80); //
        canvas.drawCircle(50, 50, 45, paint);
        ImageView.setImageBitmap(bitMap);
    }

I call this method simply like this: createBitMap();, and I'd like to continue doing that. This method only makes a drawn circle appear in my imageview so now I need to animate it.

Thanks in advance.

Community
  • 1
  • 1
Corfitz.
  • 1,864
  • 3
  • 31
  • 53

1 Answers1

0

You will have to adapt something like this answer: How to draw a path on an Android canvas with animation?

in the onDraw function, remember how much of an angle you have drawn currently and use canvas.drawArc to draw a slightly larger arc.

Community
  • 1
  • 1
vipluv
  • 607
  • 5
  • 8