LOTBlockCallback.h
9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// LOTBlockCallback.h
// Lottie
//
// Created by brandon_withrow on 12/15/17.
// Copyright © 2017 Airbnb. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import "LOTValueDelegate.h"
/*!
@brief A block that is used to change a Color value at keytime, the block is called continuously for a keypath while the animation plays.
@param currentFrame The current frame of the animation in the parent compositions time space.
@param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time.
@param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time.
@param interpolatedProgress A value from 0-1 that represents the current progress between keyframes. It respects the keyframes current easing curves.
@param startColor The color from the previous keyframe in relation to the current time.
@param endColor The color from the next keyframe in relation to the current time.
@param interpolatedColor The color interpolated at the current time between startColor and endColor. This represents the keypaths current color for the current time.
@return CGColorRef the color to set the keypath node for the current frame
*/
typedef CGColorRef _Nonnull (^LOTColorValueCallbackBlock)(CGFloat currentFrame,
CGFloat startKeyFrame,
CGFloat endKeyFrame,
CGFloat interpolatedProgress,
CGColorRef _Nullable startColor,
CGColorRef _Nullable endColor,
CGColorRef _Nullable interpolatedColor);
/*!
@brief A block that is used to change a Number value at keytime, the block is called continuously for a keypath while the animation plays.
@param currentFrame The current frame of the animation in the parent compositions time space.
@param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time.
@param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time.
@param interpolatedProgress A value from 0-1 that represents the current progress between keyframes. It respects the keyframes current easing curves.
@param startValue The Number from the previous keyframe in relation to the current time.
@param endValue The Number from the next keyframe in relation to the current time.
@param interpolatedValue The Number interpolated at the current time between startValue and endValue. This represents the keypaths current Number for the current time.
@return CGFloat the number to set the keypath node for the current frame
*/
typedef CGFloat (^LOTNumberValueCallbackBlock)(CGFloat currentFrame,
CGFloat startKeyFrame,
CGFloat endKeyFrame,
CGFloat interpolatedProgress,
CGFloat startValue,
CGFloat endValue,
CGFloat interpolatedValue);
/*!
@brief A block that is used to change a Point value at keytime, the block is called continuously for a keypath while the animation plays.
@param currentFrame The current frame of the animation in the parent compositions time space.
@param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time.
@param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time.
@param interpolatedProgress A value from 0-1 that represents the current progress between keyframes. It respects the keyframes current easing curves.
@param startPoint The Point from the previous keyframe in relation to the current time.
@param endPoint The Point from the next keyframe in relation to the current time.
@param interpolatedPoint The Point interpolated at the current time between startPoint and endPoint. This represents the keypaths current Point for the current time.
@return CGPoint the point to set the keypath node for the current frame.
*/
typedef CGPoint (^LOTPointValueCallbackBlock)(CGFloat currentFrame,
CGFloat startKeyFrame,
CGFloat endKeyFrame,
CGFloat interpolatedProgress,
CGPoint startPoint,
CGPoint endPoint,
CGPoint interpolatedPoint);
/*!
@brief A block that is used to change a Size value at keytime, the block is called continuously for a keypath while the animation plays.
@param currentFrame The current frame of the animation in the parent compositions time space.
@param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time.
@param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time.
@param interpolatedProgress A value from 0-1 that represents the current progress between keyframes. It respects the keyframes current easing curves.
@param startSize The Size from the previous keyframe in relation to the current time.
@param endSize The Size from the next keyframe in relation to the current time.
@param interpolatedSize The Size interpolated at the current time between startSize and endSize. This represents the keypaths current Size for the current time.
@return CGSize the size to set the keypath node for the current frame.
*/
typedef CGSize (^LOTSizeValueCallbackBlock)(CGFloat currentFrame,
CGFloat startKeyFrame,
CGFloat endKeyFrame,
CGFloat interpolatedProgress,
CGSize startSize,
CGSize endSize,
CGSize interpolatedSize);
/*!
@brief A block that is used to change a Path value at keytime, the block is called continuously for a keypath while the animation plays.
@param currentFrame The current frame of the animation in the parent compositions time space.
@param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time.
@param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time.
@param interpolatedProgress A value from 0-1 that represents the current progress between keyframes. It respects the keyframes current easing curves.
@return UIBezierPath the path to set the keypath node for the current frame.
*/
typedef CGPathRef _Nonnull (^LOTPathValueCallbackBlock)(CGFloat currentFrame,
CGFloat startKeyFrame,
CGFloat endKeyFrame,
CGFloat interpolatedProgress);
/*!
@brief LOTColorValueCallback is wrapper around a LOTColorValueCallbackBlock. This block can be used in conjunction with LOTAnimationView setValueDelegate:forKeypath to dynamically change an animation's color keypath at runtime.
*/
@interface LOTColorBlockCallback : NSObject <LOTColorValueDelegate>
+ (instancetype _Nonnull)withBlock:(LOTColorValueCallbackBlock _Nonnull )block NS_SWIFT_NAME(init(block:));
@property (nonatomic, copy, nonnull) LOTColorValueCallbackBlock callback;
@end
/*!
@brief LOTNumberValueCallback is wrapper around a LOTNumberValueCallbackBlock. This block can be used in conjunction with LOTAnimationView setValueDelegate:forKeypath to dynamically change an animation's number keypath at runtime.
*/
@interface LOTNumberBlockCallback : NSObject <LOTNumberValueDelegate>
+ (instancetype _Nonnull)withBlock:(LOTNumberValueCallbackBlock _Nonnull)block NS_SWIFT_NAME(init(block:));
@property (nonatomic, copy, nonnull) LOTNumberValueCallbackBlock callback;
@end
/*!
@brief LOTPointValueCallback is wrapper around a LOTPointValueCallbackBlock. This block can be used in conjunction with LOTAnimationView setValueDelegate:forKeypath to dynamically change an animation's point keypath at runtime.
*/
@interface LOTPointBlockCallback : NSObject <LOTPointValueDelegate>
+ (instancetype _Nonnull)withBlock:(LOTPointValueCallbackBlock _Nonnull)block NS_SWIFT_NAME(init(block:));
@property (nonatomic, copy, nonnull) LOTPointValueCallbackBlock callback;
@end
/*!
@brief LOTSizeValueCallback is wrapper around a LOTSizeValueCallbackBlock. This block can be used in conjunction with LOTAnimationView setValueDelegate:forKeypath to dynamically change an animation's size keypath at runtime.
*/
@interface LOTSizeBlockCallback : NSObject <LOTSizeValueDelegate>
+ (instancetype _Nonnull)withBlock:(LOTSizeValueCallbackBlock _Nonnull)block NS_SWIFT_NAME(init(block:));
@property (nonatomic, copy, nonnull) LOTSizeValueCallbackBlock callback;
@end
/*!
@brief LOTPathValueCallback is wrapper around a LOTPathValueCallbackBlock. This block can be used in conjunction with LOTAnimationView setValueDelegate:forKeypath to dynamically change an animation's path keypath at runtime.
*/
@interface LOTPathBlockCallback : NSObject <LOTPathValueDelegate>
+ (instancetype _Nonnull)withBlock:(LOTPathValueCallbackBlock _Nonnull)block NS_SWIFT_NAME(init(block:));
@property (nonatomic, copy, nonnull) LOTPathValueCallbackBlock callback;
@end