LOTValueCallback.m 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // LOTValueCallback.m
  3. // Lottie
  4. //
  5. // Created by brandon_withrow on 12/15/17.
  6. // Copyright © 2017 Airbnb. All rights reserved.
  7. //
  8. #import "LOTValueCallback.h"
  9. @implementation LOTColorValueCallback
  10. + (instancetype _Nonnull)withCGColor:(CGColorRef _Nonnull)color {
  11. LOTColorValueCallback *colorCallback = [[self alloc] init];
  12. colorCallback.colorValue = color;
  13. return colorCallback;
  14. }
  15. - (CGColorRef)colorForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor currentColor:(CGColorRef)interpolatedColor {
  16. return self.colorValue;
  17. }
  18. @end
  19. @implementation LOTNumberValueCallback
  20. + (instancetype _Nonnull)withFloatValue:(CGFloat)numberValue {
  21. LOTNumberValueCallback *numberCallback = [[self alloc] init];
  22. numberCallback.numberValue = numberValue;
  23. return numberCallback;
  24. }
  25. - (CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue {
  26. return self.numberValue;
  27. }
  28. @end
  29. @implementation LOTPointValueCallback
  30. + (instancetype _Nonnull)withPointValue:(CGPoint)pointValue {
  31. LOTPointValueCallback *callback = [[self alloc] init];
  32. callback.pointValue = pointValue;
  33. return callback;
  34. }
  35. - (CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint {
  36. return self.pointValue;
  37. }
  38. @end
  39. @implementation LOTSizeValueCallback
  40. + (instancetype _Nonnull)withPointValue:(CGSize)sizeValue {
  41. LOTSizeValueCallback *callback = [[self alloc] init];
  42. callback.sizeValue = sizeValue;
  43. return callback;
  44. }
  45. - (CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize {
  46. return self.sizeValue;
  47. }
  48. @end
  49. @implementation LOTPathValueCallback
  50. + (instancetype _Nonnull)withCGPath:(CGPathRef _Nonnull)path {
  51. LOTPathValueCallback *callback = [[self alloc] init];
  52. callback.pathValue = path;
  53. return callback;
  54. }
  55. - (CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress {
  56. return self.pathValue;
  57. }
  58. @end