Skip to content

Commit

Permalink
Removed Old Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon_withrow committed Jul 29, 2017
1 parent e858c6a commit 5a1056e
Show file tree
Hide file tree
Showing 60 changed files with 395 additions and 1,301 deletions.
276 changes: 16 additions & 260 deletions Lottie.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import "LOTLayerContainer.h"
#import "LOTTransformInterpolator.h"
#import "LOTNumberInterpolator.h"
#import "LOTAnimatableNumberValue.h"
#import "CGGeometry+LOTAdditions.h"
#import "LOTRenderGroup.h"
#import "LOTHelpers.h"
Expand Down Expand Up @@ -84,7 +83,7 @@ - (void)commonInitializeWith:(LOTLayer *)layer
parentID = parentModel.parentID;
}
}
_opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:layer.opacity.keyframeGroup.keyframes];
_opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:layer.opacity.keyframes];
if (layer.layerType == LOTLayerTypeShape &&
layer.shapes.count) {
[self buildContents:layer.shapes];
Expand Down Expand Up @@ -131,15 +130,15 @@ - (void)_setImageForAsset:(LOTAsset *)asset {
#else

- (void)_setImageForAsset:(LOTAsset *)asset {
if (lasset.imageName) {
if (asset.imageName) {
NSArray *components = [asset.imageName componentsSeparatedByString:@"."];
NSImage *image = [NSImage imageNamed:components.firstObject];
if (image) {
NSWindow *window = [NSApp mainWindow];
CGFloat desiredScaleFactor = [window backingScaleFactor];
CGFloat actualScaleFactor = [image recommendedLayerContentsScale:desiredScaleFactor];
id layerContents = [image layerContentsForContentsScale:actualScaleFactor];
_childSolid.contents = layerContents;
_wrapperLayer = layerContents;

}
}
Expand Down
8 changes: 3 additions & 5 deletions lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//

#import "LOTMaskContainer.h"
#import "LOTAnimatableShapeValue.h"
#import "LOTAnimatableNumberValue.h"
#import "LOTPathInterpolator.h"
#import "LOTNumberInterpolator.h"

Expand All @@ -30,9 +28,9 @@ @implementation LOTMaskNodeLayer {
- (instancetype)initWithMask:(LOTMask *)maskNode {
self = [super init];
if (self) {
_pathInterpolator = [[LOTPathInterpolator alloc] initWithKeyframes:maskNode.maskPath.keyframeGroup.keyframes];
_opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:maskNode.opacity.keyframeGroup.keyframes];
_expansionInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:maskNode.expansion.keyframeGroup.keyframes];
_pathInterpolator = [[LOTPathInterpolator alloc] initWithKeyframes:maskNode.maskPath.keyframes];
_opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:maskNode.opacity.keyframes];
_expansionInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:maskNode.expansion.keyframes];
_maskNode = maskNode;
self.fillColor = [UIColor blueColor].CGColor;
}
Expand Down
7 changes: 6 additions & 1 deletion lottie-ios/Classes/AnimatableProperties/LOTKeyframe.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ @implementation LOTKeyframeGroup
- (instancetype)initWithData:(id)data {
self = [super init];
if (self) {
[self buildKeyframesFromData:data];
if ([data isKindOfClass:[NSDictionary class]] &&
[(NSDictionary *)data valueForKey:@"k"]) {
[self buildKeyframesFromData:[(NSDictionary *)data valueForKey:@"k"]];
} else {
[self buildKeyframesFromData:data];
}
}
return self;
}
Expand Down
8 changes: 4 additions & 4 deletions lottie-ios/Classes/Extensions/LOTHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#import "UIColor+Expanded.h"
#import "CGGeometry+LOTAdditions.h"
#import "LOTBezierPath.h"

#define DEBUG_USE_NEW_RENDERER YES
#define ENABLE_DEBUG_LOGGING NO
Expand All @@ -25,11 +26,10 @@
- Preload animation
- Image bundle support
- Image Cache Support
- Asset bundle
- Skew transform
PASS on LOTAnimationView
- Completion Block Support
- Proper Playing looping seeking
- Reverse, autoreverse
- Add sublayer support
- Play to Keyframe Point
Expand Down
16 changes: 0 additions & 16 deletions lottie-ios/Classes/MacCompatability/CADisplayLink.h

This file was deleted.

67 changes: 0 additions & 67 deletions lottie-ios/Classes/MacCompatability/CADisplayLink.m

This file was deleted.

2 changes: 0 additions & 2 deletions lottie-ios/Classes/MacCompatability/LOTPlatformCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#import <AppKit/AppKit.h>
#import "UIColor.h"
#import "UIBezierPath.h"
#import "CADisplayLink.h"
#import "CALayer+Compat.h"
#import "NSValue+Compat.h"

Expand Down
2 changes: 0 additions & 2 deletions lottie-ios/Classes/Models/LOTAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface LOTAsset : NSObject

- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary
withBounds:(CGRect)bounds
withFramerate:(NSNumber * _Nullable)framerate
withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup
withAssetBundle:(NSBundle *_Nonnull)bundle;

Expand Down
8 changes: 0 additions & 8 deletions lottie-ios/Classes/Models/LOTAsset.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@
@implementation LOTAsset

- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary
withBounds:(CGRect)bounds
withFramerate:(NSNumber * _Nullable)framerate
withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup
withAssetBundle:(NSBundle *_Nonnull)bundle {
self = [super init];
if (self) {
_assetBundle = bundle;
[self _mapFromJSON:jsonDictionary
withBounds:bounds
withFramerate:framerate
withAssetGroup:assetGroup];
}
return self;
}


- (void)_mapFromJSON:(NSDictionary *)jsonDictionary
withBounds:(CGRect)bounds
withFramerate:(NSNumber *)framerate
withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup{
_referenceID = [jsonDictionary[@"id"] copy];

Expand All @@ -55,8 +49,6 @@ - (void)_mapFromJSON:(NSDictionary *)jsonDictionary
NSArray *layersJSON = jsonDictionary[@"layers"];
if (layersJSON) {
_layerGroup = [[LOTLayerGroup alloc] initWithLayerJSON:layersJSON
withBounds:bounds
withFramerate:framerate
withAssetGroup:assetGroup];
}

Expand Down
4 changes: 1 addition & 3 deletions lottie-ios/Classes/Models/LOTAssetGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
- (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray
withAssetBundle:(NSBundle *_Nullable)bundle;

- (void)buildAssetNamed:(NSString * _Nonnull)refID
withBounds:(CGRect)bounds
andFramerate:(NSNumber * _Nullable)framerate;
- (void)buildAssetNamed:(NSString * _Nonnull)refID;

- (void)finalizeInitialization;

Expand Down
8 changes: 2 additions & 6 deletions lottie-ios/Classes/Models/LOTAssetGroup.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ - (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray
return self;
}

- (void)buildAssetNamed:(NSString *)refID
withBounds:(CGRect)bounds
andFramerate:(NSNumber * _Nullable)framerate {
- (void)buildAssetNamed:(NSString *)refID {

if ([self assetModelForID:refID]) {
return;
Expand All @@ -43,8 +41,6 @@ - (void)buildAssetNamed:(NSString *)refID
NSDictionary *assetDictionary = _assetJSONMap[refID];
if (assetDictionary) {
LOTAsset *asset = [[LOTAsset alloc] initWithJSON:assetDictionary
withBounds:bounds
withFramerate:framerate
withAssetGroup:self
withAssetBundle:_assetBundle];
_assetMap[refID] = asset;
Expand All @@ -53,7 +49,7 @@ - (void)buildAssetNamed:(NSString *)refID

- (void)finalizeInitialization {
for (NSString *refID in _assetJSONMap.allKeys) {
[self buildAssetNamed:refID withBounds:CGRectZero andFramerate:nil];
[self buildAssetNamed:refID];
}
_assetJSONMap = nil;
}
Expand Down
31 changes: 0 additions & 31 deletions lottie-ios/Classes/Models/LOTComposition.h

This file was deleted.

66 changes: 0 additions & 66 deletions lottie-ios/Classes/Models/LOTComposition.m

This file was deleted.

Loading

0 comments on commit 5a1056e

Please sign in to comment.