Reputation: 8714
I am trying to start programming some animation in Xcode. I tried to Google it, but I have few solutions.
One is Quartz 2D and the other one is core animation.
I am not sure which is better and easier to use and learn. My animation should be line animation(2d). I need this animated line between two dots. Is it easy to make? I am confused, because I don't know where to start. Can you give me some advice, or code sample? Thank you very much!
*added description
I would like to define 10 dots. like this:
1 2 3
4 5 6
7 8 9
0
When I have user input for example 37459 line should be animated between those numbers.
Line should be with gradient.
Upvotes: 2
Views: 382
Reputation: 122391
Sounds to me like Quartz2D is the way to go. With Core Animation you define an object and then transform it in various ways and, by default, that transformation is animated.
However what you need to do is animate it yourself as you are not simply transforming an object. You need to keep track of which line you are currently "growing" and which lines have already been completely animated. As time progresses you need to draw more of the growing line between its endpoints. You can probably do all of this using a simple timer that increments progress between 0.0 and 1.0 (like NSAnimation
does) and use that to define how long the currently growing line is.
Upvotes: 1