Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I combine multiple CAKeyframeAnimations into single keyframe animation?

Say I want to combine transform

CAKeyframeAnimation *animation = [CAKeyframeAnimation
   animationWithKeyPath:@"transform"];

and opacity

CAKeyframeAnimation *animation = [CAKeyframeAnimation
   animationWithKeyPath:@"opacity"];

into keyframe animation. How do I combine and specify transform/opacity values for each keyframe?

like image 686
Pablo Avatar asked Jan 29 '26 10:01

Pablo


1 Answers

Create two animations just like you do, use the same keyTimes for both of them, and add them both to the layer with addAnimation:forKey:. It's that easy.

like image 171
Michal Avatar answered Feb 01 '26 02:02

Michal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!