LOTValueCallback.m
2.6 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
//
// LOTValueCallback.m
// Lottie
//
// Created by brandon_withrow on 12/15/17.
// Copyright © 2017 Airbnb. All rights reserved.
//
#import "LOTValueCallback.h"
@implementation LOTColorValueCallback
+ (instancetype _Nonnull)withCGColor:(CGColorRef _Nonnull)color {
LOTColorValueCallback *colorCallback = [[self alloc] init];
colorCallback.colorValue = color;
return colorCallback;
}
- (CGColorRef)colorForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor currentColor:(CGColorRef)interpolatedColor {
return self.colorValue;
}
@end
@implementation LOTNumberValueCallback
+ (instancetype _Nonnull)withFloatValue:(CGFloat)numberValue {
LOTNumberValueCallback *numberCallback = [[self alloc] init];
numberCallback.numberValue = numberValue;
return numberCallback;
}
- (CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue {
return self.numberValue;
}
@end
@implementation LOTPointValueCallback
+ (instancetype _Nonnull)withPointValue:(CGPoint)pointValue {
LOTPointValueCallback *callback = [[self alloc] init];
callback.pointValue = pointValue;
return callback;
}
- (CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint {
return self.pointValue;
}
@end
@implementation LOTSizeValueCallback
+ (instancetype _Nonnull)withPointValue:(CGSize)sizeValue {
LOTSizeValueCallback *callback = [[self alloc] init];
callback.sizeValue = sizeValue;
return callback;
}
- (CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize {
return self.sizeValue;
}
@end
@implementation LOTPathValueCallback
+ (instancetype _Nonnull)withCGPath:(CGPathRef _Nonnull)path {
LOTPathValueCallback *callback = [[self alloc] init];
callback.pathValue = path;
return callback;
}
- (CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress {
return self.pathValue;
}
@end