I am new to swift animations and would need some help in understanding this.
So say i have the following code which creates a circle based on the input provided.
func drawCircle(percentage:CGFloat){
//Some circle drawing code and the circle is drawn using the percentage % provided.
}
i call this function with
drawCircle(0.5)
i will get this.
i call using
drawCircle(0.75)
i will get this.
So based on the percentage passed i create the circle/semi-circle/ring. Hope i am making some sense.
Now only part i want to animate is the circle formation.
So say when i call drawCircle(0.5)
it should animate smoothly from 0.0% to 0.5%
Currently if i call my method with a timer and pass the parameters sequentially (0.00, 0.1, 0.2 etc to 0.5) it can work.
An example:
But I don't think it's the right way to do. So what am looking for is if there is a better way to do this using animations in swift where the transition from 0.0 to 0.5 is smooth.
[I don't want to change my existing codes for the circle creation. Its already an existing code base made by someone i am working and it has some time factor and risk to change anything right now on the existing code. Looking for something where the function "drawCircle(%)" can be used to achieve the desired output. Suggestions are always welcome.]
TIA>