Skip to content

Commit

Permalink
Merge branch 'nicopasso-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimon Tsinteris committed May 2, 2014
2 parents 701b47d + 87695bb commit ad03259
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 39 deletions.
5 changes: 5 additions & 0 deletions pop/POPAnimatableProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,9 @@ extern NSString * const kPOPTableViewContentSize;
*/
extern NSString * const kPOPNavigationBarBarTintColor;

/**
Common UITabBar property names.
*/
extern NSString * const kPOPTabBarBarTintColor;

#endif
96 changes: 57 additions & 39 deletions pop/POPAnimatableProperty.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@
#import <AppKit/NSLayoutConstraint.h>
#endif

// common threshold definitions
static CGFloat const kPOPThresholdColor = 0.01;
static CGFloat const kPOPThresholdPoint = 1.0;
static CGFloat const kPOPThresholdOpacity = 0.01;
static CGFloat const kPOPThresholdScale = 0.005;
static CGFloat const kPOPThresholdRotation = 0.01;

#pragma mark - Static

// CALayer
NSString * const kPOPLayerBackgroundColor = @"backgroundColor";
NSString * const kPOPLayerBounds = @"bounds";
NSString * const kPOPLayerOpacity = @"opacity";
Expand All @@ -47,12 +55,15 @@
NSString * const kPOPLayerTranslationZ = @"translationZ";
NSString * const kPOPLayerZPosition = @"zPosition";

// CAShapeLayer
NSString * const kPOPShapeLayerStrokeStart = @"shapeLayer.strokeStart";
NSString * const kPOPShapeLayerStrokeEnd = @"shapeLayer.strokeEnd";
NSString * const kPOPShapeLayerStrokeColor = @"shapeLayer.strokeColor";

// NSLayoutConstraint
NSString * const kPOPLayoutConstraintConstant = @"layoutConstraint.constant";

// UIView
NSString * const kPOPViewAlpha = @"view.alpha";
NSString * const kPOPViewBackgroundColor = @"view.backgroundColor";
NSString * const kPOPViewBounds = kPOPLayerBounds;
Expand All @@ -63,14 +74,19 @@
NSString * const kPOPViewScaleY = @"view.scaleY";
NSString * const kPOPViewSize = kPOPLayerSize;

// UIScrollView
NSString * const kPOPScrollViewContentOffset = @"scrollView.contentOffset";
NSString * const kPOPScrollViewContentSize = @"scrollView.contentSize";

// alias UIScrollView
// UITableView
NSString * const kPOPTableViewContentOffset = kPOPScrollViewContentOffset;
NSString * const kPOPTableViewContentSize = kPOPScrollViewContentSize;

NSString * const kPOPNavigationBarBarTintColor = @"barTintColor";
// UINavigationBar
NSString * const kPOPNavigationBarBarTintColor = @"navigationBar.barTintColor";

// UITabBar
NSString * const kPOPTabBarBarTintColor = kPOPNavigationBarBarTintColor;

/**
State structure internal to static animatable property.
Expand All @@ -80,7 +96,7 @@
NSString *name;
pop_animatable_read_block readBlock;
pop_animatable_write_block writeBlock;
float threshold;
CGFloat threshold;
} _POPStaticAnimatablePropertyState;
typedef _POPStaticAnimatablePropertyState POPStaticAnimatablePropertyState;

Expand All @@ -97,7 +113,7 @@
[obj setBackgroundColor:color];
CGColorRelease(color);
},
0.01
kPOPThresholdColor
},

{kPOPLayerBounds,
Expand All @@ -107,7 +123,7 @@
^(CALayer *obj, const CGFloat values[]) {
[obj setBounds:values_to_rect(values)];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerPosition,
Expand All @@ -117,7 +133,7 @@
^(CALayer *obj, const CGFloat values[]) {
[obj setPosition:values_to_point(values)];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerPositionX,
Expand All @@ -129,7 +145,7 @@
p.x = values[0];
[obj setPosition:p];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerPositionY,
Expand All @@ -141,7 +157,7 @@
p.y = values[0];
[obj setPosition:p];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerOpacity,
Expand All @@ -151,7 +167,7 @@
^(CALayer *obj, const CGFloat values[]) {
[obj setOpacity:((float)values[0])];
},
0.01
kPOPThresholdOpacity
},

{kPOPLayerScaleX,
Expand All @@ -161,7 +177,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetScaleX(obj, values[0]);
},
0.005
kPOPThresholdScale
},

{kPOPLayerScaleY,
Expand All @@ -171,7 +187,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetScaleY(obj, values[0]);
},
0.005
kPOPThresholdScale
},

{kPOPLayerScaleXY,
Expand All @@ -181,7 +197,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetScaleXY(obj, values_to_point(values));
},
0.005
kPOPThresholdScale
},

{kPOPLayerSubscaleXY,
Expand All @@ -191,7 +207,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetSubScaleXY(obj, values_to_point(values));
},
0.005
kPOPThresholdScale
},

{kPOPLayerTranslationX,
Expand All @@ -201,7 +217,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetTranslationX(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerTranslationY,
Expand All @@ -211,7 +227,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetTranslationY(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerTranslationZ,
Expand All @@ -221,7 +237,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetTranslationZ(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerTranslationXY,
Expand All @@ -231,7 +247,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetTranslationXY(obj, values_to_point(values));
},
1.0
kPOPThresholdPoint
},

{kPOPLayerSubtranslationX,
Expand All @@ -241,7 +257,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetSubTranslationX(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerSubtranslationY,
Expand All @@ -251,7 +267,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetSubTranslationY(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerSubtranslationZ,
Expand All @@ -261,7 +277,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetSubTranslationZ(obj, values[0]);
},
1.0
kPOPThresholdPoint
},

{kPOPLayerSubtranslationXY,
Expand All @@ -271,7 +287,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetSubTranslationXY(obj, values_to_point(values));
},
1.0
kPOPThresholdPoint
},

{kPOPLayerZPosition,
Expand All @@ -281,7 +297,7 @@
^(CALayer *obj, const CGFloat values[]) {
[obj setZPosition:values[0]];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerSize,
Expand All @@ -297,7 +313,7 @@
b.size = size;
[obj setBounds:b];
},
1.0
kPOPThresholdPoint
},

{kPOPLayerRotation,
Expand All @@ -307,7 +323,7 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetRotation(obj, values[0]);
},
0.01
kPOPThresholdRotation
},

{kPOPLayerRotationY,
Expand All @@ -317,7 +333,7 @@
^(id obj, const CGFloat values[]) {
POPLayerSetRotationY(obj, values[0]);
},
0.01
kPOPThresholdRotation
},

{kPOPLayerRotationX,
Expand All @@ -327,9 +343,11 @@
^(CALayer *obj, const CGFloat values[]) {
POPLayerSetRotationX(obj, values[0]);
},
0.01
kPOPThresholdRotation
},


/* CAShapeLayer */

{kPOPShapeLayerStrokeStart,
^(CAShapeLayer *obj, CGFloat values[]) {
values[0] = obj.strokeStart;
Expand Down Expand Up @@ -359,7 +377,7 @@
[obj setStrokeColor:color];
CGColorRelease(color);
},
0.01
kPOPThresholdColor
},

{kPOPLayoutConstraintConstant,
Expand All @@ -383,7 +401,7 @@
^(UIView *obj, const CGFloat values[]) {
obj.alpha = values[0];
},
1.0
kPOPThresholdOpacity
},

{kPOPViewBackgroundColor,
Expand All @@ -393,7 +411,7 @@
^(UIView *obj, const CGFloat values[]) {
obj.backgroundColor = POPUIColorRGBACreate(values);
},
1.0
kPOPThresholdColor
},

{kPOPViewCenter,
Expand All @@ -403,7 +421,7 @@
^(UIView *obj, const CGFloat values[]) {
obj.center = values_to_point(values);
},
1.0
kPOPThresholdPoint
},

{kPOPViewFrame,
Expand All @@ -413,7 +431,7 @@
^(UIView *obj, const CGFloat values[]) {
obj.frame = values_to_rect(values);
},
1.0
kPOPThresholdPoint
},

{kPOPViewScaleX,
Expand All @@ -423,7 +441,7 @@
^(UIView *obj, const CGFloat values[]) {
POPLayerSetScaleX(obj.layer, values[0]);
},
0.005
kPOPThresholdScale
},

{kPOPViewScaleY,
Expand All @@ -433,7 +451,7 @@
^(UIView *obj, const CGFloat values[]) {
POPLayerSetScaleY(obj.layer, values[0]);
},
0.005
kPOPThresholdScale
},

{kPOPViewScaleXY,
Expand All @@ -443,7 +461,7 @@
^(UIView *obj, const CGFloat values[]) {
POPLayerSetScaleXY(obj.layer, values_to_point(values));
},
0.005
kPOPThresholdScale
},

/* UIScrollView */
Expand All @@ -455,7 +473,7 @@
^(UIScrollView *obj, const CGFloat values[]) {
obj.contentOffset = values_to_point(values);
},
1.0
kPOPThresholdPoint
},

{kPOPScrollViewContentSize,
Expand All @@ -465,7 +483,7 @@
^(UIScrollView *obj, const CGFloat values[]) {
obj.contentSize = values_to_size(values);
},
1.0
kPOPThresholdPoint
},

/* UINavigationBar */
Expand All @@ -477,8 +495,8 @@
^(UINavigationBar *obj, const CGFloat values[]) {
obj.barTintColor = POPUIColorRGBACreate(values);
},
1.0
}
kPOPThresholdColor
},

#endif

Expand Down

0 comments on commit ad03259

Please sign in to comment.