change rootDic to rootDirectory;

change animationWithFile to animationWithFilePath
This commit is contained in:
bellchen 2017-06-12 10:56:39 +08:00
parent 2c06373b1f
commit 71326e9589
8 changed files with 16 additions and 16 deletions

View File

@ -319,12 +319,12 @@
- (void)_setImageForAsset { - (void)_setImageForAsset {
if (_layerModel.imageAsset.imageName) { if (_layerModel.imageAsset.imageName) {
UIImage *image; UIImage *image;
if (_layerModel.imageAsset.rootDir.length > 0) { if (_layerModel.imageAsset.rootDirectory.length > 0) {
NSString *rootDic = _layerModel.imageAsset.rootDir; NSString *rootDirectory = _layerModel.imageAsset.rootDirectory;
if (_layerModel.imageAsset.imageDirectory.length > 0) { if (_layerModel.imageAsset.imageDirectory.length > 0) {
rootDic = [rootDic stringByAppendingPathComponent:_layerModel.imageAsset.imageDirectory]; rootDirectory = [rootDirectory stringByAppendingPathComponent:_layerModel.imageAsset.imageDirectory];
} }
NSString *imagePath = [rootDic stringByAppendingPathComponent:_layerModel.imageAsset.imageName]; NSString *imagePath = [rootDirectory stringByAppendingPathComponent:_layerModel.imageAsset.imageName];
image = [UIImage imageWithContentsOfFile:imagePath]; image = [UIImage imageWithContentsOfFile:imagePath];
}else{ }else{
NSArray *components = [_layerModel.imageAsset.imageName componentsSeparatedByString:@"."]; NSArray *components = [_layerModel.imageAsset.imageName componentsSeparatedByString:@"."];

View File

@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, nullable) LOTLayerGroup *layerGroup; @property (nonatomic, readonly, nullable) LOTLayerGroup *layerGroup;
@property (nonatomic, readwrite) NSString *rootDir; @property (nonatomic, readwrite) NSString *rootDirectory;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -12,7 +12,7 @@
@class LOTAsset; @class LOTAsset;
@class LOTLayerGroup; @class LOTLayerGroup;
@interface LOTAssetGroup : NSObject @interface LOTAssetGroup : NSObject
@property (nonatomic, readwrite) NSString * _Nullable rootDir; @property (nonatomic, readwrite) NSString * _Nullable rootDirectory;
- (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray; - (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray;

View File

@ -58,10 +58,10 @@
- (LOTAsset *)assetModelForID:(NSString *)assetID { - (LOTAsset *)assetModelForID:(NSString *)assetID {
return _assetMap[assetID]; return _assetMap[assetID];
} }
- (void)setRootDir:(NSString *)rootDir{ - (void)setRootDirectory:(NSString *)rootDirectory{
_rootDir = rootDir; _rootDirectory = rootDirectory;
[_assetMap enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, LOTAsset * _Nonnull obj, BOOL * _Nonnull stop) { [_assetMap enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, LOTAsset * _Nonnull obj, BOOL * _Nonnull stop) {
obj.rootDir = rootDir; obj.rootDirectory = rootDirectory;
}]; }];
} }
@end @end

View File

@ -24,6 +24,6 @@
@property (nonatomic, readonly) NSTimeInterval timeDuration; @property (nonatomic, readonly) NSTimeInterval timeDuration;
@property (nonatomic, readonly) LOTLayerGroup *layerGroup; @property (nonatomic, readonly) LOTLayerGroup *layerGroup;
@property (nonatomic, readonly) LOTAssetGroup *assetGroup; @property (nonatomic, readonly) LOTAssetGroup *assetGroup;
@property (nonatomic, readwrite) NSString *rootDir; @property (nonatomic, readwrite) NSString *rootDirectory;
@end @end

View File

@ -55,8 +55,8 @@
[_assetGroup finalizeInitialization]; [_assetGroup finalizeInitialization];
} }
- (void)setRootDir:(NSString *)rootDir{ - (void)setRootDirectory:(NSString *)rootDirectory{
_rootDir = rootDir; _rootDirectory = rootDirectory;
self.assetGroup.rootDir = rootDir; self.assetGroup.rootDirectory = rootDirectory;
} }
@end @end

View File

@ -215,7 +215,7 @@
return [[LOTAnimationView alloc] initWithModel:laScene]; return [[LOTAnimationView alloc] initWithModel:laScene];
} }
+ (instancetype)animationWithFile:(NSString *)filePath{ + (instancetype)animationWithFilePath:(NSString *)filePath{
NSString *animationName = filePath; NSString *animationName = filePath;
LOTComposition *comp = [[LOTAnimationCache sharedCache] animationForKey:animationName]; LOTComposition *comp = [[LOTAnimationCache sharedCache] animationForKey:animationName];
@ -229,7 +229,7 @@
options:0 error:&error] : nil; options:0 error:&error] : nil;
if (JSONObject && !error) { if (JSONObject && !error) {
LOTComposition *laScene = [[LOTComposition alloc] initWithJSON:JSONObject]; LOTComposition *laScene = [[LOTComposition alloc] initWithJSON:JSONObject];
laScene.rootDir = [filePath stringByDeletingLastPathComponent]; laScene.rootDirectory = [filePath stringByDeletingLastPathComponent];
[[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName]; [[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName];
return [[LOTAnimationView alloc] initWithModel:laScene]; return [[LOTAnimationView alloc] initWithModel:laScene];
} }

View File

@ -19,7 +19,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished);
- (instancetype)initWithContentsOfURL:(NSURL *)url; - (instancetype)initWithContentsOfURL:(NSURL *)url;
+ (instancetype)animationWithFile:(NSString *)filePath NS_SWIFT_NAME(init(file:)); + (instancetype)animationWithFilePath:(NSString *)filePath NS_SWIFT_NAME(init(filePath:));
@property (nonatomic, readonly) BOOL isAnimationPlaying; @property (nonatomic, readonly) BOOL isAnimationPlaying;
@property (nonatomic, assign) BOOL loopAnimation; @property (nonatomic, assign) BOOL loopAnimation;