Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AwesomeMenu/QuadCurveMenu/QuadCurveMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
@property (nonatomic, assign) CGFloat timeOffset;
@property (nonatomic, assign) CGFloat rotateAngle;
@property (nonatomic, assign) CGFloat menuWholeAngle;
@property (nonatomic, assign) CGFloat expandRotation;
@property (nonatomic, assign) CGFloat closeRotation;

- (id)initWithFrame:(CGRect)frame menus:(NSArray *)aMenusArray;
@end
Expand Down
10 changes: 7 additions & 3 deletions AwesomeMenu/QuadCurveMenu/QuadCurveMenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
static CGFloat const kQuadCurveMenuDefaultTimeOffset = 0.036f;
static CGFloat const kQuadCurveMenuDefaultRotateAngle = 0.0;
static CGFloat const kQuadCurveMenuDefaultMenuWholeAngle = M_PI * 2;
static CGFloat const kQuadCurveMenuDefaultExpandRotation = M_PI;
static CGFloat const kQuadCurveMenuDefaultCloseRotation = M_PI * 2;


static CGPoint RotateCGPointAroundCenter(CGPoint point, CGPoint center, float angle)
Expand All @@ -37,7 +39,7 @@ - (CAAnimationGroup *)_shrinkAnimationAtPoint:(CGPoint)p;

@implementation QuadCurveMenu

@synthesize nearRadius, endRadius, farRadius, timeOffset, rotateAngle, menuWholeAngle, startPoint;
@synthesize nearRadius, endRadius, farRadius, timeOffset, rotateAngle, menuWholeAngle, startPoint, expandRotation, closeRotation;
@synthesize expanding = _expanding;
@synthesize delegate = _delegate;
@synthesize menusArray = _menusArray;
Expand All @@ -56,6 +58,8 @@ - (id)initWithFrame:(CGRect)frame menus:(NSArray *)aMenusArray
self.rotateAngle = kQuadCurveMenuDefaultRotateAngle;
self.menuWholeAngle = kQuadCurveMenuDefaultMenuWholeAngle;
self.startPoint = CGPointMake(kQuadCurveMenuDefaultStartPointX, kQuadCurveMenuDefaultStartPointY);
self.expandRotation = kQuadCurveMenuDefaultExpandRotation;
self.closeRotation = kQuadCurveMenuDefaultCloseRotation;

// layout menus
self.menusArray = aMenusArray;
Expand Down Expand Up @@ -272,7 +276,7 @@ - (void)_expand
QuadCurveMenuItem *item = (QuadCurveMenuItem *)[self viewWithTag:tag];

CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
rotateAnimation.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:M_PI],[NSNumber numberWithFloat:0.0f], nil];
rotateAnimation.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:expandRotation],[NSNumber numberWithFloat:0.0f], nil];
rotateAnimation.duration = 0.5f;
rotateAnimation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:.3],
Expand Down Expand Up @@ -314,7 +318,7 @@ - (void)_close
QuadCurveMenuItem *item = (QuadCurveMenuItem *)[self viewWithTag:tag];

CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
rotateAnimation.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0f],[NSNumber numberWithFloat:M_PI * 2],[NSNumber numberWithFloat:0.0f], nil];
rotateAnimation.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0f],[NSNumber numberWithFloat:closeRotation],[NSNumber numberWithFloat:0.0f], nil];
rotateAnimation.duration = 0.5f;
rotateAnimation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:.0],
Expand Down