LOTPathAnimator.m 976 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // LOTPathAnimator.m
  3. // Pods
  4. //
  5. // Created by brandon_withrow on 6/27/17.
  6. //
  7. //
  8. #import "LOTPathAnimator.h"
  9. #import "LOTPathInterpolator.h"
  10. @implementation LOTPathAnimator {
  11. LOTShapePath *_pathConent;
  12. LOTPathInterpolator *_interpolator;
  13. }
  14. - (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode
  15. shapePath:(LOTShapePath *_Nonnull)shapePath {
  16. self = [super initWithInputNode:inputNode keyName:shapePath.keyname];
  17. if (self) {
  18. _pathConent = shapePath;
  19. _interpolator = [[LOTPathInterpolator alloc] initWithKeyframes:_pathConent.shapePath.keyframes];
  20. }
  21. return self;
  22. }
  23. - (NSDictionary *)valueInterpolators {
  24. return @{@"Path" : _interpolator};
  25. }
  26. - (BOOL)needsUpdateForFrame:(NSNumber *)frame {
  27. return [_interpolator hasUpdateForFrame:frame];
  28. }
  29. - (void)performLocalUpdate {
  30. self.localPath = [_interpolator pathForFrame:self.currentFrame cacheLengths:self.pathShouldCacheLengths];
  31. }
  32. @end