forked from airbnb/lottie-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
brandon_withrow
committed
Jan 5, 2018
1 parent
4f4719d
commit ed54ece
Showing
29 changed files
with
717 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// LOTBlockCallback.m | ||
// Lottie | ||
// | ||
// Created by brandon_withrow on 12/15/17. | ||
// Copyright © 2017 Airbnb. All rights reserved. | ||
// | ||
|
||
#import "LOTBlockCallback.h" | ||
|
||
@implementation LOTColorBlockCallback | ||
|
||
+ (instancetype)withBlock:(LOTColorValueCallbackBlock)block { | ||
LOTColorBlockCallback *colorCallback = [[LOTColorBlockCallback alloc] init]; | ||
colorCallback.callback = block; | ||
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.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startColor, endColor, interpolatedColor); | ||
} | ||
|
||
@end | ||
|
||
@implementation LOTNumberBlockCallback | ||
|
||
+ (instancetype)withBlock:(LOTNumberValueCallbackBlock)block { | ||
LOTNumberBlockCallback *numberCallback = [[LOTNumberBlockCallback alloc] init]; | ||
numberCallback.callback = block; | ||
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.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startValue, endValue, interpolatedValue); | ||
} | ||
|
||
@end | ||
|
||
@implementation LOTPointBlockCallback | ||
|
||
+ (instancetype)withBlock:(LOTPointValueCallbackBlock)block { | ||
LOTPointBlockCallback *callback = [[LOTPointBlockCallback alloc] init]; | ||
callback.callback = block; | ||
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.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startPoint, endPoint, interpolatedPoint); | ||
} | ||
|
||
@end | ||
|
||
@implementation LOTSizeBlockCallback | ||
|
||
+ (instancetype)withBlock:(LOTSizeValueCallbackBlock)block { | ||
LOTSizeBlockCallback *callback = [[LOTSizeBlockCallback alloc] init]; | ||
callback.callback = block; | ||
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.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startSize, endSize, interpolatedSize); | ||
} | ||
|
||
@end | ||
|
||
@implementation LOTPathBlockCallback | ||
|
||
+ (instancetype)withBlock:(LOTPathValueCallbackBlock)block { | ||
LOTPathBlockCallback *callback = [[LOTPathBlockCallback alloc] init]; | ||
callback.callback = block; | ||
return callback; | ||
} | ||
|
||
- (CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress { | ||
return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress); | ||
} | ||
|
||
@end | ||
|
Oops, something went wrong.