user1416564 user1416564 - 23 days ago 13
iOS Question

How can I animate the drawing of a complex line shape in objective-c

So say I wanted to animate drawing this shape:

Image

Animate it something like the disney logo which seems to "write" the letters.

Ideally, I'd also like to have control over how fast it was drawn (maybe just easing), how would I go about getting that done? Specifically imagine if that link had a line of varying widths.

Not too familiar with drawing things in objective-c so perhaps someone can help point me in the right direction in terms of strategy.

Answer

Create a CAShapeLayer and set that shape as its path. Use a CABasicAnimation or a CAKeyframeAnimation to animate its strokeEnd property.

Comments