multiple CAKeyframeAnimation in different layers at the same time

老子叫甜甜 提交于 2019-12-05 09:32:13

If you want to group a series of animations like this, so that they are guaranteed to be synchronized, you could wrap them in a CATransaction:

[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:2.0] forKey:kCATransactionAnimationDuration];     

// Do animations

[CATransaction commit];     

However, I'm not quite sure why the code you've written doesn't fire off the correct animations for each layer, even if they weren't synchronized.

Note that by setting removedOnCompletion to YES, your animation will run and then the object will hop back to its starting point at the end. You probably want that to be NO.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!