Skip to content

Commit

Permalink
Updated README.
Browse files Browse the repository at this point in the history
  • Loading branch information
caylanlarson committed Feb 22, 2014
1 parent 042a4f7 commit a9e0a6e
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
08D45AB418B8F22800B7155D /* AngleGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08D45AB318B8F22800B7155D /* AngleGradientView.m */; };
08D45AB718B935AC00B7155D /* UserControl7.m in Sources */ = {isa = PBXBuildFile; fileRef = 08D45AB618B935AC00B7155D /* UserControl7.m */; };
C40F40D614E71A7B00566C8F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C40F40D514E71A7B00566C8F /* UIKit.framework */; };
C40F40D814E71A7B00566C8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C40F40D714E71A7B00566C8F /* Foundation.framework */; };
C40F40DA14E71A7B00566C8F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C40F40D914E71A7B00566C8F /* CoreGraphics.framework */; };
Expand All @@ -29,6 +30,8 @@
/* Begin PBXFileReference section */
08D45AB218B8F22800B7155D /* AngleGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AngleGradientView.h; sourceTree = "<group>"; };
08D45AB318B8F22800B7155D /* AngleGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AngleGradientView.m; sourceTree = "<group>"; };
08D45AB518B935AC00B7155D /* UserControl7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserControl7.h; sourceTree = "<group>"; };
08D45AB618B935AC00B7155D /* UserControl7.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserControl7.m; sourceTree = "<group>"; };
C40F40D114E71A7B00566C8F /* AngleGradientSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AngleGradientSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
C40F40D514E71A7B00566C8F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
C40F40D714E71A7B00566C8F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -143,6 +146,8 @@
C40F410B14E7693400566C8F /* UserControl5.m */,
C49C2FB114E7E9D200E36420 /* UserControl6.h */,
C49C2FB214E7E9D200E36420 /* UserControl6.m */,
08D45AB518B935AC00B7155D /* UserControl7.h */,
08D45AB618B935AC00B7155D /* UserControl7.m */,
);
name = Samples;
sourceTree = "<group>";
Expand Down Expand Up @@ -230,6 +235,7 @@
C40F410214E75C9A00566C8F /* UserControl2.m in Sources */,
C40F410514E761FD00566C8F /* UserControl3.m in Sources */,
C40F410814E7663100566C8F /* UserControl4.m in Sources */,
08D45AB718B935AC00B7155D /* UserControl7.m in Sources */,
C40F410C14E7693400566C8F /* UserControl5.m in Sources */,
C49C2FB314E7E9D200E36420 /* UserControl6.m in Sources */,
C4B07AED176355AE004FA222 /* AngleGradientLayer.m in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions AngleGradientSample/AngleGradientSample/SampleController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "UserControl4.h"
#import "UserControl5.h"
#import "UserControl6.h"
#import "UserControl7.h"


@interface SampleController()
Expand Down Expand Up @@ -79,6 +80,9 @@ - (void)loadView
UserControl6 *uc6 = [[UserControl6 alloc] initWithFrame:CGRectMake(-10, 225, 135, 135)];
[v addSubview:uc6];

UserControl7 *uc7 = [[UserControl7 alloc] initWithFrame:CGRectMake(50, 75, 90, 90)];
[v addSubview:uc7];

v.contentSize = uc1.frame.size;
self.view = v;
}
Expand Down
13 changes: 13 additions & 0 deletions AngleGradientSample/AngleGradientSample/UserControl7.h
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
55 changes: 55 additions & 0 deletions AngleGradientSample/AngleGradientSample/UserControl7.m
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
16 changes: 5 additions & 11 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,25 @@ h2. AngleGradientLayer

*AngleGradientLayer* is a *CALayer* implementation of angle gradient.

!https://github.com/paiv/AngleGradientLayer/raw/master/screenshot.png(screenshot)!
!screenshot.jpg(screenshot)!

h2. Sample usage with UIView
h2. Sample usage with AngleGradientView

(See demo project for more.)

bc.. #import "AngleGradientLayer.h"
bc.. #import "AngleGradientView.h"

@interface MyView : UIView
@interface MyView : AngleGradientView
@end

@implementation MyView

+ (Class)layerClass
{
return [AngleGradientLayer class];
}

- (id)initWithFrame:(CGRect)frame
{
if (!(self = [super initWithFrame:frame]))
return nil;

AngleGradientLayer *l = (AngleGradientLayer *)self.layer;
l.colors = [NSArray arrayWithObjects:
self.colors = [NSArray arrayWithObjects:
(id)[UIColor colorWithRed:0 green:0 blue:0.5 alpha:1].CGColor,
(id)[UIColor colorWithRed:1 green:1 blue:0.4 alpha:1].CGColor,
nil];
Expand Down
Binary file added screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a9e0a6e

Please sign in to comment.