LOTShapeRectangle.m 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // LOTShapeRectangle.m
  3. // LottieAnimator
  4. //
  5. // Created by Brandon Withrow on 12/15/15.
  6. // Copyright © 2015 Brandon Withrow. All rights reserved.
  7. //
  8. #import "LOTShapeRectangle.h"
  9. @implementation LOTShapeRectangle
  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 *position = jsonDictionary[@"p"];
  22. if (position) {
  23. _position = [[LOTKeyframeGroup alloc] initWithData:position];
  24. }
  25. NSDictionary *cornerRadius = jsonDictionary[@"r"];
  26. if (cornerRadius) {
  27. _cornerRadius = [[LOTKeyframeGroup alloc] initWithData:cornerRadius];
  28. }
  29. NSDictionary *size = jsonDictionary[@"s"];
  30. if (size) {
  31. _size = [[LOTKeyframeGroup alloc] initWithData:size];
  32. }
  33. NSNumber *reversed = jsonDictionary[@"d"];
  34. _reversed = (reversed.integerValue == 3);
  35. }
  36. @end