|
| 1 | +/** |
| 2 | + Copyright (c) 2014-present, Facebook, Inc. |
| 3 | + All rights reserved. |
| 4 | + |
| 5 | + This source code is licensed under the BSD-style license found in the |
| 6 | + LICENSE file in the root directory of this source tree. An additional grant |
| 7 | + of patent rights can be found in the PATENTS file in the same directory. |
| 8 | + */ |
| 9 | + |
| 10 | +#import <CoreGraphics/CoreGraphics.h> |
| 11 | +#import <Foundation/NSObject.h> |
| 12 | + |
| 13 | +@class POPMutableAnimatableProperty; |
| 14 | + |
| 15 | +/** |
| 16 | + @abstract Describes an animatable property. |
| 17 | + */ |
| 18 | +@interface POPAnimatableProperty : NSObject <NSCopying, NSMutableCopying> |
| 19 | + |
| 20 | +/** |
| 21 | + @abstract Property accessor. |
| 22 | + @param name The name of the property. |
| 23 | + @return The animatable property with that name or nil if it does not exist. |
| 24 | + @discussion Common animatable properties are included by default. Use the provided constants to reference. |
| 25 | + */ |
| 26 | ++ (id)propertyWithName:(NSString *)name; |
| 27 | + |
| 28 | +/** |
| 29 | + @abstract The designated initializer. |
| 30 | + @param name The name of the property. |
| 31 | + @param block The block used to configure the property on creation. |
| 32 | + @return The animatable property with name if it exists, otherwise a newly created instance configured by block. |
| 33 | + @discussion Custom properties should use reverse-DNS naming. A newly created instance is only mutable in the scope of block. Once constructed, a property becomes immutable. |
| 34 | + */ |
| 35 | ++ (id)propertyWithName:(NSString *)name initializer:(void (^)(POPMutableAnimatableProperty *prop))block; |
| 36 | + |
| 37 | +/** |
| 38 | + @abstract The name of the property. |
| 39 | + @discussion Used to uniquely identify an animatable property. |
| 40 | + */ |
| 41 | +@property (readonly, nonatomic, copy) NSString *name; |
| 42 | + |
| 43 | +/** |
| 44 | + @abstract Block used to read values from a property into an array of floats. |
| 45 | + */ |
| 46 | +@property (readonly, nonatomic, copy) void (^readBlock)(id obj, CGFloat values[]); |
| 47 | + |
| 48 | +/** |
| 49 | + @abstract Block used to write values from an array of floats into a property. |
| 50 | + */ |
| 51 | +@property (readonly, nonatomic, copy) void (^writeBlock)(id obj, const CGFloat values[]); |
| 52 | + |
| 53 | +/** |
| 54 | + @abstract The threshold value used when determining completion of dynamics simulations. |
| 55 | + */ |
| 56 | +@property (readonly, nonatomic, assign) CGFloat threshold; |
| 57 | + |
| 58 | +@end |
| 59 | + |
| 60 | +/** |
| 61 | + @abstract A mutable animatable property intended for configuration. |
| 62 | + */ |
| 63 | +@interface POPMutableAnimatableProperty : POPAnimatableProperty |
| 64 | + |
| 65 | +/** |
| 66 | + @abstract A read-write version of POPAnimatableProperty name property. |
| 67 | + */ |
| 68 | +@property (readwrite, nonatomic, copy) NSString *name; |
| 69 | + |
| 70 | +/** |
| 71 | + @abstract A read-write version of POPAnimatableProperty readBlock property. |
| 72 | + */ |
| 73 | +@property (readwrite, nonatomic, copy) void (^readBlock)(id obj, CGFloat values[]); |
| 74 | + |
| 75 | +/** |
| 76 | + @abstract A read-write version of POPAnimatableProperty writeBlock property. |
| 77 | + */ |
| 78 | +@property (readwrite, nonatomic, copy) void (^writeBlock)(id obj, const CGFloat values[]); |
| 79 | + |
| 80 | +/** |
| 81 | + @abstract A read-write version of POPAnimatableProperty threshold property. |
| 82 | + */ |
| 83 | +@property (readwrite, nonatomic, assign) CGFloat threshold; |
| 84 | + |
| 85 | +@end |
| 86 | + |
| 87 | +/** |
| 88 | + Common CALayer property names. |
| 89 | + */ |
| 90 | +extern NSString * const kPOPLayerBackgroundColor; |
| 91 | +extern NSString * const kPOPLayerBounds; |
| 92 | +extern NSString * const kPOPLayerOpacity; |
| 93 | +extern NSString * const kPOPLayerPosition; |
| 94 | +extern NSString * const kPOPLayerPositionX; |
| 95 | +extern NSString * const kPOPLayerPositionY; |
| 96 | +extern NSString * const kPOPLayerRotation; |
| 97 | +extern NSString * const kPOPLayerRotationX; |
| 98 | +extern NSString * const kPOPLayerRotationY; |
| 99 | +extern NSString * const kPOPLayerScaleX; |
| 100 | +extern NSString * const kPOPLayerScaleXY; |
| 101 | +extern NSString * const kPOPLayerScaleY; |
| 102 | +extern NSString * const kPOPLayerSize; |
| 103 | +extern NSString * const kPOPLayerSubscaleXY; |
| 104 | +extern NSString * const kPOPLayerSubtranslationX; |
| 105 | +extern NSString * const kPOPLayerSubtranslationXY; |
| 106 | +extern NSString * const kPOPLayerSubtranslationY; |
| 107 | +extern NSString * const kPOPLayerSubtranslationZ; |
| 108 | +extern NSString * const kPOPLayerTranslationX; |
| 109 | +extern NSString * const kPOPLayerTranslationXY; |
| 110 | +extern NSString * const kPOPLayerTranslationY; |
| 111 | +extern NSString * const kPOPLayerTranslationZ; |
| 112 | +extern NSString * const kPOPLayerZPosition; |
| 113 | + |
| 114 | + |
| 115 | +/** |
| 116 | + Common NSLayoutConstraint property names. |
| 117 | + */ |
| 118 | +extern NSString * const kPOPLayoutConstraintConstant; |
| 119 | + |
| 120 | + |
| 121 | +#if TARGET_OS_IPHONE |
| 122 | + |
| 123 | +/** |
| 124 | + Common UIView property names. |
| 125 | + */ |
| 126 | +extern NSString * const kPOPViewAlpha; |
| 127 | +extern NSString * const kPOPViewBackgroundColor; |
| 128 | +extern NSString * const kPOPViewBounds; |
| 129 | +extern NSString * const kPOPViewCenter; |
| 130 | +extern NSString * const kPOPViewFrame; |
| 131 | +extern NSString * const kPOPViewScaleX; |
| 132 | +extern NSString * const kPOPViewScaleXY; |
| 133 | +extern NSString * const kPOPViewScaleY; |
| 134 | +extern NSString * const kPOPViewSize; |
| 135 | + |
| 136 | + |
| 137 | +/** |
| 138 | + Common UITableView property names. |
| 139 | + */ |
| 140 | +extern NSString * const kPOPTableViewContentOffset; |
| 141 | +extern NSString * const kPOPTableViewContentSize; |
| 142 | + |
| 143 | + |
| 144 | +#endif |
0 commit comments