Lucky_girl Lucky_girl - 3 months ago 8x
Java Question

Animation in Android

I have a Canvas, on which I draw circles using drawCircle(), what I need is to animate the increasing of the radius of these circles. As far as I understood it's possible to do this using VectorDrawable and AnimatedVectorDrawable. Can anyone provide example how to do it? or maybe exist other ways how better to do it?


I decided to use Matrix to animate circles in the Canvas.

 private int x;
 private int y;
 private Canvas tempCanvas;
 private Matrix matrix = new Matrix();
 private Path path = new Path();

 Paint myPaint = new Paint();
 path.addCircle(x, y, 10, Path.Direction.CW);
 //increasing radius of the certain circle 
 matrix.setScale(1.1f, 1.1f, x-5, y-5);
 tempCanvas.drawPath(path, myPaint4);