2017-02-07 15:14:48 -08:00

40 lines
1.1 KiB
Objective-C

//
// LOTShapeFill.m
// LottieAnimator
//
// Created by Brandon Withrow on 12/15/15.
// Copyright © 2015 Brandon Withrow. All rights reserved.
//
#import "LOTShapeFill.h"
#import "LOTAnimatableNumberValue.h"
#import "LOTAnimatableColorValue.h"
@implementation LOTShapeFill
- (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 *color = jsonDictionary[@"c"];
if (color) {
_color = [[LOTAnimatableColorValue alloc] initWithColorValues:color frameRate:frameRate];
}
NSDictionary *opacity = jsonDictionary[@"o"];
if (opacity) {
_opacity = [[LOTAnimatableNumberValue alloc] initWithNumberValues:opacity frameRate:frameRate];
[_opacity remapValuesFromMin:@0 fromMax:@100 toMin:@0 toMax:@1];
}
NSNumber *fillEnabled = jsonDictionary[@"fillEnabled"];
_fillEnabled = fillEnabled.boolValue;
}
@end