Using Core Animation, is there a way to group animations for multiple CALayers?

I have a situation where I have a lot of CALayers who liven up the "step by step" way. I am animating a position on each of these CALayers, but they have the same duration. After all these CALayers have completed the animation, a new “turn” begins, and they again revive the changing positions.

The whole idea is that with linear interpolation between positions and at a constant speed, the transition based on the rotation between states into a state looks like a real-time animation. This, however, is difficult to achieve with many different CALayers.

CAAnimationGroup is used to group animations on one CALayer. But I was wondering if there is a simple solution for group animations, which should have the same duration, on several CALayers together?

Edited to include an answer to Kevin Ballard's question

My problem is this. I create animations for each of my CALayers, and then in NSArray. As soon as I get a callback that a separate animation has ended, I delete it from NSArray. When it is empty, I again create an animation for everyone.

With more than a few layers, there is a noticeable delay between where all the animations are completed and new ones begin.

I suppose that if I could combine all these animations into one, I could animate a lot more layers without delay between the animations. This does not destroy the illusion of adjacent animation.

+5
4

CALayers , () . - , , .

60 CALayers , , , .

CALayer . 60 .

, ( beginTime), CAAnimationGroup, .

+5

CATransaction, CG , .

[ CATransaction]; // [CATransaction commit];

+2

3 3 , , , . ?

0

cp21yos: can you talk about your method? I am trying to do something similar, which is related to animating several layers at a time, several times. You said, "At the end of the animation, I add the next stage of the animation." Can you explain this? When I try to put the logic for performing additional animations in the animationDidStop event, only the last animation appears, and not the entire sequence of animations.

0
source

All Articles