Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CAAnimationGroup with different interface elements

I want to crossfade two NSViews and resize their NSWindow. I know how to do them separately 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.

like image 816
Simon Avatar asked Aug 27 '10 12:08

Simon


1 Answers

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];
like image 120
Tark Avatar answered Sep 30 '22 11:09

Tark