Animation iPhone: how do I animate an area fill?

Consider the circle. Now consider the radius of the circle, drawn from the center of the circle to the right. Now imagine that the radius rotates around the center of the circle, sweeping the area as it rotates. My problem is this: I want to use iPhone animation methods to fill the marked area with a different color from the background area of ​​the circle, as the radius rotates from 0 degrees to any selected number of degrees around the circle.

I looked at the Core Animation API, KeyFrame Animations, etc., but I can’t find out how to do this. Any hints would be appreciated.

Thanks Sandeep

+4
source share
1 answer

Check out CAShapeLayer . It allows you to animate two Core Graphics paths that can be as complex as you want. In this case, you may need to animate the path that defines a thin filled wedge and a filled wedge that covers a larger circle angle. You may need to use CAKeyframeAnimation to make sure it is animated in the movement you need and in the right direction.

+2
source

Source: https://habr.com/ru/post/1310856/


All Articles