Swiftgram/lottie-ios/Classes/Models/LOTShapeRectangle.m
2017-02-07 15:14:48 -08:00

43 lines
1.2 KiB
Objective-C

//
// LOTShapeRectangle.m
// LottieAnimator
//
// Created by Brandon Withrow on 12/15/15.
// Copyright © 2015 Brandon Withrow. All rights reserved.
//
#import "LOTShapeRectangle.h"
#import "LOTAnimatableBoundsValue.h"
#import "LOTAnimatablePointValue.h"
#import "LOTAnimatableNumberValue.h"
@implementation LOTShapeRectangle
- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary frameRate:(NSNumber *)frameRate {
self = [super init];
if (self) {
[self _mapFromJSON:jsonDictionary frameRate:frameRate];
}
return self;
}
- (void)_mapFromJSON:(NSDictionary *)jsonDictionary frameRate:(NSNumber *)frameRate {
NSDictionary *position = jsonDictionary[@"p"];
if (position) {
_position = [[LOTAnimatablePointValue alloc] initWithPointValues:position frameRate:frameRate];
_position.usePathAnimation = NO;
}
NSDictionary *cornerRadius = jsonDictionary[@"r"];
if (cornerRadius) {
_cornerRadius = [[LOTAnimatableNumberValue alloc] initWithNumberValues:cornerRadius frameRate:frameRate];
}
NSDictionary *size = jsonDictionary[@"s"];
if (size) {
_size = [[LOTAnimatablePointValue alloc] initWithPointValues:size frameRate:frameRate];
}
}
@end