Last active
August 29, 2015 14:00
-
-
Save armandocanals/7238f46db38a8ed290e8 to your computer and use it in GitHub Desktop.
This file contains 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) drawCountdownSpinner { | |
int radius = 70; | |
CAShapeLayer *circle = [CAShapeLayer layer]; | |
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) | |
cornerRadius:radius].CGPath; | |
circle.position = CGPointMake(CGRectGetMidX(self.view.frame)-radius, | |
CGRectGetMidY(self.view.frame)-radius-40); | |
circle.fillColor = [UIColor clearColor].CGColor; | |
circle.strokeColor = [UIColor whiteColor].CGColor; | |
circle.lineWidth = 5; | |
[_countdownView.layer addSublayer:circle]; | |
CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; | |
drawAnimation.duration = 15.0; | |
drawAnimation.repeatCount = 1.0; | |
drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; | |
drawAnimation.toValue = [NSNumber numberWithFloat:1.0f]; | |
drawAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; | |
[circle addAnimation:drawAnimation forKey:@"drawCircleAnimation"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment