forked from paiv/AngleGradientLayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
042a4f7
commit a9e0a6e
Showing
6 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// UserControl7.h | ||
// AngleGradientSample | ||
// | ||
// Created by Caylan Larson on 2/22/14. | ||
// Copyright (c) 2014 Archer Software. All rights reserved. | ||
// | ||
|
||
#import "AngleGradientView.h" | ||
|
||
@interface UserControl7 : AngleGradientView | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// UserControl7.m | ||
// AngleGradientSample | ||
// | ||
// Created by Caylan Larson on 2/22/14. | ||
// Copyright (c) 2014 Archer Software. All rights reserved. | ||
// | ||
|
||
#import "UserControl7.h" | ||
#import "AngleGradientLayer.h" | ||
|
||
@implementation UserControl7 | ||
|
||
- (id)initWithFrame:(CGRect)frame | ||
{ | ||
if (!(self = [super initWithFrame:frame])) | ||
return nil; | ||
|
||
NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:4]; | ||
[colors addObject:(id)[UIColor whiteColor].CGColor]; | ||
[colors addObject:(id)[UIColor purpleColor].CGColor]; | ||
[colors addObject:(id)[UIColor yellowColor].CGColor]; | ||
[colors addObject:(id)[UIColor blackColor].CGColor]; | ||
[colors addObject:(id)[UIColor whiteColor].CGColor]; | ||
|
||
NSMutableArray *locations = [[NSMutableArray alloc] initWithCapacity:4]; | ||
[locations addObject:@(0)]; | ||
[locations addObject:@(.25)]; | ||
[locations addObject:@(0.5)]; | ||
[locations addObject:@(0.75)]; | ||
[locations addObject:@(1)]; | ||
|
||
self.colors = colors; | ||
self.locations = locations; | ||
|
||
UIBezierPath *bigCirclePath = [UIBezierPath bezierPathWithOvalInRect:self.bounds]; | ||
UIBezierPath *smallCirclePath = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(self.bounds, 20, 20)]; | ||
[bigCirclePath appendPath:smallCirclePath]; | ||
[bigCirclePath setUsesEvenOddFillRule:YES]; | ||
self.maskBezierPath = bigCirclePath; | ||
|
||
self.borderColor = [UIColor whiteColor]; | ||
self.borderWidth = 5; | ||
|
||
CABasicAnimation * spin = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | ||
spin.duration = 3; | ||
spin.toValue = [NSNumber numberWithFloat:-M_PI]; | ||
spin.cumulative = YES; | ||
spin.repeatCount = MAXFLOAT; | ||
[self.angleGradientLayer addAnimation:spin forKey:@"spin"]; | ||
|
||
return self; | ||
} | ||
|
||
@end |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.