Why would I use an CAAnimationGroup?
I have trouble understanding apple's core animation (for iOS).
I am trying to animate the position
and bounds
of a layer concurrently (but with different timing functions).
According to the documentation, a CAAnimationGroup allows multiple animations to be grouped and run concurren开发者_JAVA技巧tly. But according to my (early) experiments this can also be accomplished by adding several animation objects to the target layer. If so, what is the purpose of that CAAnimationGroup?
If you want to animate two different properties with different timing functions then grouping these animation is not needed in this case. I think that grouping is useful when you create several animations and want them to have the same timing behaviour. You can set timing function for the group. In the Core Animation Cookbook i saw an example that shows how to use grouping when setting a timing curve for CAKeyframeAnimation.
The following quote is from the book "iOS Core Animation"
Adding an animation group to a layer is not fundamentally different from adding the animations individually, so it’s not immediately clear when or why you would use this class. It provides some convenience in terms of being able to collectively set animation durations, or add and remove multiple animations from a layer with a single command, but it’s usefulness only really becomes apparent when it comes to hierarchical timing , which is explained in Chapter 9 .
精彩评论