LOTShapePath.m 734 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // LOTShapePath.m
  3. // LottieAnimator
  4. //
  5. // Created by Brandon Withrow on 12/15/15.
  6. // Copyright © 2015 Brandon Withrow. All rights reserved.
  7. //
  8. #import "LOTShapePath.h"
  9. @implementation LOTShapePath
  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. _index = jsonDictionary[@"ind"];
  22. _closed = [jsonDictionary[@"closed"] boolValue];
  23. NSDictionary *shape = jsonDictionary[@"ks"];
  24. if (shape) {
  25. _shapePath = [[LOTKeyframeGroup alloc] initWithData:shape];
  26. }
  27. }
  28. @end