Created
June 8, 2015 15:17
-
-
Save nakiostudio/9dc1d8eed7f6540540a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)reloadAnimated:(BOOL)animated withCompletionBlock:(void(^)())completionBlock | |
{ | |
FWTPieChartLayer *pieLayer = self.containerLayer.sublayers.firstObject; | |
[CATransaction begin]; | |
[CATransaction setCompletionBlock:completionBlock]; | |
[CATransaction setDisableActions:YES]; | |
CABasicAnimation *animation = (CABasicAnimation *)[pieLayer actionForKey:@"animationCompletionPercent"]; | |
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
animation.duration = self.animationDuration; | |
animation.fromValue = animated ? @0.f : @1.f; | |
animation.toValue = @1.f; | |
animation.byValue = @0.1f; | |
[pieLayer setAnimationCompletionPercent:((NSNumber*)animation.toValue).floatValue]; | |
[pieLayer addAnimation:animation forKey:@"animationCompletionPercent"]; | |
[CATransaction commit]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment