2

I have a PNG of a full circle. I would like to do an animation of the circle being drawn through each quadrant (as in it draws itself clockwise). How can i do this? anyone with an example?

Mark Manickaraj
  • 1,661
  • 5
  • 28
  • 44
  • What you're referring to would have little to do with the PNG itself, it would just be drawing/revealing an image in a clockwise animation. I don't think you're going to have any luck, and should look into either making an animation out of it or drawing it with vectors. – Fosco May 25 '11 at 20:14
  • Hi, Could you please share how you achieved this finally? – source.rar Jul 08 '11 at 17:27
  • Read here to see how it was solved: http://stackoverflow.com/questions/6156674/android-gauge-animation-question – Mark Manickaraj Jul 13 '11 at 16:54

2 Answers2

1

Good sample code related to drawing arcs / semi circles is available on the Android Developer site here.

For your specific case, I see two approaches.

One is to ditch the PNG file entirely and just draw the circle (best if there's nothing special about the circle: It's just one color, etc).

If you definitely want to use the PNG file, then you can draw a background-colored, filled-in circle on top of that, and animate it in reverse (erasing itself counter-clockwise), which will reveal the circle in your PNG file as a result.

Alexander Lucas
  • 22,171
  • 3
  • 46
  • 43
0

You might be able to do something with Canvas.clipPath(Path) in a custom view.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521