Why should I use CAAnimationGroup?

I'm having trouble understanding Apple kernel animations (for iOS). I am trying to animate the position and bounds layer at the same time (but with different synchronization functions).

According to the documentation, CAAnimationGroup allows you to group and run multiple animations at the same time. But according to my (early) experiments, this can also be achieved by adding several animation objects to the target layer. If so, what is the purpose of this CAAnimationGroup?

+8
ios iphone core-animation
source share
2 answers

If you want to animate two different properties with different synchronization functions, then grouping these animations is not necessary in this case. I think grouping is useful when you create multiple animations and want them to have the same temporary behavior. You can set the synchronization function for the group. In the Core Animation Cookbook, I saw an example that showed how to use grouping when setting the time curve for CAKeyframeAnimation.

+4
source share

The following quote from the book "iOS Core Animation"

Adding an animation group to a layer does not fundamentally differ from adding animations separately, so it is not immediately clear when or why you will use this class. This gives some convenience in terms of the possibility of collective setting the duration of the animation or adding and removing several animations from the layer with a single command, but its usefulness only becomes apparent when it comes to hierarchical time, which is explained in Chapter 9.

0
source share

All Articles