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. call using
drawcircle(0.75)
i this. 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:
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
Comments
Post a Comment