Search code examples
iosobjective-cuser-interfacecore-animation

What part of CoreGraphics should I use to recreate these effects?


The gif below was pulled from Two Dots, an iOS app. If my app is not a game, and I'm using standard UIViews, what is the best way to achieve similar effects in a performance-optimized manner.

I'm specifically referring to the lines shooting out between the circles.

enter image description here


Solution

  • A broad question prompts an unspecific answer: check out CAShapeLayer — its strokeStart and strokeEnd are animatable. So you can set the whole line as the shape, then get Core Animation to animate which segment is displayed.