ios - Trying to animate a circle formation using Swift -


i new swift animations , need in understanding this.

so have following code creates circle based on input provided.

    func drawcircle(percentage:cgfloat){ //some circle drawing code , circle drawn using percentage % provided.  } 

i call function with

drawcircle(0.5) 

i this. enter image description here call using

drawcircle(0.75) 

i this. enter image description here based on percentage passed create circle/semi-circle/ring. hope making sense.

now part want animate circle formation. when call drawcircle(0.5) should animate smoothly 0.0% 0.5% if call method timer , pass parameters sequentially (0.00, 0.1, 0.2 etc 0.5) can work. example: enter image description here

but don't think it's right way do. looking if there better way using animations in swift transition 0.0 0.5 smooth.

[i don't want change existing codes circle creation. existing code base made working , has time factor , risk change right on existing code. looking function "drawcircle(%)" can used achieve desired output. suggestions welcome.]

tia>

look how animations uibezierpath , cashapelayer. basically, need create uibezierpath equation circle. use strokeend property define how of circle should animated. here answer reference, albeit in objective-c

draw circle uibezierpath


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -