CATransaction ignores animationDuration executes completionBlock immediately
CATransaction ignores animationDuration executes completionBlock immediately
- Subject: CATransaction ignores animationDuration executes completionBlock immediately
- From: Markus Spoettl <email@hidden>
- Date: Tue, 22 Jul 2014 18:16:03 +0200
Hi,
I have view that animates layers using CATransaction with nested animations
in their respective completion blocks. For some reason the outermost transaction
consistently ignores the animation duration and calls the completion block
immediately after the transaction is committed.
What I'm trying to do is to animate my layer from
initialTransform -> expandedTransform -> normalTransform
What actually happens is that the layer goes directly to
expandedTransform -> normalTransform
completely omitting the animation from initialTransform -> expandedTransform
The actual code looks like this:
// setup transaction, no animation
[CATransaction begin];
[CATransaction setDisableActions:YES];
[CATransaction setCompletionBlock:^{
// reveal transaction step 1
[CATransaction begin];
[CATransaction setCompletionBlock:^{
// reveal transaction step 2
[CATransaction begin];
[CATransaction setCompletionBlock:^{
// do cleanup work here
}];
[CATransaction setAnimationTimingFunction:
[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[CATransaction setAnimationDuration:1.0];
[layer setTransform:normalTransform];
[CATransaction commit];
}];
[CATransaction setAnimationTimingFunction:
[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[CATransaction setAnimationDuration:1.0];
[layer setTransform:expandedTransform];
[CATransaction commit];
}];
[layer setBounds:someBounds];
[layer setPosition:somePosition];
[layer setTransform:initialTransform];
[CATransaction commit];
If I wrap the whole thing in another empty CATransaction, putting the code into
its completion block, it works.
What is the mistake here?
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden