Wednesday, June 12, 2013

CATransaction animationDuration example in Objective C (iOS).

CATransaction animationDuration

Returns the animation duration used by all animations within this transaction group.

+ (CFTimeInterval)animationDuration

Return Value
An interval of time used as the duration.

Discussion of [CATransaction animationDuration]
You can retrieve the animation duration for a specific transaction by calling the valueForKey: method of the transaction object and asking for the kCATransactionAnimationDuration key.

CATransaction animationDuration example.
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];
animation.duration = [CATransaction animationDuration];
animation.timingFunction = [CATransaction animationTimingFunction];
animation.fromValue = (id)oldPath;
animation.toValue = (id)path;
[self addAnimation:animation forKey:@"pathAnimation"];

Example of [CATransaction animationDuration].
Find out the animation duration of the current animation block
[CATransaction animationDuration] is what you're looking for


End of CATransaction animationDuration example article.