I have this code to animate a CALayer element.
CABasicAnimation *makeBiggerAnim=[CABasicAnimation animationWithKeyPath:@"radius"];
makeBiggerAnim.duration=0.2;
makeBiggerAnim.fromValue=[NSNumber numberWithDouble:20.0];
makeBiggerAnim.toValue=[NSNumber numberWithDouble:40.0];
makeBiggerAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
My question is, now everything works fine, I would like another attribute of the same element at the same time. I’ve seen you can do additive animations and stuff.
My question is:
- Is the additive attribute the best / only way to do that? (animating at once multiple properties of the same object at once )
Thanks!
You can create an
CAAnimationGroupand customize the duration and timing function on it. Then you create all yourCABasicAnimations, set their to value and add them to the animation group. Finally, you add the animation group to the layer that you are animating.Here an example: