Skip to content

Commit

Permalink
Set up NSAnimationContext groupings in parallel with TUIView animatio…
Browse files Browse the repository at this point in the history
…ns, so that any direct NSView changes are animated in parallel
  • Loading branch information
jspahrsummers committed Jul 19, 2012
1 parent ad2bb97 commit 585ca4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/UIKit/TUIView+Animation.m
Expand Up @@ -145,6 +145,8 @@ + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))


+ (void)beginAnimations:(NSString *)animationID context:(void *)context + (void)beginAnimations:(NSString *)animationID context:(void *)context
{ {
[NSAnimationContext beginGrouping];

TUIViewAnimation *animation = [[TUIViewAnimation alloc] init]; TUIViewAnimation *animation = [[TUIViewAnimation alloc] init];
animation.context = context; animation.context = context;
animation.animationID = animationID; animation.animationID = animationID;
Expand All @@ -160,6 +162,7 @@ + (void)beginAnimations:(NSString *)animationID context:(void *)context
+ (void)commitAnimations + (void)commitAnimations
{ {
[[self _animationStack] removeLastObject]; [[self _animationStack] removeLastObject];
[NSAnimationContext endGrouping];


// NSLog(@"--- %d", [[self _animationStack] count]); // NSLog(@"--- %d", [[self _animationStack] count]);
} }
Expand Down Expand Up @@ -188,7 +191,9 @@ static CGFloat SlomoTime()


+ (void)setAnimationDuration:(NSTimeInterval)duration + (void)setAnimationDuration:(NSTimeInterval)duration
{ {
[self _currentAnimation].basicAnimation.duration = duration * SlomoTime(); duration *= SlomoTime();
[self _currentAnimation].basicAnimation.duration = duration;
[NSAnimationContext currentContext].duration = duration;
} }


+ (void)setAnimationDelay:(NSTimeInterval)delay // default = 0.0 + (void)setAnimationDelay:(NSTimeInterval)delay // default = 0.0
Expand Down

0 comments on commit 585ca4a

Please sign in to comment.