mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-17 02:49:57 +00:00
53 lines
1.2 KiB
Objective-C
53 lines
1.2 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 "CGGeometry+LOTAdditions.h"
|
|
|
|
@implementation LOTShapeFill
|
|
|
|
- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary {
|
|
self = [super init];
|
|
if (self) {
|
|
[self _mapFromJSON:jsonDictionary];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)_mapFromJSON:(NSDictionary *)jsonDictionary {
|
|
|
|
if (jsonDictionary[@"nm"] ) {
|
|
_keyname = [jsonDictionary[@"nm"] copy];
|
|
}
|
|
|
|
NSDictionary *color = jsonDictionary[@"c"];
|
|
if (color) {
|
|
_color = [[LOTKeyframeGroup alloc] initWithData:color];
|
|
}
|
|
|
|
NSDictionary *opacity = jsonDictionary[@"o"];
|
|
if (opacity) {
|
|
_opacity = [[LOTKeyframeGroup alloc] initWithData:opacity];
|
|
[_opacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) {
|
|
return LOT_RemapValue(inValue, 0, 100, 0, 1);
|
|
}];
|
|
}
|
|
|
|
NSNumber *evenOdd = jsonDictionary[@"r"];
|
|
if (evenOdd.integerValue == 2) {
|
|
_evenOddFillRule = YES;
|
|
} else {
|
|
_evenOddFillRule = NO;
|
|
}
|
|
|
|
NSNumber *fillEnabled = jsonDictionary[@"fillEnabled"];
|
|
_fillEnabled = fillEnabled.boolValue;
|
|
}
|
|
|
|
@end
|