LOTShapeTrimPath.m 906 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // LOTShapeTrimPath.m
  3. // LottieAnimator
  4. //
  5. // Created by brandon_withrow on 7/26/16.
  6. // Copyright © 2016 Brandon Withrow. All rights reserved.
  7. //
  8. #import "LOTShapeTrimPath.h"
  9. @implementation LOTShapeTrimPath
  10. - (instancetype)initWithJSON:(NSDictionary *)jsonDictionary {
  11. self = [super init];
  12. if (self) {
  13. [self _mapFromJSON:jsonDictionary];
  14. }
  15. return self;
  16. }
  17. - (void)_mapFromJSON:(NSDictionary *)jsonDictionary {
  18. if (jsonDictionary[@"nm"] ) {
  19. _keyname = [jsonDictionary[@"nm"] copy];
  20. }
  21. NSDictionary *start = jsonDictionary[@"s"];
  22. if (start) {
  23. _start = [[LOTKeyframeGroup alloc] initWithData:start];
  24. }
  25. NSDictionary *end = jsonDictionary[@"e"];
  26. if (end) {
  27. _end = [[LOTKeyframeGroup alloc] initWithData:end];
  28. }
  29. NSDictionary *offset = jsonDictionary[@"o"];
  30. if (offset) {
  31. _offset = [[LOTKeyframeGroup alloc] initWithData:offset];
  32. }
  33. }
  34. @end