开发者

CAAnimationGroup with different interface elements

开发者 https://www.devze.com 2023-01-13 03:09 出处:网络
I want to crossfade two NSViews and resize their NSWindow. I know how to do them 开发者_如何学Goseparately but so far not how to do it simultaneously. I think I need a CAAnimationGroup for it. But bec

I want to crossfade two NSViews and resize their NSWindow. I know how to do them 开发者_如何学Goseparately but so far not how to do it simultaneously. I think I need a CAAnimationGroup for it. But because I'm dealing with two different objects, I don't know how to add the two animations in the group and I don't know how to start the animation because I can't call animator on them both.


you should use a CATransaction to do this. all animations are grouped with CATransactions, either implicitly or explicitly, check the docs for more details. Just use something like:

[CATransaction begin];
[CATransaction setAnimationDuration:1.0];
[CATransaction setAnimationTimingFunction:whatever];

 // adjust layer properties here for required animations

[CATransaction commit];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号