diff --git a/.gitignore b/.gitignore index 1db119b..b044ba5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ android/dist android/java-sources.txt android/build.properties ios/ti.animation.xcodeproj/project.xcworkspace/xcuserdata/* +.DS_Store +ios/Cartfile.resolved +ios/Carthage diff --git a/README.md b/README.md index c109769..16242f1 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,57 @@ -# Ti.Animation [![Build Status](https://travis-ci.org/m1ga/ti.animation.svg?branch=master)](https://travis-ci.org/m1ga/ti.animation) +# Ti.Animation ![gif](animation.gif) -Appcelerator Titanium Android module for [Facebooks Keyframes](https://github.com/facebookincubator/Keyframes) libray and for [Airbnb Lottie](https://github.com/airbnb/lottie-android). +Appcelerator Titanium Android module to support smooth and scalable animations using [Airbnb Lottie](https://airbnb.design/lottie/). + +> ⚠️ The versions iOS 2.0.0 and Android 3.0.0 contain a breaking change that removed the Facebook Keyframes library. We decided to go with a Lottie only library for the future, since it made the race for the best animation library. Also, the deprecated method `addViewToLayer` is now removed. Please continue to use `addViewToKeypathLayer`. + +## Migrate from iOS < 2.0.0 and Android < 3.0.0 + +Instead of using `createLottieView`, simply use `createAnimationView` now. That's it! ## Requirements -- Titanium Mobile SDK 7.0.0 or later + +- Axway Titanium SDK 7.0.0+ ## Library versions: + The Titanium modules use external libraries |Library|Platform|Version|Build Date| |---|---|---|---| -| [Facebooks Keyframes](https://github.com/facebookincubator/Keyframes) | Android | 1.0.0 | 2017/02/11 | -| [Facebooks Keyframes](https://github.com/facebookincubator/Keyframes) | iOS | 1.0.0 | 2017/02/11 | | [Airbnb Lottie](https://github.com/airbnb/lottie-android) | Android | 2.6.1 | 2018/09/06 | -| [Airbnb Lottie](https://github.com/airbnb/lottie-ios) | iOS | 2.5.0 | 2018/02/11 | +| [Airbnb Lottie](https://github.com/airbnb/lottie-ios) | iOS | 2.5.2 | 2018/12/10 | -## Choose your view -### Lottie -```js -var animation = TiAnimation.createLottieView({ - file: 'file.json', - loop: false, - autoStart: false -}); -``` -### Keyframes +## Create a View + ```js -var animation = TiAnimation.createKeyframeView({ +var animation = TiAnimation.createAnimationView({ file: 'file.json', loop: false, autoStart: false }); ``` +## Update native Libraries + +- iOS: Use Carthage and `carthage update` to compile the framework automatically. Then, copy the output from `ios/Carthage/Build/iOS` to `ios/platform/`. +- Android: To be documented! + ## Features/Documentation + Visit the [wiki](https://github.com/m1ga/ti.animation/wiki) for the documentation. ## Example + Please see the basic example in `example/app.js`. More examples can found in the [wiki](https://github.com/m1ga/ti.animation/wiki) ## Resources + At [LottieFiles](http://www.lottiefiles.com/) you will find a list of free Lottie animations. -Authors ---------------- +## Authors + - Hans Knöchel ([@hansemannnn](https://twitter.com/hansemannnn) / [Web](http://hans-knoechel.de)) - Michael Gangolf ([@MichaelGangolf](https://twitter.com/MichaelGangolf) / [Web](http://migaweb.de)) diff --git a/ios/Cartfile b/ios/Cartfile new file mode 100644 index 0000000..12721cb --- /dev/null +++ b/ios/Cartfile @@ -0,0 +1 @@ +github "airbnb/lottie-ios" "master" diff --git a/ios/Classes/Keyframes/TiAnimationKeyframeView.h b/ios/Classes/Keyframes/TiAnimationKeyframeView.h deleted file mode 100644 index c8ca38c..0000000 --- a/ios/Classes/Keyframes/TiAnimationKeyframeView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Ti.Keyframes - * Copyright (c) 2017-present by Hans Knöchel. All Rights Reserved. - * Licensed under the terms of the Apache Public License - * Please see the LICENSE included with this distribution for details. - */ -#import "TiUIView.h" -#import "KFVectorLayer.h" - -@interface TiAnimationKeyframeView : TiUIView - -@property (nonatomic, strong) KFVectorLayer *vectorLayer; - -@end diff --git a/ios/Classes/Keyframes/TiAnimationKeyframeView.m b/ios/Classes/Keyframes/TiAnimationKeyframeView.m deleted file mode 100644 index 9f3c9d1..0000000 --- a/ios/Classes/Keyframes/TiAnimationKeyframeView.m +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Ti.Keyframes - * Copyright (c) 2017-present by Hans Knöchel. All Rights Reserved. - * Licensed under the terms of the Apache Public License - * Please see the LICENSE included with this distribution for details. - */ -#import "TiAnimationKeyframeView.h" -#import "TiAnimationKeyframeViewProxy.h" -#import "KFVectorParsingHelper.h" - -@implementation TiAnimationKeyframeView - -- (KFVector *)vector -{ - static KFVector *_sampleVector; - static dispatch_once_t onceToken; - - if (![[self proxy] valueForKey:@"file"]) { - [self throwException:@"The file was null" - subreason:@"The specified JSON file was null, please define it by setting the 'file' key." - location:CODELOCATION]; - } - - dispatch_once(&onceToken, ^{ - NSString *filePath = [[NSBundle mainBundle] pathForResource:[[self proxy] valueForKey:@"file"] ofType:nil inDirectory:nil]; - NSData *data = [NSData dataWithContentsOfFile:filePath]; - - if (!data) { - NSLog(@"[ERROR] The specified file %@ could not be located. Please ensure to only provice the name of the JSON-file, without the extension."); - } - - NSDictionary *sampleVectorDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; - _sampleVector = KFVectorFromDictionary(sampleVectorDictionary); - }); - - return _sampleVector; -} - -- (KFVectorLayer *)vectorLayer -{ - if (_vectorLayer == nil) { - KFVector *sampleVector = [self vector]; - - _vectorLayer = [[KFVectorLayer alloc] init]; - - const CGFloat shortSide = MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)); - const CGFloat longSide = MAX(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)); - _vectorLayer.frame = CGRectMake(shortSide / 4, longSide / 2 - shortSide / 4, shortSide / 2, shortSide / 2); - _vectorLayer.faceModel = sampleVector; - - TiThreadPerformOnMainThread(^{ - [[self layer] addSublayer:_vectorLayer]; - }, - NO); - - // Handle auto-start - if ([TiUtils boolValue:[[self proxy] valueForKey:@"autoStart"] def:NO]) { - [(TiAnimationKeyframeViewProxy *)[self proxy] start:nil]; - } - } - - return _vectorLayer; -} - -@end diff --git a/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.h b/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.h deleted file mode 100644 index d1b3d2f..0000000 --- a/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Ti.Keyframes - * Copyright (c) 2017-present by Hans Knöchel. All Rights Reserved. - * Licensed under the terms of the Apache Public License - * Please see the LICENSE included with this distribution for details. - */ -#import "TiViewProxy.h" - -/** - @discussion The main class to execute operation on the vector layer. - */ -@interface TiAnimationKeyframeViewProxy : TiViewProxy { -} - -/** - @discussion Starts the animation of the current vector object. - - @param unused An unused parameter for the API-generation. - @since 1.0.0 - */ -- (void)start:(id)unused; - -/** - @discussion Pauses the animation of the current vector object. - - @param unused An unused parameter for the API-generation. - @since 1.0.0 - */ -- (void)pause:(id)unused; - -/** - @discussion Resumes the animation of the current vector object. - - @param unused An unused parameter for the API-generation. - @since 1.0.0 - */ -- (void)resume:(id)unused; - -/** - @discussion Seeks the animation of the current vector object to a - certain point (0.0 - 1.0). - - @param value The value to seek the progress to. - @since 1.0.0 - */ -- (void)seekToProgress:(id)value; - -@end diff --git a/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.m b/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.m deleted file mode 100644 index 0fb8424..0000000 --- a/ios/Classes/Keyframes/TiAnimationKeyframeViewProxy.m +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Ti.Keyframes - * Copyright (c) 2017-present by Hans Knöchel. All Rights Reserved. - * Licensed under the terms of the Apache Public License - * Please see the LICENSE included with this distribution for details. - */ -#import "TiAnimationKeyframeViewProxy.h" -#import "TiAnimationKeyframeView.h" -#import "TiUtils.h" -#import "KFVectorLayer.h" - -@implementation TiAnimationKeyframeViewProxy - -- (KFVectorLayer *)vectorLayer -{ - return [(TiAnimationKeyframeView *)[self view] vectorLayer]; -} - -- (void)start:(id)unused -{ - ENSURE_UI_THREAD(start, unused); - [[self vectorLayer] startAnimation]; -} - -- (void)pause:(id)unused -{ - ENSURE_UI_THREAD(pause, unused); - [[self vectorLayer] pauseAnimation]; -} - -- (void)resume:(id)unused -{ - ENSURE_UI_THREAD(resume, unused); - [[self vectorLayer] resumeAnimation]; -} - -- (void)seekToProgress:(id)value -{ - ENSURE_SINGLE_ARG(value, NSNumber); - ENSURE_UI_THREAD(seekToProgress, value); - - [[self vectorLayer] seekToProgress:[TiUtils floatValue:value]]; -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/Compatibility.h b/ios/Classes/Keyframes/keyframes-ios/Compatibility/Compatibility.h deleted file mode 100755 index 191682d..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/Compatibility.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#if TARGET_OS_OSX -#import -#import - -#define UIBezierPath NSBezierPath -#define UIImage NSImage -#define UIColor NSColor - -#define CGSizeFromString NSSizeFromString -#define NSStringFromCGSize NSStringFromSize -#define CGPointFromString NSPointFromString -#define NSStringFromCGPoint NSStringFromPoint - -#import "NSBezierPath+PlatformCompatibility.h" -#import "NSImage+PlatformCompatibility.h" -#import "NSValue+PlatformCompatibility.h" -#else -#import -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.h b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.h deleted file mode 100755 index 34c0349..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#if TARGET_OS_OSX - -#import - -@interface NSBezierPath (PlatformCompatibility) - -@property (readonly) CGPathRef CGPath; - -- (void)addLineToPoint:(NSPoint)point; -- (void)addCurveToPoint:(NSPoint)point controlPoint1:(NSPoint)controlPoint1 controlPoint2:(NSPoint)controlPoint2; -- (void)addQuadCurveToPoint:(NSPoint)point controlPoint:(NSPoint)controlPoint; - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.m b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.m deleted file mode 100755 index d572460..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSBezierPath+PlatformCompatibility.m +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "NSBezierPath+PlatformCompatibility.h" - -#if TARGET_OS_OSX - -@implementation NSBezierPath (PlatformCompatibility) - -- (void)addLineToPoint:(NSPoint)point -{ - [self lineToPoint:point]; -} - -- (void)addCurveToPoint:(NSPoint)point controlPoint1:(NSPoint)controlPoint1 controlPoint2:(NSPoint)controlPoint2 -{ - [self curveToPoint:point controlPoint1:controlPoint1 controlPoint2:controlPoint2]; -} - -- (void)addQuadCurveToPoint:(NSPoint)point controlPoint:(NSPoint)controlPoint -{ - // See http://fontforge.sourceforge.net/bezier.html - - CGPoint QP0 = [self currentPoint]; - CGPoint CP3 = point; - - CGPoint CP1 = CGPointMake( - // QP0 + 2 / 3 * (QP1 - QP0 ) - QP0.x + ((2.0 / 3.0) * (controlPoint.x - QP0.x)), - QP0.y + ((2.0 / 3.0) * (controlPoint.y - QP0.y)) - ); - - CGPoint CP2 = CGPointMake( - // QP2 + 2 / 3 * (QP1 - QP2) - point.x + (2.0 / 3.0) * (controlPoint.x - point.x), - point.y + (2.0 / 3.0) * (controlPoint.y - point.y) - ); - - [self curveToPoint:CP3 controlPoint1:CP1 controlPoint2:CP2]; -} - -- (CGPathRef)CGPath -{ - NSInteger numberOfElements = [self elementCount]; - - if (!numberOfElements) { - return NULL; - } - - CGMutablePathRef path = CGPathCreateMutable(); - NSPoint points[3]; - - for (int i = 0; i < numberOfElements; i++) { - switch ([self elementAtIndex:i associatedPoints:points]) { - case NSMoveToBezierPathElement: - CGPathMoveToPoint(path, NULL, points[0].x, points[0].y); - break; - - case NSLineToBezierPathElement: - CGPathAddLineToPoint(path, NULL, points[0].x, points[0].y); - break; - - case NSCurveToBezierPathElement: - CGPathAddCurveToPoint(path, NULL, points[0].x, points[0].y, - points[1].x, points[1].y, - points[2].x, points[2].y); - break; - - case NSClosePathBezierPathElement: - CGPathCloseSubpath(path); - break; - } - } - - CGPathRef immutablePath = CGPathCreateCopy(path); - CGPathRelease(path); - - return immutablePath; -} - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.h b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.h deleted file mode 100755 index 7da1572..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#if TARGET_OS_OSX - -#import - -@interface NSImage (PlatformCompatibility) - -@property (readonly) CGImageRef CGImage; - -+ (NSImage *)imageWithData:(NSData *)data; - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.m b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.m deleted file mode 100755 index db199f6..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSImage+PlatformCompatibility.m +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "NSImage+PlatformCompatibility.h" - -#if TARGET_OS_OSX - -@implementation NSImage (PlatformCompatibility) - -- (CGImageRef)CGImage -{ - CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)[self TIFFRepresentation], NULL); - - return CGImageSourceCreateImageAtIndex(source, 0, NULL); -} - -+ (NSImage *)imageWithData:(NSData *)data -{ - return [[NSImage alloc] initWithData:data]; -} - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.h b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.h deleted file mode 100755 index c370a13..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#if TARGET_OS_OSX - -#import - -@interface NSValue (NSValue_PlatformCompatibility) - -@property (readonly) CGPoint CGPointValue; - -+ (instancetype)valueWithCGPoint:(NSPoint)point; - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.m b/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.m deleted file mode 100755 index 6116851..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Compatibility/NSValue+PlatformCompatibility.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "NSValue+PlatformCompatibility.h" - -#if TARGET_OS_OSX - -@implementation NSValue (NSValue_PlatformCompatibility) - -+ (instancetype)valueWithCGPoint:(NSPoint)point -{ - return [self valueWithPoint:point]; -} - -- (CGPoint)CGPointValue -{ - return [self pointValue]; -} - -@end - -#endif diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/.valueObjectConfig b/ios/Classes/Keyframes/keyframes-ios/DataModel/.valueObjectConfig deleted file mode 100755 index b65629c..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/.valueObjectConfig +++ /dev/null @@ -1,5 +0,0 @@ -{ - "customPluginPaths": [ - "remodel-plugins/fb-copyright-header-comment.js" - ] -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.h deleted file mode 100755 index 767e37a..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVector.value - */ - -#import -#import - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVector : NSObject - -@property (nonatomic, readonly) CGSize canvasSize; -@property (nonatomic, readonly, copy) NSString *name; -@property (nonatomic, readonly, copy) NSString *formatVersion; -@property (nonatomic, readonly) NSInteger key; -@property (nonatomic, readonly) NSUInteger frameRate; -@property (nonatomic, readonly) NSUInteger animationFrameCount; -@property (nonatomic, readonly, copy) NSArray *features; -@property (nonatomic, readonly, copy) NSArray *animationGroups; -@property (nonatomic, readonly, copy) NSDictionary *bitmaps; - -- (instancetype)initWithCanvasSize:(CGSize)canvasSize name:(NSString *)name formatVersion:(NSString *)formatVersion key:(NSInteger)key frameRate:(NSUInteger)frameRate animationFrameCount:(NSUInteger)animationFrameCount features:(NSArray *)features animationGroups:(NSArray *)animationGroups bitmaps:(NSDictionary *)bitmaps; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.m deleted file mode 100755 index 9937fe7..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.m +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVector.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "Compatibility.h" -#import "KFVector.h" - -static __unsafe_unretained NSString * const kCanvasSizeKey = @"CANVAS_SIZE"; -static __unsafe_unretained NSString * const kNameKey = @"NAME"; -static __unsafe_unretained NSString * const kFormatVersionKey = @"FORMAT_VERSION"; -static __unsafe_unretained NSString * const kKeyKey = @"KEY"; -static __unsafe_unretained NSString * const kFrameRateKey = @"FRAME_RATE"; -static __unsafe_unretained NSString * const kAnimationFrameCountKey = @"ANIMATION_FRAME_COUNT"; -static __unsafe_unretained NSString * const kFeaturesKey = @"FEATURES"; -static __unsafe_unretained NSString * const kAnimationGroupsKey = @"ANIMATION_GROUPS"; -static __unsafe_unretained NSString * const kBitmapsKey = @"BITMAPS"; - -static NSUInteger HashFloat(float givenFloat) { - union { - float key; - uint32_t bits; - } u; - u.key = givenFloat; - NSUInteger h = (NSUInteger)u.bits; -#if !TARGET_RT_64_BIT - h = ~h + (h << 15); - h ^= (h >> 12); - h += (h << 2); - h ^= (h >> 4); - h *= 2057; - h ^= (h >> 16); -#else - h += ~h + (h << 21); - h ^= (h >> 24); - h = (h + (h << 3)) + (h << 8); - h ^= (h >> 14); - h = (h + (h << 2)) + (h << 4); - h ^= (h >> 28); - h += (h << 31); -#endif - return h; -} - -static NSUInteger HashDouble(double givenDouble) { - union { - double key; - uint64_t bits; - } u; - u.key = givenDouble; - NSUInteger p = u.bits; - p = (~p) + (p << 18); - p ^= (p >> 31); - p *= 21; - p ^= (p >> 11); - p += (p << 6); - p ^= (p >> 22); - return (NSUInteger) p; -} - -static NSUInteger HashCGFloat(CGFloat givenCGFloat) { -#if CGFLOAT_IS_DOUBLE - BOOL useDouble = YES; -#else - BOOL useDouble = NO; -#endif - if (useDouble) { - return HashDouble(givenCGFloat); - } else { - return HashFloat(givenCGFloat); - } -} - -@implementation KFVector - -- (instancetype)initWithCanvasSize:(CGSize)canvasSize name:(NSString *)name formatVersion:(NSString *)formatVersion key:(NSInteger)key frameRate:(NSUInteger)frameRate animationFrameCount:(NSUInteger)animationFrameCount features:(NSArray *)features animationGroups:(NSArray *)animationGroups bitmaps:(NSDictionary *)bitmaps -{ - if ((self = [super init])) { - _canvasSize = canvasSize; - _name = [name copy]; - _formatVersion = [formatVersion copy]; - _key = key; - _frameRate = frameRate; - _animationFrameCount = animationFrameCount; - _features = [features copy]; - _animationGroups = [animationGroups copy]; - _bitmaps = [bitmaps copy]; - } - - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _canvasSize = CGSizeFromString([aDecoder decodeObjectForKey:kCanvasSizeKey]); - _name = [aDecoder decodeObjectForKey:kNameKey]; - _formatVersion = [aDecoder decodeObjectForKey:kFormatVersionKey]; - _key = [aDecoder decodeIntegerForKey:kKeyKey]; - _frameRate = [aDecoder decodeIntegerForKey:kFrameRateKey]; - _animationFrameCount = [aDecoder decodeIntegerForKey:kAnimationFrameCountKey]; - _features = [aDecoder decodeObjectForKey:kFeaturesKey]; - _animationGroups = [aDecoder decodeObjectForKey:kAnimationGroupsKey]; - _bitmaps = [aDecoder decodeObjectForKey:kBitmapsKey]; - } - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t canvasSize: %@; \n\t name: %@; \n\t formatVersion: %@; \n\t key: %zd; \n\t frameRate: %tu; \n\t animationFrameCount: %tu; \n\t features: %@; \n\t animationGroups: %@; \n\t bitmaps: %@; \n", [super description], NSStringFromCGSize(_canvasSize), _name, _formatVersion, _key, _frameRate, _animationFrameCount, _features, _animationGroups, _bitmaps]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:NSStringFromCGSize(_canvasSize) forKey:kCanvasSizeKey]; - [aCoder encodeObject:_name forKey:kNameKey]; - [aCoder encodeObject:_formatVersion forKey:kFormatVersionKey]; - [aCoder encodeInteger:_key forKey:kKeyKey]; - [aCoder encodeInteger:_frameRate forKey:kFrameRateKey]; - [aCoder encodeInteger:_animationFrameCount forKey:kAnimationFrameCountKey]; - [aCoder encodeObject:_features forKey:kFeaturesKey]; - [aCoder encodeObject:_animationGroups forKey:kAnimationGroupsKey]; - [aCoder encodeObject:_bitmaps forKey:kBitmapsKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {HashCGFloat(_canvasSize.width), HashCGFloat(_canvasSize.height), [_name hash], [_formatVersion hash], ABS(_key), _frameRate, _animationFrameCount, [_features hash], [_animationGroups hash], [_bitmaps hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 10; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVector *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - _key == object->_key && - _frameRate == object->_frameRate && - _animationFrameCount == object->_animationFrameCount && - CGSizeEqualToSize(_canvasSize, object->_canvasSize) && - (_name == object->_name ? YES : [_name isEqual:object->_name]) && - (_formatVersion == object->_formatVersion ? YES : [_formatVersion isEqual:object->_formatVersion]) && - (_features == object->_features ? YES : [_features isEqual:object->_features]) && - (_animationGroups == object->_animationGroups ? YES : [_animationGroups isEqual:object->_animationGroups]) && - (_bitmaps == object->_bitmaps ? YES : [_bitmaps isEqual:object->_bitmaps]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.value deleted file mode 100755 index 06f4d80..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVector.value +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVector includes(RMCoding) { - CGSize canvasSize; - NSString *name; - NSString *formatVersion; - NSInteger key; - NSUInteger frameRate; - NSUInteger animationFrameCount; - NSArray *features; - NSArray *animationGroups; - NSDictionary *bitmaps; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.h deleted file mode 100755 index 06e13ce..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimation.value - */ - -#import -#import - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorAnimation : NSObject - -@property (nonatomic, readonly, copy) NSString *property; -/** - * @deprecated since 1.0 - */ -@property (nonatomic, readonly) CGPoint anchor; -@property (nonatomic, readonly, copy) NSArray *keyValues; -@property (nonatomic, readonly, copy) NSArray *timingCurves; - -- (instancetype)initWithProperty:(NSString *)property anchor:(CGPoint)anchor keyValues:(NSArray *)keyValues timingCurves:(NSArray *)timingCurves; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.m deleted file mode 100755 index 06b464c..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.m +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimation.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "Compatibility.h" - -#import "KFVectorAnimation.h" - -static __unsafe_unretained NSString * const kPropertyKey = @"PROPERTY"; -static __unsafe_unretained NSString * const kAnchorKey = @"ANCHOR"; -static __unsafe_unretained NSString * const kKeyValuesKey = @"KEY_VALUES"; -static __unsafe_unretained NSString * const kTimingCurvesKey = @"TIMING_CURVES"; - -static NSUInteger HashFloat(float givenFloat) { - union { - float key; - uint32_t bits; - } u; - u.key = givenFloat; - NSUInteger h = (NSUInteger)u.bits; -#if !TARGET_RT_64_BIT - h = ~h + (h << 15); - h ^= (h >> 12); - h += (h << 2); - h ^= (h >> 4); - h *= 2057; - h ^= (h >> 16); -#else - h += ~h + (h << 21); - h ^= (h >> 24); - h = (h + (h << 3)) + (h << 8); - h ^= (h >> 14); - h = (h + (h << 2)) + (h << 4); - h ^= (h >> 28); - h += (h << 31); -#endif - return h; -} - -static NSUInteger HashDouble(double givenDouble) { - union { - double key; - uint64_t bits; - } u; - u.key = givenDouble; - NSUInteger p = u.bits; - p = (~p) + (p << 18); - p ^= (p >> 31); - p *= 21; - p ^= (p >> 11); - p += (p << 6); - p ^= (p >> 22); - return (NSUInteger) p; -} - -static NSUInteger HashCGFloat(CGFloat givenCGFloat) { -#if CGFLOAT_IS_DOUBLE - BOOL useDouble = YES; -#else - BOOL useDouble = NO; -#endif - if (useDouble) { - return HashDouble(givenCGFloat); - } else { - return HashFloat(givenCGFloat); - } -} - -@implementation KFVectorAnimation - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _property = [aDecoder decodeObjectForKey:kPropertyKey]; - _anchor = CGPointFromString([aDecoder decodeObjectForKey:kAnchorKey]); - _keyValues = [aDecoder decodeObjectForKey:kKeyValuesKey]; - _timingCurves = [aDecoder decodeObjectForKey:kTimingCurvesKey]; - } - return self; -} - -- (instancetype)initWithProperty:(NSString *)property anchor:(CGPoint)anchor keyValues:(NSArray *)keyValues timingCurves:(NSArray *)timingCurves -{ - if ((self = [super init])) { - _property = [property copy]; - _anchor = anchor; - _keyValues = [keyValues copy]; - _timingCurves = [timingCurves copy]; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t property: %@; \n\t anchor: %@; \n\t keyValues: %@; \n\t timingCurves: %@; \n", [super description], _property, NSStringFromCGPoint(_anchor), _keyValues, _timingCurves]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_property forKey:kPropertyKey]; - [aCoder encodeObject:NSStringFromCGPoint(_anchor) forKey:kAnchorKey]; - [aCoder encodeObject:_keyValues forKey:kKeyValuesKey]; - [aCoder encodeObject:_timingCurves forKey:kTimingCurvesKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_property hash], HashCGFloat(_anchor.x), HashCGFloat(_anchor.y), [_keyValues hash], [_timingCurves hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 5; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorAnimation *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - CGPointEqualToPoint(_anchor, object->_anchor) && - (_property == object->_property ? YES : [_property isEqual:object->_property]) && - (_keyValues == object->_keyValues ? YES : [_keyValues isEqual:object->_keyValues]) && - (_timingCurves == object->_timingCurves ? YES : [_timingCurves isEqual:object->_timingCurves]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.value deleted file mode 100755 index 819d9cf..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimation.value +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorAnimation includes(RMCoding) { - NSString *property; - # @deprecated since 1.0 - CGPoint anchor; - NSArray *keyValues; - NSArray *timingCurves; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.h deleted file mode 100755 index ae10216..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimationGroup.value - */ - -#import - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorAnimationGroup : NSObject - -@property (nonatomic, readonly, copy) NSString *groupName; -@property (nonatomic, readonly) NSInteger groupId; -@property (nonatomic, readonly) NSUInteger parentGroupId; -@property (nonatomic, readonly, copy) NSArray *animations; - -- (instancetype)initWithGroupName:(NSString *)groupName groupId:(NSInteger)groupId parentGroupId:(NSUInteger)parentGroupId animations:(NSArray *)animations; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.m deleted file mode 100755 index 808be50..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.m +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimationGroup.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "KFVectorAnimationGroup.h" - -static __unsafe_unretained NSString * const kGroupNameKey = @"GROUP_NAME"; -static __unsafe_unretained NSString * const kGroupIdKey = @"GROUP_ID"; -static __unsafe_unretained NSString * const kParentGroupIdKey = @"PARENT_GROUP_ID"; -static __unsafe_unretained NSString * const kAnimationsKey = @"ANIMATIONS"; - -@implementation KFVectorAnimationGroup - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _groupName = [aDecoder decodeObjectForKey:kGroupNameKey]; - _groupId = [aDecoder decodeIntegerForKey:kGroupIdKey]; - _parentGroupId = [aDecoder decodeIntegerForKey:kParentGroupIdKey]; - _animations = [aDecoder decodeObjectForKey:kAnimationsKey]; - } - return self; -} - -- (instancetype)initWithGroupName:(NSString *)groupName groupId:(NSInteger)groupId parentGroupId:(NSUInteger)parentGroupId animations:(NSArray *)animations -{ - if ((self = [super init])) { - _groupName = [groupName copy]; - _groupId = groupId; - _parentGroupId = parentGroupId; - _animations = [animations copy]; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t groupName: %@; \n\t groupId: %zd; \n\t parentGroupId: %tu; \n\t animations: %@; \n", [super description], _groupName, _groupId, _parentGroupId, _animations]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_groupName forKey:kGroupNameKey]; - [aCoder encodeInteger:_groupId forKey:kGroupIdKey]; - [aCoder encodeInteger:_parentGroupId forKey:kParentGroupIdKey]; - [aCoder encodeObject:_animations forKey:kAnimationsKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_groupName hash], ABS(_groupId), _parentGroupId, [_animations hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 4; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorAnimationGroup *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - _groupId == object->_groupId && - _parentGroupId == object->_parentGroupId && - (_groupName == object->_groupName ? YES : [_groupName isEqual:object->_groupName]) && - (_animations == object->_animations ? YES : [_animations isEqual:object->_animations]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.value deleted file mode 100755 index 2a11ef9..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationGroup.value +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorAnimationGroup includes(RMCoding) { - NSString *groupName; - NSInteger groupId; - NSUInteger parentGroupId; - NSArray *animations; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.h deleted file mode 100755 index e087177..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimationKeyValue.value - */ - -#import - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorAnimationKeyValue : NSObject - -@property (nonatomic, readonly, copy) id keyValue; -@property (nonatomic, readonly) NSInteger startFrame; - -- (instancetype)initWithKeyValue:(id)keyValue startFrame:(NSInteger)startFrame; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.m deleted file mode 100755 index 979d58e..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.m +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorAnimationKeyValue.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "KFVectorAnimationKeyValue.h" - -static __unsafe_unretained NSString * const kKeyValueKey = @"KEY_VALUE"; -static __unsafe_unretained NSString * const kStartFrameKey = @"START_FRAME"; - -@implementation KFVectorAnimationKeyValue - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _keyValue = [aDecoder decodeObjectForKey:kKeyValueKey]; - _startFrame = [aDecoder decodeIntegerForKey:kStartFrameKey]; - } - return self; -} - -- (instancetype)initWithKeyValue:(id)keyValue startFrame:(NSInteger)startFrame -{ - if ((self = [super init])) { - _keyValue = [keyValue copy]; - _startFrame = startFrame; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t keyValue: %@; \n\t startFrame: %zd; \n", [super description], _keyValue, _startFrame]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_keyValue forKey:kKeyValueKey]; - [aCoder encodeInteger:_startFrame forKey:kStartFrameKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_keyValue hash], ABS(_startFrame)}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 2; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorAnimationKeyValue *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - _startFrame == object->_startFrame && - (_keyValue == object->_keyValue ? YES : [_keyValue isEqual:object->_keyValue]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.value deleted file mode 100755 index f05fab4..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorAnimationKeyValue.value +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorAnimationKeyValue includes(RMCoding) { - id keyValue; - NSInteger startFrame; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.h deleted file mode 100755 index 699388d..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorFeature.value - */ - -#import "Compatibility.h" -#import "KFVectorGradientEffect.h" -#import "KFVectorPathTrim.h" - -@class KFVectorFeature; - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorFeature : NSObject - -@property (nonatomic, readonly, copy) NSString *name; -@property (nonatomic, readonly) NSInteger featureId; -@property (nonatomic, readonly) CGSize featureSize; -@property (nonatomic, readonly) NSInteger animationGroupId; -@property (nonatomic, readonly) NSUInteger fromFrame; -@property (nonatomic, readonly) NSUInteger toFrame; -@property (nonatomic, readonly, copy) UIColor *fillColor; -@property (nonatomic, readonly, copy) UIColor *strokeColor; -@property (nonatomic, readonly) CGFloat strokeWidth; -@property (nonatomic, readonly, copy) NSString *strokeLineCap; -@property (nonatomic, readonly, copy) NSArray *keyFrames; -@property (nonatomic, readonly, copy) NSArray *timingCurves; -@property (nonatomic, readonly, copy) NSArray *featureAnimations; -@property (nonatomic, readonly, copy) NSString *backedImage; -@property (nonatomic, readonly, copy) KFVectorFeature *masking; -@property (nonatomic, readonly, copy) KFVectorGradientEffect *gradientEffect; -@property (nonatomic, readonly, copy) KFVectorPathTrim *pathTrim; - -- (instancetype)initWithName:(NSString *)name featureId:(NSInteger)featureId featureSize:(CGSize)featureSize animationGroupId:(NSInteger)animationGroupId fromFrame:(NSUInteger)fromFrame toFrame:(NSUInteger)toFrame fillColor:(UIColor *)fillColor strokeColor:(UIColor *)strokeColor strokeWidth:(CGFloat)strokeWidth strokeLineCap:(NSString *)strokeLineCap keyFrames:(NSArray *)keyFrames timingCurves:(NSArray *)timingCurves featureAnimations:(NSArray *)featureAnimations backedImage:(NSString *)backedImage masking:(KFVectorFeature *)masking gradientEffect:(KFVectorGradientEffect *)gradientEffect pathTrim:(KFVectorPathTrim *)pathTrim; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.m deleted file mode 100755 index 4d21035..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.m +++ /dev/null @@ -1,242 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorFeature.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "Compatibility.h" -#import "KFVectorFeature.h" - -static __unsafe_unretained NSString * const kNameKey = @"NAME"; -static __unsafe_unretained NSString * const kFeatureIdKey = @"FEATURE_ID"; -static __unsafe_unretained NSString * const kFeatureSizeKey = @"FEATURE_SIZE"; -static __unsafe_unretained NSString * const kAnimationGroupIdKey = @"ANIMATION_GROUP_ID"; -static __unsafe_unretained NSString * const kFromFrameKey = @"FROM_FRAME"; -static __unsafe_unretained NSString * const kToFrameKey = @"TO_FRAME"; -static __unsafe_unretained NSString * const kFillColorKey = @"FILL_COLOR"; -static __unsafe_unretained NSString * const kStrokeColorKey = @"STROKE_COLOR"; -static __unsafe_unretained NSString * const kStrokeWidthKey = @"STROKE_WIDTH"; -static __unsafe_unretained NSString * const kStrokeLineCapKey = @"STROKE_LINE_CAP"; -static __unsafe_unretained NSString * const kKeyFramesKey = @"KEY_FRAMES"; -static __unsafe_unretained NSString * const kTimingCurvesKey = @"TIMING_CURVES"; -static __unsafe_unretained NSString * const kFeatureAnimationsKey = @"FEATURE_ANIMATIONS"; -static __unsafe_unretained NSString * const kBackedImageKey = @"BACKED_IMAGE"; -static __unsafe_unretained NSString * const kMaskingKey = @"MASKING"; -static __unsafe_unretained NSString * const kGradientEffectKey = @"GRADIENT_EFFECT"; -static __unsafe_unretained NSString * const kPathTrimKey = @"PATH_TRIM"; - -static NSUInteger HashFloat(float givenFloat) { - union { - float key; - uint32_t bits; - } u; - u.key = givenFloat; - NSUInteger h = (NSUInteger)u.bits; -#if !TARGET_RT_64_BIT - h = ~h + (h << 15); - h ^= (h >> 12); - h += (h << 2); - h ^= (h >> 4); - h *= 2057; - h ^= (h >> 16); -#else - h += ~h + (h << 21); - h ^= (h >> 24); - h = (h + (h << 3)) + (h << 8); - h ^= (h >> 14); - h = (h + (h << 2)) + (h << 4); - h ^= (h >> 28); - h += (h << 31); -#endif - return h; -} - -static NSUInteger HashDouble(double givenDouble) { - union { - double key; - uint64_t bits; - } u; - u.key = givenDouble; - NSUInteger p = u.bits; - p = (~p) + (p << 18); - p ^= (p >> 31); - p *= 21; - p ^= (p >> 11); - p += (p << 6); - p ^= (p >> 22); - return (NSUInteger) p; -} - -static NSUInteger HashCGFloat(CGFloat givenCGFloat) { -#if CGFLOAT_IS_DOUBLE - BOOL useDouble = YES; -#else - BOOL useDouble = NO; -#endif - if (useDouble) { - return HashDouble(givenCGFloat); - } else { - return HashFloat(givenCGFloat); - } -} - -static BOOL CompareFloats(float givenFloat, float floatToCompare) { - return fabsf(givenFloat - floatToCompare) < FLT_EPSILON * fabsf(givenFloat + floatToCompare) || fabsf(givenFloat - floatToCompare) < FLT_MIN; -} - -static BOOL CompareDoubles(double givenDouble, double doubleToCompare) { - return fabs(givenDouble - doubleToCompare) < DBL_EPSILON * fabs(givenDouble + doubleToCompare) || fabs(givenDouble - doubleToCompare) < DBL_MIN; -} - -static BOOL CompareCGFloats(CGFloat givenCGFloat, CGFloat cgFloatToCompare) { -#if CGFLOAT_IS_DOUBLE - BOOL useDouble = YES; -#else - BOOL useDouble = NO; -#endif - if (useDouble) { - return CompareDoubles(givenCGFloat, cgFloatToCompare); - } else { - return CompareFloats(givenCGFloat, cgFloatToCompare); - } -} - -@implementation KFVectorFeature - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _name = [aDecoder decodeObjectForKey:kNameKey]; - _featureId = [aDecoder decodeIntegerForKey:kFeatureIdKey]; - _featureSize = CGSizeFromString([aDecoder decodeObjectForKey:kFeatureSizeKey]); - _animationGroupId = [aDecoder decodeIntegerForKey:kAnimationGroupIdKey]; - _fromFrame = [aDecoder decodeIntegerForKey:kFromFrameKey]; - _toFrame = [aDecoder decodeIntegerForKey:kToFrameKey]; - _fillColor = [aDecoder decodeObjectForKey:kFillColorKey]; - _strokeColor = [aDecoder decodeObjectForKey:kStrokeColorKey]; - _strokeWidth = [aDecoder decodeFloatForKey:kStrokeWidthKey]; - _strokeLineCap = [aDecoder decodeObjectForKey:kStrokeLineCapKey]; - _keyFrames = [aDecoder decodeObjectForKey:kKeyFramesKey]; - _timingCurves = [aDecoder decodeObjectForKey:kTimingCurvesKey]; - _featureAnimations = [aDecoder decodeObjectForKey:kFeatureAnimationsKey]; - _backedImage = [aDecoder decodeObjectForKey:kBackedImageKey]; - _masking = [aDecoder decodeObjectForKey:kMaskingKey]; - _gradientEffect = [aDecoder decodeObjectForKey:kGradientEffectKey]; - _pathTrim = [aDecoder decodeObjectForKey:kPathTrimKey]; - } - return self; -} - -- (instancetype)initWithName:(NSString *)name featureId:(NSInteger)featureId featureSize:(CGSize)featureSize animationGroupId:(NSInteger)animationGroupId fromFrame:(NSUInteger)fromFrame toFrame:(NSUInteger)toFrame fillColor:(UIColor *)fillColor strokeColor:(UIColor *)strokeColor strokeWidth:(CGFloat)strokeWidth strokeLineCap:(NSString *)strokeLineCap keyFrames:(NSArray *)keyFrames timingCurves:(NSArray *)timingCurves featureAnimations:(NSArray *)featureAnimations backedImage:(NSString *)backedImage masking:(KFVectorFeature *)masking gradientEffect:(KFVectorGradientEffect *)gradientEffect pathTrim:(KFVectorPathTrim *)pathTrim -{ - if ((self = [super init])) { - _name = [name copy]; - _featureId = featureId; - _featureSize = featureSize; - _animationGroupId = animationGroupId; - _fromFrame = fromFrame; - _toFrame = toFrame; - _fillColor = [fillColor copy]; - _strokeColor = [strokeColor copy]; - _strokeWidth = strokeWidth; - _strokeLineCap = [strokeLineCap copy]; - _keyFrames = [keyFrames copy]; - _timingCurves = [timingCurves copy]; - _featureAnimations = [featureAnimations copy]; - _backedImage = [backedImage copy]; - _masking = [masking copy]; - _gradientEffect = [gradientEffect copy]; - _pathTrim = [pathTrim copy]; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t name: %@; \n\t featureId: %zd; \n\t featureSize: %@; \n\t animationGroupId: %zd; \n\t fromFrame: %tu; \n\t toFrame: %tu; \n\t fillColor: %@; \n\t strokeColor: %@; \n\t strokeWidth: %f; \n\t strokeLineCap: %@; \n\t keyFrames: %@; \n\t timingCurves: %@; \n\t featureAnimations: %@; \n\t backedImage: %@; \n\t masking: %@; \n\t gradientEffect: %@; \n\t pathTrim: %@; \n", [super description], _name, _featureId, NSStringFromCGSize(_featureSize), _animationGroupId, _fromFrame, _toFrame, _fillColor, _strokeColor, _strokeWidth, _strokeLineCap, _keyFrames, _timingCurves, _featureAnimations, _backedImage, _masking, _gradientEffect, _pathTrim]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_name forKey:kNameKey]; - [aCoder encodeInteger:_featureId forKey:kFeatureIdKey]; - [aCoder encodeObject:NSStringFromCGSize(_featureSize) forKey:kFeatureSizeKey]; - [aCoder encodeInteger:_animationGroupId forKey:kAnimationGroupIdKey]; - [aCoder encodeInteger:_fromFrame forKey:kFromFrameKey]; - [aCoder encodeInteger:_toFrame forKey:kToFrameKey]; - [aCoder encodeObject:_fillColor forKey:kFillColorKey]; - [aCoder encodeObject:_strokeColor forKey:kStrokeColorKey]; - [aCoder encodeFloat:_strokeWidth forKey:kStrokeWidthKey]; - [aCoder encodeObject:_strokeLineCap forKey:kStrokeLineCapKey]; - [aCoder encodeObject:_keyFrames forKey:kKeyFramesKey]; - [aCoder encodeObject:_timingCurves forKey:kTimingCurvesKey]; - [aCoder encodeObject:_featureAnimations forKey:kFeatureAnimationsKey]; - [aCoder encodeObject:_backedImage forKey:kBackedImageKey]; - [aCoder encodeObject:_masking forKey:kMaskingKey]; - [aCoder encodeObject:_gradientEffect forKey:kGradientEffectKey]; - [aCoder encodeObject:_pathTrim forKey:kPathTrimKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_name hash], ABS(_featureId), HashCGFloat(_featureSize.width), HashCGFloat(_featureSize.height), ABS(_animationGroupId), _fromFrame, _toFrame, [_fillColor hash], [_strokeColor hash], HashCGFloat(_strokeWidth), [_strokeLineCap hash], [_keyFrames hash], [_timingCurves hash], [_featureAnimations hash], [_backedImage hash], [_masking hash], [_gradientEffect hash], [_pathTrim hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 18; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorFeature *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - _animationGroupId == object->_animationGroupId && - _fromFrame == object->_fromFrame && - _toFrame == object->_toFrame && - _featureId == object->_featureId && - CompareCGFloats(_strokeWidth, object->_strokeWidth) && - CGSizeEqualToSize(_featureSize, object->_featureSize) && - (_fillColor == object->_fillColor ? YES : [_fillColor isEqual:object->_fillColor]) && - (_strokeColor == object->_strokeColor ? YES : [_strokeColor isEqual:object->_strokeColor]) && - (_name == object->_name ? YES : [_name isEqual:object->_name]) && - (_strokeLineCap == object->_strokeLineCap ? YES : [_strokeLineCap isEqual:object->_strokeLineCap]) && - (_keyFrames == object->_keyFrames ? YES : [_keyFrames isEqual:object->_keyFrames]) && - (_timingCurves == object->_timingCurves ? YES : [_timingCurves isEqual:object->_timingCurves]) && - (_featureAnimations == object->_featureAnimations ? YES : [_featureAnimations isEqual:object->_featureAnimations]) && - (_backedImage == object->_backedImage ? YES : [_backedImage isEqual:object->_backedImage]) && - (_masking == object->_masking ? YES : [_masking isEqual:object->_masking]) && - (_gradientEffect == object->_gradientEffect ? YES : [_gradientEffect isEqual:object->_gradientEffect]) && - (_pathTrim == object->_pathTrim ? YES : [_pathTrim isEqual:object->_pathTrim]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.value deleted file mode 100755 index d79560f..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeature.value +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorFeature includes(RMCoding) { - NSString *name; - NSInteger featureId; - CGSize featureSize; - NSInteger animationGroupId; - NSUInteger fromFrame; - NSUInteger toFrame; - %import library=UIKit name=UIColor - UIColor *fillColor; - %import library=UIKit name=UIColor - UIColor *strokeColor; - CGFloat strokeWidth; - NSString *strokeLineCap; - NSArray *keyFrames; - NSArray *timingCurves; - NSArray *featureAnimations; - NSString *backedImage; - %import library=keyframes name=KFVectorFeature - KFVectorFeature *masking; - %import library=keyframes name=KFVectorGradientEffect - KFVectorGradientEffect *gradientEffect; - %import library=keyframes name=KFVectorPathTrim - KFVectorPathTrim *pathTrim; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.h deleted file mode 100755 index 9018008..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorFeatureKeyFrame.value - */ - -#import - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorFeatureKeyFrame : NSObject - -@property (nonatomic, readonly, copy) NSString *type; -@property (nonatomic, readonly, copy) NSArray *paths; -@property (nonatomic, readonly) NSInteger startFrame; - -- (instancetype)initWithType:(NSString *)type paths:(NSArray *)paths startFrame:(NSInteger)startFrame; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.m deleted file mode 100755 index 55dae05..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.m +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorFeatureKeyFrame.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "KFVectorFeatureKeyFrame.h" - -static __unsafe_unretained NSString * const kTypeKey = @"TYPE"; -static __unsafe_unretained NSString * const kPathsKey = @"PATHS"; -static __unsafe_unretained NSString * const kStartFrameKey = @"START_FRAME"; - -@implementation KFVectorFeatureKeyFrame - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _type = [aDecoder decodeObjectForKey:kTypeKey]; - _paths = [aDecoder decodeObjectForKey:kPathsKey]; - _startFrame = [aDecoder decodeIntegerForKey:kStartFrameKey]; - } - return self; -} - -- (instancetype)initWithType:(NSString *)type paths:(NSArray *)paths startFrame:(NSInteger)startFrame -{ - if ((self = [super init])) { - _type = [type copy]; - _paths = [paths copy]; - _startFrame = startFrame; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t type: %@; \n\t paths: %@; \n\t startFrame: %zd; \n", [super description], _type, _paths, _startFrame]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_type forKey:kTypeKey]; - [aCoder encodeObject:_paths forKey:kPathsKey]; - [aCoder encodeInteger:_startFrame forKey:kStartFrameKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_type hash], [_paths hash], ABS(_startFrame)}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 3; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorFeatureKeyFrame *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - _startFrame == object->_startFrame && - (_type == object->_type ? YES : [_type isEqual:object->_type]) && - (_paths == object->_paths ? YES : [_paths isEqual:object->_paths]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.value deleted file mode 100755 index 3dd6702..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorFeatureKeyFrame.value +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorFeatureKeyFrame includes(RMCoding) { - NSString *type; - NSArray *paths; - NSInteger startFrame; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.h deleted file mode 100755 index 438a7d7..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorGradientEffect.value - */ - -#import -#import "KFVectorAnimation.h" - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorGradientEffect : NSObject - -@property (nonatomic, readonly, copy) NSString *gradientTypeString; -@property (nonatomic, readonly, copy) KFVectorAnimation *colorStart; -@property (nonatomic, readonly, copy) KFVectorAnimation *colorEnd; -@property (nonatomic, readonly, copy) KFVectorAnimation *rampStart; -@property (nonatomic, readonly, copy) KFVectorAnimation *rampEnd; - -- (instancetype)initWithGradientTypeString:(NSString *)gradientTypeString colorStart:(KFVectorAnimation *)colorStart colorEnd:(KFVectorAnimation *)colorEnd rampStart:(KFVectorAnimation *)rampStart rampEnd:(KFVectorAnimation *)rampEnd; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.m deleted file mode 100755 index 9c75af4..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.m +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorGradientEffect.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "KFVectorGradientEffect.h" - -static __unsafe_unretained NSString * const kGradientTypeStringKey = @"GRADIENT_TYPE_STRING"; -static __unsafe_unretained NSString * const kColorStartKey = @"COLOR_START"; -static __unsafe_unretained NSString * const kColorEndKey = @"COLOR_END"; -static __unsafe_unretained NSString * const kRampStartKey = @"RAMP_START"; -static __unsafe_unretained NSString * const kRampEndKey = @"RAMP_END"; - -@implementation KFVectorGradientEffect - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _gradientTypeString = [aDecoder decodeObjectForKey:kGradientTypeStringKey]; - _colorStart = [aDecoder decodeObjectForKey:kColorStartKey]; - _colorEnd = [aDecoder decodeObjectForKey:kColorEndKey]; - _rampStart = [aDecoder decodeObjectForKey:kRampStartKey]; - _rampEnd = [aDecoder decodeObjectForKey:kRampEndKey]; - } - return self; -} - -- (instancetype)initWithGradientTypeString:(NSString *)gradientTypeString colorStart:(KFVectorAnimation *)colorStart colorEnd:(KFVectorAnimation *)colorEnd rampStart:(KFVectorAnimation *)rampStart rampEnd:(KFVectorAnimation *)rampEnd -{ - if ((self = [super init])) { - _gradientTypeString = [gradientTypeString copy]; - _colorStart = [colorStart copy]; - _colorEnd = [colorEnd copy]; - _rampStart = [rampStart copy]; - _rampEnd = [rampEnd copy]; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t gradientTypeString: %@; \n\t colorStart: %@; \n\t colorEnd: %@; \n\t rampStart: %@; \n\t rampEnd: %@; \n", [super description], _gradientTypeString, _colorStart, _colorEnd, _rampStart, _rampEnd]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_gradientTypeString forKey:kGradientTypeStringKey]; - [aCoder encodeObject:_colorStart forKey:kColorStartKey]; - [aCoder encodeObject:_colorEnd forKey:kColorEndKey]; - [aCoder encodeObject:_rampStart forKey:kRampStartKey]; - [aCoder encodeObject:_rampEnd forKey:kRampEndKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_gradientTypeString hash], [_colorStart hash], [_colorEnd hash], [_rampStart hash], [_rampEnd hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 5; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorGradientEffect *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - (_gradientTypeString == object->_gradientTypeString ? YES : [_gradientTypeString isEqual:object->_gradientTypeString]) && - (_colorStart == object->_colorStart ? YES : [_colorStart isEqual:object->_colorStart]) && - (_colorEnd == object->_colorEnd ? YES : [_colorEnd isEqual:object->_colorEnd]) && - (_rampStart == object->_rampStart ? YES : [_rampStart isEqual:object->_rampStart]) && - (_rampEnd == object->_rampEnd ? YES : [_rampEnd isEqual:object->_rampEnd]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.value deleted file mode 100755 index c8acba4..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorGradientEffect.value +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorGradientEffect includes(RMCoding) { - NSString *gradientTypeString; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *colorStart; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *colorEnd; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *rampStart; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *rampEnd; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.h b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.h deleted file mode 100755 index 3b20d8b..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorPathTrim.value - */ - -#import -#import "KFVectorAnimation.h" - -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -@interface KFVectorPathTrim : NSObject - -@property (nonatomic, readonly, copy) KFVectorAnimation *pathTrimStart; -@property (nonatomic, readonly, copy) KFVectorAnimation *pathTrimEnd; -@property (nonatomic, readonly, copy) KFVectorAnimation *pathTrimOffset; - -- (instancetype)initWithPathTrimStart:(KFVectorAnimation *)pathTrimStart pathTrimEnd:(KFVectorAnimation *)pathTrimEnd pathTrimOffset:(KFVectorAnimation *)pathTrimOffset; - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.m b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.m deleted file mode 100755 index 24a701f..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.m +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -/** - * This file is generated using the remodel generation script. - * The name of the input file is KFVectorPathTrim.value - */ - -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). -#endif - -#import "KFVectorPathTrim.h" - -static __unsafe_unretained NSString * const kPathTrimStartKey = @"PATH_TRIM_START"; -static __unsafe_unretained NSString * const kPathTrimEndKey = @"PATH_TRIM_END"; -static __unsafe_unretained NSString * const kPathTrimOffsetKey = @"PATH_TRIM_OFFSET"; - -@implementation KFVectorPathTrim - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if ((self = [super init])) { - _pathTrimStart = [aDecoder decodeObjectForKey:kPathTrimStartKey]; - _pathTrimEnd = [aDecoder decodeObjectForKey:kPathTrimEndKey]; - _pathTrimOffset = [aDecoder decodeObjectForKey:kPathTrimOffsetKey]; - } - return self; -} - -- (instancetype)initWithPathTrimStart:(KFVectorAnimation *)pathTrimStart pathTrimEnd:(KFVectorAnimation *)pathTrimEnd pathTrimOffset:(KFVectorAnimation *)pathTrimOffset -{ - if ((self = [super init])) { - _pathTrimStart = [pathTrimStart copy]; - _pathTrimEnd = [pathTrimEnd copy]; - _pathTrimOffset = [pathTrimOffset copy]; - } - - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ - \n\t pathTrimStart: %@; \n\t pathTrimEnd: %@; \n\t pathTrimOffset: %@; \n", [super description], _pathTrimStart, _pathTrimEnd, _pathTrimOffset]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_pathTrimStart forKey:kPathTrimStartKey]; - [aCoder encodeObject:_pathTrimEnd forKey:kPathTrimEndKey]; - [aCoder encodeObject:_pathTrimOffset forKey:kPathTrimOffsetKey]; -} - -- (NSUInteger)hash -{ - NSUInteger subhashes[] = {[_pathTrimStart hash], [_pathTrimEnd hash], [_pathTrimOffset hash]}; - NSUInteger result = subhashes[0]; - for (int ii = 1; ii < 3; ++ii) { - unsigned long long base = (((unsigned long long)result) << 32 | subhashes[ii]); - base = (~base) + (base << 18); - base ^= (base >> 31); - base *= 21; - base ^= (base >> 11); - base += (base << 6); - base ^= (base >> 22); - result = base; - } - return result; -} - -- (BOOL)isEqual:(KFVectorPathTrim *)object -{ - if (self == object) { - return YES; - } else if (self == nil || object == nil || ![object isKindOfClass:[self class]]) { - return NO; - } - return - (_pathTrimStart == object->_pathTrimStart ? YES : [_pathTrimStart isEqual:object->_pathTrimStart]) && - (_pathTrimEnd == object->_pathTrimEnd ? YES : [_pathTrimEnd isEqual:object->_pathTrimEnd]) && - (_pathTrimOffset == object->_pathTrimOffset ? YES : [_pathTrimOffset isEqual:object->_pathTrimOffset]); -} - -@end - diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.value b/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.value deleted file mode 100755 index 672f251..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/KFVectorPathTrim.value +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2016-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -KFVectorPathTrim includes(RMCoding) { - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *pathTrimStart; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *pathTrimEnd; - %import library=keyframes name=KFVectorAnimation - KFVectorAnimation *pathTrimOffset; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/DataModel/remodel-plugins/fb-copyright-header-comment.js b/ios/Classes/Keyframes/keyframes-ios/DataModel/remodel-plugins/fb-copyright-header-comment.js deleted file mode 100755 index cd0dd67..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/DataModel/remodel-plugins/fb-copyright-header-comment.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; -var HEADER_COMMENTS = [ - { content: '/**\n * Copyright (c) 2016-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */' } -]; -function createPlugin() { - return { - additionalFiles: function (valueType) { - return []; - }, - additionalTypes: function (valueType) { - return []; - }, - attributes: function (valueType) { - return []; - }, - fileTransformation: function (request) { - return request; - }, - fileType: function (valueType) { - return {value: null}; - }, - forwardDeclarations: function (valueType) { - return []; - }, - functions: function (valueType) { - return []; - }, - headerComments: function (valueType) { - return HEADER_COMMENTS; - }, - implementedProtocols: function (valueType) { - return []; - }, - imports: function (valueType) { - return []; - }, - instanceMethods: function (valueType) { - return []; - }, - properties: function (valueType) { - return []; - }, - requiredIncludesToRun: [], - staticConstants: function (valueType) { - return []; - }, - validationErrors: function (valueType) { - return []; - } - }; -} -exports.createPlugin = createPlugin; -function createAlgebraicTypePlugin() { - return { - additionalFiles: function (algebraicType) { - return []; - }, - blockTypes: function (algebraicType) { - return []; - }, - classMethods: function (algebraicType) { - return []; - }, - enumerations: function (algebraicType) { - return []; - }, - fileTransformation: function (request) { - return request; - }, - fileType: function (algebraicType) { - return Maybe.Nothing(); - }, - forwardDeclarations: function (algebraicType) { - return []; - }, - functions: function (algebraicType) { - return []; - }, - headerComments: function (algebraicType) { - return HEADER_COMMENTS; - }, - implementedProtocols: function (algebraicType) { - return []; - }, - imports: function (algebraicType) { - return []; - }, - instanceMethods: function (algebraicType) { - return []; - }, - internalProperties: function (algebraicType) { - return []; - }, - requiredIncludesToRun: [], - staticConstants: function (algebraicType) { - return []; - }, - validationErrors: function (algebraicType) { - return []; - } - }; -} -exports.createAlgebraicTypePlugin = createAlgebraicTypePlugin; diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.h b/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.h deleted file mode 100755 index 02e98a5..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -@interface CAMediaTimingFunction (KFVectorLayer) - -/// Returns y value at x -- (CGFloat)valueAtX:(CGFloat)x inDuration:(CGFloat)duration; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.m b/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.m deleted file mode 100755 index a3a5522..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/CAMediaTimingFunction+KFVectorLayer.m +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "CAMediaTimingFunction+KFVectorLayer.h" - -// based on https://gist.github.com/raphaelschaad/6739676 -@implementation CAMediaTimingFunction (KFVectorLayer) - -- (CGFloat)valueAtX:(CGFloat)x inDuration:(CGFloat)duration -{ - float vec[4] = {0.}; - - [self getControlPointAtIndex:1 values:&vec[0]]; - [self getControlPointAtIndex:2 values:&vec[2]]; - CGPoint p1 = CGPointMake(vec[0], vec[1]); - CGPoint p2 = CGPointMake(vec[2], vec[3]); - - CGFloat cx = 3.0 * p1.x; - CGFloat bx = 3.0 * (p2.x - p1.x) - cx; - CGFloat ax = 1.0 - cx - bx; - - CGFloat cy = 3.0 * p1.y; - CGFloat by = 3.0 * (p2.y - p1.y) - cy; - CGFloat ay = 1.0 - cy - by; - - CGFloat epsilon = 1.0 / (200 * duration); - CGFloat xSolved = [self solveCurveX:x epsilon:epsilon ax:ax bx:bx cx:cx]; - CGFloat y = [self sampleCurveY:xSolved ay:ay by:by cy:cy]; - return y; -} - -#pragma mark - Beizer Maths - -// Cubic Bezier math code is based on WebCore (WebKit) -// http://opensource.apple.com/source/WebCore/WebCore-955.66/platform/graphics/UnitBezier.h -// http://opensource.apple.com/source/WebCore/WebCore-955.66/page/animation/AnimationBase.cpp - -/* - * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -- (void)calculatePolynomialCoefficients -{ -} - - -- (CGFloat)sampleCurveX:(CGFloat)t - ax:(CGFloat)ax bx:(CGFloat)bx cx:(CGFloat)cx -{ - return ((ax * t + bx) * t + cx) * t; -} - -- (CGFloat)sampleCurveY:(CGFloat)t - ay:(CGFloat)ay by:(CGFloat)by cy:(CGFloat)cy -{ - return ((ay * t + by) * t + cy) * t; -} - - -- (CGFloat)sampleCurveDerivativeX:(CGFloat)t - ax:(CGFloat)ax bx:(CGFloat)bx cx:(CGFloat)cx -{ - return (3.0 * ax * t + 2.0 * bx) * t + cx; -} - - -// Given an x value, find a parametric value it came from. -- (CGFloat)solveCurveX:(CGFloat)x epsilon:(CGFloat)epsilon - ax:(CGFloat)ax bx:(CGFloat)bx cx:(CGFloat)cx -{ - CGFloat t0; - CGFloat t1; - CGFloat t2; - CGFloat x2; - CGFloat d2; - NSUInteger i; - - // First try a few iterations of Newton's method -- normally very fast. - for (t2 = x, i = 0; i < 8; i++) { - x2 = [self sampleCurveX:t2 ax:ax bx:bx cx:cx] - x; - if (fabs(x2) < epsilon) { - return t2; - } - d2 = [self sampleCurveDerivativeX:t2 ax:ax bx:bx cx:cx]; - if (fabs(d2) < 1e-6) { - break; - } - t2 = t2 - x2 / d2; - } - - // Fall back to the bisection method for reliability. - t0 = 0.0; - t1 = 1.0; - t2 = x; - - if (t2 < t0) { - return t0; - } - if (t2 > t1) { - return t1; - } - - while (t0 < t1) { - x2 = [self sampleCurveX:t2 ax:ax bx:bx cx:cx]; - if (fabs(x2 - x) < epsilon) { - return t2; - } - if (x > x2) { - t0 = t2; - } else { - t1 = t2; - } - t2 = (t1 - t0) * 0.5 + t0; - } - - // Failure. - return t2; -} - - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.h b/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.h deleted file mode 100755 index 8977f4f..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#ifndef KFBASE_DEFINES_H -#define KFBASE_DEFINES_H - -#ifdef __cplusplus -# define KF_EXTERN_C_BEGIN extern "C" { -# define KF_EXTERN_C_END } -#else -# define KF_EXTERN_C_BEGIN -# define KF_EXTERN_C_END -#endif - -#endif - -#import - -#import - -#if TARGET_OS_OSX - @class NSColor; -#else - @class UIColor; -#endif - -typedef id (^KFMapArrayHandler)(id object); -typedef id (^KFMapArrayWithIndexHandler)(id object, NSUInteger index); - -NSArray *KFMapArray(NSArray *arrayToMap, KFMapArrayHandler mapBlock); -NSArray *KFMapArrayWithIndex(NSArray *arrayToMap, KFMapArrayWithIndexHandler mapBlock); - -#if TARGET_OS_OSX - NSColor *KFColorWithHexString(NSString *hexString); -#else - UIColor *KFColorWithHexString(NSString *hexString); -#endif - -BOOL KFVersionLessThan(NSString *versionA, NSString *versionB); - -@interface NSMutableArray (KFFoundation) - -- (void)removeFirstObject; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.m b/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.m deleted file mode 100755 index a5565b2..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/KFUtilities.m +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFUtilities.h" - -#import "Compatibility.h" - -NSArray *KFMapArray(NSArray *arrayToMap, KFMapArrayHandler mapBlock) { - NSMutableArray *mappedArray = [NSMutableArray array]; - for (id object in arrayToMap) { - id result = mapBlock(object); - if (result != nil) { - [mappedArray addObject:result]; - } - } - return mappedArray; -} - -NSArray *KFMapArrayWithIndex(NSArray *arrayToMap, KFMapArrayWithIndexHandler mapBlock) -{ - NSMutableArray *mappedArray = [NSMutableArray array]; - NSUInteger index = 0; - for (id object in arrayToMap) { - id result = mapBlock(object, index); - if (result != nil) { - [mappedArray addObject:result]; - } - index++; - } - return mappedArray; -} - -UIColor *KFColorWithHexString(NSString *string) -{ - NSString *hexString = [string copy]; - if ([hexString hasPrefix:@"#"]) { - hexString = [hexString substringFromIndex:1]; - } - - NSScanner *scanner = [NSScanner scannerWithString:hexString]; - unsigned int rgb; - - if ([scanner scanHexInt:&rgb]) { - // default alpha is ff if not included in input - unsigned int alpha = (rgb >> 24) & 0xff; - if (hexString.length <= 6 || (([hexString hasPrefix:@"0x"] || [hexString hasPrefix:@"0X"]) && hexString.length <= 8)) { - alpha = 0xff; - } - return [UIColor colorWithRed:((CGFloat)((rgb >> 16) & 0xff) / 255) - green:((CGFloat)((rgb >> 8) & 0xff) / 255) - blue:((CGFloat)((rgb >> 0) & 0xff) / 255) - alpha:((CGFloat)(alpha) / 255)]; - } - - return [UIColor blackColor]; -} - -BOOL KFVersionLessThan(NSString *versionA, NSString *versionB) -{ - return [versionA compare:versionB options:NSNumericSearch] == NSOrderedAscending; -} - -@implementation NSMutableArray (KFFoundation) - -- (void)removeFirstObject -{ - if (self.count > 0) { - [self removeObjectAtIndex:0]; - } -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.h b/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.h deleted file mode 100755 index 484c999..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -@interface UIBezierPath (KFVectorLayer) - -/// Returns the trimmed path, start should be from 0..1 and end should be from 0..1 -- (UIBezierPath *)pathTrimFrom:(CGFloat)start to:(CGFloat)end; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.m b/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.m deleted file mode 100755 index f837ef7..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Helpers/UIBezierPath+KFVectorLayer.m +++ /dev/null @@ -1,492 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "UIBezierPath+KFVectorLayer.h" - -typedef void(^KFBezierPathEnumerationBlock)(const CGPathElement *element); -typedef struct KFBezierPathSubpath { - CGPathElementType type; - CGFloat length; - CGPoint startPoint; - CGPoint endPoint; - CGPoint controlPoint1; - CGPoint controlPoint2; -} KFBezierPathSubpath; - -@implementation UIBezierPath (KFVectorLayer) - -- (UIBezierPath *)pathTrimFrom:(CGFloat)start to:(CGFloat)end -{ - NSAssert(0.0 <= start && start <= 1.0, @"start should be from 0.0 to 1.0"); - NSAssert(0.0 <= end && end <= 1.0, @"end should be from 0.0 to 1.0"); - - NSUInteger subpathCount = [self _subpathsCount]; - KFBezierPathSubpath subpaths[subpathCount]; - [self _extractAllSubpaths:subpaths withLength:YES]; - - CGFloat length = 0.0f; - for (NSUInteger i = 0; i < subpathCount; ++i) { - length += subpaths[i].length; - } - - NSUInteger startTargetSubpathIndex; - CGFloat startTargetProgress; - findTargetSubpath(start, subpaths, subpathCount, - &startTargetSubpathIndex, &startTargetProgress); - - NSUInteger endTargetSubpathIndex; - CGFloat endTargetProgress; - findTargetSubpath(end, subpaths, subpathCount, - &endTargetSubpathIndex, &endTargetProgress); - - UIBezierPath *trimmedPath = [UIBezierPath bezierPath]; - [trimmedPath moveToPoint:subpaths[0].startPoint]; - - if (startTargetSubpathIndex == endTargetSubpathIndex) { - // trim on same subpath - [self _trimSubpath:&subpaths[endTargetSubpathIndex] - from:startTargetProgress - to:endTargetProgress - appendToPath:trimmedPath]; - } else { - // trim start path - [self _trimSubpath:&subpaths[startTargetSubpathIndex] - from:startTargetProgress - to:1.0 - appendToPath:trimmedPath]; - - // connect all parts between - for (NSUInteger i = startTargetSubpathIndex + 1; i < endTargetSubpathIndex; ++i) { - switch (subpaths[i].type) { - case kCGPathElementMoveToPoint: - [trimmedPath moveToPoint:subpaths[i].endPoint]; - break; - case kCGPathElementAddLineToPoint: - [trimmedPath addLineToPoint:subpaths[i].endPoint]; - break; - case kCGPathElementAddQuadCurveToPoint: - [trimmedPath addQuadCurveToPoint:subpaths[i].endPoint - controlPoint:subpaths[i].controlPoint1]; - break; - case kCGPathElementAddCurveToPoint: - [trimmedPath addCurveToPoint:subpaths[i].endPoint - controlPoint1:subpaths[i].controlPoint1 - controlPoint2:subpaths[i].controlPoint2]; - break; - case kCGPathElementCloseSubpath: - [trimmedPath closePath]; - break; - } - } - - // trim end path - [self _trimSubpath:&subpaths[endTargetSubpathIndex] - from:0.0 - to:endTargetProgress - appendToPath:trimmedPath]; - } - - return trimmedPath; -} - -#pragma mark - private - -static void findTargetSubpath(CGFloat progress, KFBezierPathSubpath *subpaths, NSUInteger count, - NSUInteger *targetSubpathIndex, CGFloat *targetProgress) -{ - CGFloat length = 0.0; - for (NSUInteger i = 0; i < count; ++i) { - length += subpaths[i].length; - } - - CGFloat targetLength = length * progress; - CGFloat currentLength = 0; - for (NSUInteger i = 0; i < count; ++i) { - if (currentLength + subpaths[i].length >= targetLength) { - *targetSubpathIndex = i; - break; - } else { - currentLength += subpaths[i].length; - } - } - - CGFloat lengthInSubpath = targetLength - currentLength; - if (subpaths[*targetSubpathIndex].length == 0) { - *targetProgress = 1.0; - } else { - *targetProgress = lengthInSubpath / subpaths[*targetSubpathIndex].length; - } -} - -static void subpathEnumerationCallback(void *info, const CGPathElement *element) -{ - KFBezierPathEnumerationBlock block = (__bridge KFBezierPathEnumerationBlock)info; - if (block) { - block(element); - } -} - -- (void)_enumerateElementsUsingBlock:(KFBezierPathEnumerationBlock)block -{ - CGPathApply(self.CGPath, (__bridge void *)block, subpathEnumerationCallback); -} - -- (NSUInteger)_subpathsCount -{ - __block NSUInteger count = 0; - [self _enumerateElementsUsingBlock:^(const CGPathElement *element) { - if (element->type != kCGPathElementMoveToPoint) { - count++; - } - }]; - return count; -} - -- (void)_extractAllSubpaths:(KFBezierPathSubpath*)subpaths withLength:(BOOL)withLength -{ - __block CGPoint currentPoint = CGPointZero; - __block NSUInteger i = 0; - [self _enumerateElementsUsingBlock:^(const CGPathElement *element) { - - KFBezierPathSubpath subpath; - subpath.type = element->type; - subpath.startPoint = currentPoint; - switch (element->type) { - case kCGPathElementMoveToPoint: - subpath.endPoint = element->points[0]; - if (withLength) { - subpath.length = 0.0; - } - break; - case kCGPathElementAddLineToPoint: - subpath.endPoint = element->points[0]; - if (withLength) { - subpath.length = linearLength(currentPoint, subpath.endPoint); - } - break; - case kCGPathElementAddQuadCurveToPoint: - subpath.endPoint = element->points[1]; - subpath.controlPoint1 = element->points[0]; - if (withLength) { - subpath.length = quadraticLength(currentPoint, subpath.endPoint, subpath.controlPoint1); - } - break; - case kCGPathElementAddCurveToPoint: - subpath.endPoint = element->points[2]; - subpath.controlPoint1 = element->points[0]; - subpath.controlPoint2 = element->points[1]; - if (withLength) { - subpath.length = cubicLength(currentPoint, subpath.endPoint, subpath.controlPoint1, subpath.controlPoint2); - } - break; - case kCGPathElementCloseSubpath: - break; - } - if (element->type != kCGPathElementMoveToPoint) { - subpaths[i++] = subpath; - } - currentPoint = subpath.endPoint; - }]; -} - -- (CGFloat)_lengthPercentageToParameter:(CGFloat)p ofSuboath:(const KFBezierPathSubpath *)path -{ - CGFloat left = 0; - CGFloat right = 1.0; - while (right - left > 1e-2) { - CGFloat mid = (left + right) / 2; - CGFloat length = [self _lengthAtT:mid ofSubpath:path]; - if (length / path->length > p) { - right = mid; - } else { - left = mid; - } - } - return (left + right) / 2; -} - -- (CGFloat)_lengthAtT:(CGFloat)t ofSubpath:(const KFBezierPathSubpath *)subpath -{ - switch (subpath->type) { - case kCGPathElementAddLineToPoint: - return t; - case kCGPathElementAddQuadCurveToPoint: - return [self _quadraticLengthAtT:t ofSubpath:subpath]; - case kCGPathElementAddCurveToPoint: - return [self _cubicLengthAtT:t ofSubpath:subpath]; - case kCGPathElementMoveToPoint: - case kCGPathElementCloseSubpath: - break; - } - return NAN; -} - -- (CGFloat)_quadraticLengthAtT:(CGFloat)t ofSubpath:(const KFBezierPathSubpath *)subpath -{ - CGFloat u = 1.0 - t; - - CGPoint p1 = subpath->startPoint; - CGPoint p2 = subpath->controlPoint1; - CGPoint p3 = subpath->endPoint; - - CGPoint q1 = p1; - CGPoint q2 = CGPointMake( - u * p1.x + t * p2.x, - u * p1.y + t * p2.y - ); - CGPoint q3 = CGPointMake( - u*u * p1.x + (u*t + t*u) * p2.x + t*t * p3.x, - u*u * p1.y + (u*t + t*u) * p2.y + t*t * p3.y - ); - - return quadraticLength(q1, q2, q3); -} - -- (CGFloat)_cubicLengthAtT:(CGFloat)t ofSubpath:(const KFBezierPathSubpath *)subpath -{ - CGFloat u = 1.0 - t; - - CGPoint p1 = subpath->startPoint; - CGPoint p2 = subpath->controlPoint1; - CGPoint p3 = subpath->controlPoint2; - CGPoint p4 = subpath->endPoint; - - CGPoint q1 = p1; - CGPoint q2 = CGPointMake( - u * p1.x + t * p2.x, - u * p1.y + t * p2.y - ); - CGPoint q3 = CGPointMake( - u*u * p1.x + (t*u + u*t) * p2.x + (t*t) * p3.x, - u*u * p1.y + (t*u + u*t) * p2.y + (t*t) * p3.y - ); - CGPoint q4 = CGPointMake( - u*u*u * p1.x + (t*u*u + u*t*u + u*u*t) * p2.x + (t*t*u + u*t*t + t*u*t) * p3.x + t*t*t * p4.x, - u*u*u * p1.y + (t*u*u + u*t*u + u*u*t) * p2.y + (t*t*u + u*t*t + t*u*t) * p3.y + t*t*t * p4.y - ); - - return cubicLength(q1, q4, q2, q3); -} - -- (void)_trimSubpath:(const KFBezierPathSubpath *)subpath from:(CGFloat)start to:(CGFloat)end appendToPath:(UIBezierPath *)path -{ - CGFloat startT = [self _lengthPercentageToParameter:start ofSuboath:subpath]; - CGFloat endT = [self _lengthPercentageToParameter:end ofSuboath:subpath]; - switch (subpath->type) { - case kCGPathElementAddLineToPoint: - [self _trimLinearSubpath:subpath from:startT to:endT appendToPath:path]; - break; - case kCGPathElementAddQuadCurveToPoint: - [self _trimQuadraticSubpath:subpath from:startT to:endT appendToPath:path]; - break; - case kCGPathElementAddCurveToPoint: - [self _trimCubicSubpath:subpath from:startT to:endT appendToPath:path]; - break; - case kCGPathElementMoveToPoint: - case kCGPathElementCloseSubpath: - break; - } -} - -- (void)_trimLinearSubpath:(const KFBezierPathSubpath *)subpath from:(CGFloat)start to:(CGFloat)end - appendToPath:(UIBezierPath *)path -{ - // based on the formula - // Q1 = u0 P1 + t0 P2 - // Q2 = u1 P1 + t1 P2 - - CGFloat t0 = start; - CGFloat t1 = end; - CGFloat u0 = 1.0 - t0; - CGFloat u1 = 1.0 - t1; - - CGPoint p1 = subpath->startPoint; - CGPoint p2 = subpath->endPoint; - - CGPoint q1 = CGPointMake( - u0 * p1.x + t0 * p2.x, - u0 * p1.y + t0 * p2.y - ); - CGPoint q2 = CGPointMake( - u1 * p1.x + t1 * p2.x, - u1 * p1.y + t1 * p2.y - ); - - if (start != 0.0) { - [path moveToPoint:q1]; - } - [path addLineToPoint:q2]; -} - -- (void)_trimQuadraticSubpath:(const KFBezierPathSubpath *)subpath from:(CGFloat)start to:(CGFloat)end - appendToPath:(UIBezierPath *)path -{ - // based on the formula - // Q1 = u0u0 P1 + (u0t0 + t0u0) P2 + t0t0 P3 - // Q2 = u0u1 P1 + (u0t1 + t0u1) P2 + t0t1 P3 - // Q3 = u1u1 P1 + (u1t1 + t1u1) P2 + t1t1 P3 - - CGFloat t0 = start; - CGFloat t1 = end; - CGFloat u0 = 1.0 - t0; - CGFloat u1 = 1.0 - t1; - - CGPoint p1 = subpath->startPoint; - CGPoint p2 = subpath->controlPoint1; - CGPoint p3 = subpath->endPoint; - - CGPoint q1 = CGPointMake( - u0*u0 * p1.x + (u0*t0 + t0*u0) * p2.x + t0*t0 * p3.x, - u0*u0 * p1.y + (u0*t0 + t0*u0) * p2.y + t0*t0 * p3.y - ); - CGPoint q2 = CGPointMake( - u0*u1 * p1.x + (u0*t1 + t0*u1) * p2.x + t0*t1 * p3.x, - u0*u1 * p1.y + (u0*t1 + t0*u1) * p2.y + t0*t1 * p3.y - ); - CGPoint q3 = CGPointMake( - u1*u1 * p1.x + (u1*t1 + t1*u1) * p2.x + t1*t1 * p3.x, - u1*u1 * p1.y + (u1*t1 + t1*u1) * p2.y + t1*t1 * p3.y - ); - - if (start != 0.0) { - [path moveToPoint:q1]; - } - [path addQuadCurveToPoint:q3 controlPoint:q2]; -} - -- (void)_trimCubicSubpath:(const KFBezierPathSubpath *)subpath from:(CGFloat)start to:(CGFloat)end - appendToPath:(UIBezierPath *)path -{ - // based on the formula - // Q1 = u0u0u0 P1 + (t0u0u0 + u0t0u0 + u0u0t0) P2 + (t0t0u0 + u0t0t0 + t0u0t0) P3 + t0t0t0 P4 - // Q2 = u0u0u1 P1 + (t0u0u1 + u0t0u1 + u0u0t1) P2 + (t0t0u1 + u0t0t1 + t0u0t1) P3 + t0t0t1 P4 - // Q3 = u0u1u1 P1 + (t0u1u1 + u0t1u1 + u0u1t1) P2 + (t0t1u1 + u0t1t1 + t0u1t1) P3 + t0t1t1 P4 - // Q4 = u1u1u1 P1 + (t1u1u1 + u1t1u1 + u1u1t1) P2 + (t1t1u1 + u1t1t1 + t1u1t1) P3 + t1t1t1 P4 - - CGFloat t0 = start; - CGFloat t1 = end; - CGFloat u0 = 1.0 - t0; - CGFloat u1 = 1.0 - t1; - - CGPoint p1 = subpath->startPoint; - CGPoint p2 = subpath->controlPoint1; - CGPoint p3 = subpath->controlPoint2; - CGPoint p4 = subpath->endPoint; - - CGPoint q1 = CGPointMake( - u0*u0*u0 * p1.x + (t0*u0*u0 + u0*t0*u0 + u0*u0*t0) * p2.x + (t0*t0*u0 + u0*t0*t0 + t0*u0*t0) * p3.x + t0*t0*t0 * p4.x, - u0*u0*u0 * p1.y + (t0*u0*u0 + u0*t0*u0 + u0*u0*t0) * p2.y + (t0*t0*u0 + u0*t0*t0 + t0*u0*t0) * p3.y + t0*t0*t0 * p4.y - ); - CGPoint q2 = CGPointMake( - u0*u0*u1 * p1.x + (t0*u0*u1 + u0*t0*u1 + u0*u0*t1) * p2.x + (t0*t0*u1 + u0*t0*t1 + t0*u0*t1) * p3.x + t0*t0*t1 * p4.x, - u0*u0*u1 * p1.y + (t0*u0*u1 + u0*t0*u1 + u0*u0*t1) * p2.y + (t0*t0*u1 + u0*t0*t1 + t0*u0*t1) * p3.y + t0*t0*t1 * p4.y - ); - CGPoint q3 = CGPointMake( - u0*u1*u1 * p1.x + (t0*u1*u1 + u0*t1*u1 + u0*u1*t1) * p2.x + (t0*t1*u1 + u0*t1*t1 + t0*u1*t1) * p3.x + t0*t1*t1 * p4.x, - u0*u1*u1 * p1.y + (t0*u1*u1 + u0*t1*u1 + u0*u1*t1) * p2.y + (t0*t1*u1 + u0*t1*t1 + t0*u1*t1) * p3.y + t0*t1*t1 * p4.y - ); - CGPoint q4 = CGPointMake( - u1*u1*u1 * p1.x + (t1*u1*u1 + u1*t1*u1 + u1*u1*t1) * p2.x + (t1*t1*u1 + u1*t1*t1 + t1*u1*t1) * p3.x + t1*t1*t1 * p4.x, - u1*u1*u1 * p1.y + (t1*u1*u1 + u1*t1*u1 + u1*u1*t1) * p2.y + (t1*t1*u1 + u1*t1*t1 + t1*u1*t1) * p3.y + t1*t1*t1 * p4.y - ); - - if (start != 0.0) { - [path moveToPoint:q1]; - } - [path addCurveToPoint:q4 controlPoint1:q2 controlPoint2:q3]; -} - -#pragma mark - Math Helpers - -static CGFloat linearLength(CGPoint fromPoint, CGPoint toPoint) -{ - return sqrtf(powf(toPoint.x - fromPoint.x, 2) + powf(toPoint.y - fromPoint.y, 2)); -} - -static CGFloat quadraticLength(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint) -{ - CGFloat length = 0; - - int iterations = 20; - for (int i = 0; i < iterations; ++i) { - float s = i * (1.0 / iterations); - float t = s + (1.0 / iterations); - - CGPoint p = quadraticPoint(s, fromPoint, controlPoint, toPoint); - CGPoint q = quadraticPoint(t, fromPoint, controlPoint, toPoint); - - length += linearLength(p, q); - } - - return length; -} - -static CGFloat cubicLength(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint1, CGPoint controlPoint2) -{ - CGFloat length = 0; - - int iterations = 20; - for (int i = 0; i < iterations; ++i) { - float s = i * (1.0 / iterations); - float t = s + (1.0 / iterations); - - CGPoint p = cubicPoint(s, fromPoint, controlPoint1, controlPoint2, toPoint); - CGPoint q = cubicPoint(t, fromPoint, controlPoint1, controlPoint2, toPoint); - - length += linearLength(p, q); - } - return length; -} - -static CGPoint quadraticPoint(float t, CGPoint start, CGPoint c1, CGPoint end) -{ - CGFloat x = quadraticBezier(t, start.x, c1.x, end.x); - CGFloat y = quadraticBezier(t, start.y, c1.y, end.y); - - return CGPointMake(x, y); -} - -static CGPoint cubicPoint(float t, CGPoint start, CGPoint c1, CGPoint c2, CGPoint end) -{ - CGFloat x = cubicBezier(t, start.x, c1.x, c2.x, end.x); - CGFloat y = cubicBezier(t, start.y, c1.y, c2.y, end.y); - - return CGPointMake(x, y); -} - -// formula base on: -// http://ericasadun.com/2013/03/25/calculating-bezier-points/ -static float cubicBezier(float t, float start, float c1, float c2, float end) -{ - CGFloat t_ = (1.0 - t); - CGFloat tt_ = t_ * t_; - CGFloat ttt_ = t_ * t_ * t_; - CGFloat tt = t * t; - CGFloat ttt = t * t * t; - - return start * ttt_ - + 3.0 * c1 * tt_ * t - + 3.0 * c2 * t_ * tt - + end * ttt; -} - -// formula base on: -// http://ericasadun.com/2013/03/25/calculating-bezier-points/ -static float quadraticBezier(float t, float start, float c1, float end) -{ - CGFloat t_ = (1.0 - t); - CGFloat tt_ = t_ * t_; - CGFloat tt = t * t; - - return start * tt_ - + 2.0 * c1 * t_ * t - + end * tt; -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.h deleted file mode 100755 index 3da970a..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -@class KFVectorAnimation; -@class KFVectorFeature; - -/** - * @discussion Use this class to apply layer animation - * - * Animates the keyframes of KFVectorAnimation. - */ -@interface KFVectorAnimationLayer : CAShapeLayer - -@property (nonatomic, assign, readwrite) NSUInteger frameRate; -@property (nonatomic, assign, readwrite) NSUInteger frameCount; -@property (nonatomic, copy, readwrite) NSString *formatVersion; - -/// Setting KFVectorAnimation will setup the layer at frame 0 with animation specified. -- (void)setAnimations:(NSArray *)animations - scaleToCanvas:(CGPoint)scaleToCanvas - scaleToLayer:(CGPoint)scaleToLayer; - -/// Sets the lifespan of the layer from certain frame to certain frame. -- (void)setLifespanFromFrame:(NSUInteger)fromFrame toFrom:(NSUInteger)toFrame; - -/// Reset animations to the beginning. -- (void)resetAnimations; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.m deleted file mode 100755 index 3e2c341..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorAnimationLayer.m +++ /dev/null @@ -1,451 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorAnimationLayer.h" - -#import "KFUtilities.h" -#import "KFVectorAnimation.h" -#import "KFVectorAnimationKeyValue.h" -#import "KFVectorLayerHelper.h" - -@implementation KFVectorAnimationLayer -{ - CGPoint _scaleToCanvas; - CGPoint _scaleToLayer; - NSMutableArray *_animations; - BOOL _hasHiddenAnimation; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _animations = [NSMutableArray new]; - } - return self; -} - -- (void)setAnimations:(NSArray *)animations - scaleToCanvas:(CGPoint)scaleToCanvas - scaleToLayer:(CGPoint)scaleToLayer -{ - _scaleToCanvas = scaleToCanvas; - _scaleToLayer = scaleToLayer; - - // TO DO: for backward capability, should be deprecated - if (KFVersionLessThan(self.formatVersion, @"1.0")) { - // Due to earlier bug with AE->json flow, some animation may not have anchors extracted properly. - // Thus, loop through animations to find anchor points, and apply the non CGPointZero point if found. - // Ideally, all animations for same layer has same anchor point from AE. - [animations enumerateObjectsUsingBlock:^(KFVectorAnimation *_Nonnull animation, NSUInteger idx, BOOL *_Nonnull stop) { - if (!CGPointEqualToPoint(animation.anchor, CGPointZero)) { - *stop = YES; - self.anchorPoint = animation.anchor; - CGPoint position = CGPointMake(self.anchorPoint.x * CGRectGetWidth(self.bounds), - self.anchorPoint.y * CGRectGetHeight(self.bounds)); - self.position = position; - } - }]; - } - - for (KFVectorAnimation *animation in animations) { - if ([animation.property isEqualToString:@"STROKE_WIDTH"]) { - [self _applyStrokeWidthAnimation:animation]; - } else if ([animation.property isEqualToString:@"SCALE"]) { - [self _applyScaleAnimation:animation]; - } else if ([animation.property isEqualToString:@"ROTATION"]) { - [self _applyRotationAnimation:animation]; - } else if ([animation.property isEqualToString:@"POSITION"] && KFVersionLessThan(self.formatVersion, @"1.0")) { - // TO DO: for backward capability, should be deprecated - [self _applyPositionAnimation:animation]; - } else if ([animation.property isEqualToString:@"ANCHOR_POINT"]) { - [self _applyAnchorPointAnimation:animation]; - } else if ([animation.property isEqualToString:@"X_POSITION"]) { - [self _applyXPositionAnimation:animation]; - } else if ([animation.property isEqualToString:@"Y_POSITION"]) { - [self _applyYPositionAnimation:animation]; - } else if ([animation.property isEqualToString:@"OPACITY"]) { - [self _applyOpacityAnimation:animation]; - } else if ([animation.property isEqualToString:@"STROKE_COLOR"]) { - [self _applyStrokeColorAnimation:animation]; - } else if ([animation.property isEqualToString:@"FILL_COLOR"]) { - [self _applyFillColorAnimation:animation]; - } else if ([animation.property isEqualToString:@"HIDDEN"]) { - [self _applyHiddenAnimation:animation]; - } - } -} - -- (void)setLifespanFromFrame:(NSUInteger)fromFrame toFrom:(NSUInteger)toFrame -{ - if (!_hasHiddenAnimation && (fromFrame != 0 || toFrame != self.frameCount)) { - NSMutableArray *values = [NSMutableArray new]; - NSMutableArray *keyTimes = [NSMutableArray new]; - if (fromFrame != 0) { - [values addObject:@YES]; - [values addObject:@NO]; - CGFloat time = fromFrame * 1.0 / self.frameCount; - [keyTimes addObject:@(time)]; - [keyTimes addObject:@(time)]; - } - if (toFrame != self.frameCount) { - [values addObject:@NO]; - [values addObject:@YES]; - CGFloat time = toFrame * 1.0 / self.frameCount; - [keyTimes addObject:@(time)]; - [keyTimes addObject:@(time)]; - } - CAKeyframeAnimation *lifespanAnimation = [CAKeyframeAnimation animationWithKeyPath:@"hidden"]; - lifespanAnimation.duration = self.frameCount * 1.0 / self.frameRate; - lifespanAnimation.repeatCount = self.repeatCount; - lifespanAnimation.values = values; - lifespanAnimation.keyTimes = keyTimes; - lifespanAnimation.fillMode = kCAFillModeBoth; - lifespanAnimation.removedOnCompletion = NO; - [_animations addObject:lifespanAnimation]; - } -} - -- (void)resetAnimations -{ - [self removeAllAnimations]; - if (self.mask && [self.mask isKindOfClass:[KFVectorAnimationLayer class]]) { - [(KFVectorAnimationLayer *)self.mask resetAnimations]; - } - for (CALayer *sublayer in self.sublayers) { - if ([sublayer isKindOfClass:[KFVectorAnimationLayer class]]) { - [(KFVectorAnimationLayer *)sublayer resetAnimations]; - } - } - for (CAPropertyAnimation *animation in _animations) { - [self addAnimation:animation forKey:animation.keyPath]; - } -} - -- (void)setRepeatCount:(float)repeatCount -{ - super.repeatCount = repeatCount; - - if (self.mask && [self.mask isKindOfClass:[KFVectorAnimationLayer class]]) { - self.mask.repeatCount = repeatCount; - } - for (CALayer *sublayer in self.sublayers) { - if ([sublayer isKindOfClass:[KFVectorAnimationLayer class]]) { - sublayer.repeatCount = repeatCount; - } - } - for (CAPropertyAnimation *animation in _animations) { - animation.repeatCount = repeatCount; - } -} - -- (void)_applyScaleAnimation:(KFVectorAnimation *)scaleAnimation -{ - // Animate along the key frames, for our custom CGPoint property. - CFTimeInterval duration = self.frameCount * 1.0 / self.frameRate; - NSArray *xValues = KFMapArray(scaleAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - return @([value[0] floatValue] / 100.0); - }); - NSArray *yValues = KFMapArray(scaleAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - return @([value[1] floatValue] / 100.0); - }); - - if (xValues.count > 1) { - NSArray *keyTimes = KFMapArray(scaleAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - NSArray *timingFunctions = KFVectorLayerMediaTimingFunction(scaleAnimation.timingCurves); - - CAKeyframeAnimation *scaleXAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale.x"]; - scaleXAnim.duration = duration; - scaleXAnim.repeatCount = self.repeatCount; - scaleXAnim.values = xValues; - scaleXAnim.keyTimes = keyTimes; - scaleXAnim.timingFunctions = timingFunctions; - scaleXAnim.fillMode = kCAFillModeBoth; - scaleXAnim.removedOnCompletion = NO; - [_animations addObject:scaleXAnim]; - - CAKeyframeAnimation *scaleYAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale.y"]; - scaleYAnim.duration = duration; - scaleYAnim.repeatCount = self.repeatCount; - scaleYAnim.values = yValues; - scaleYAnim.keyTimes = keyTimes; - scaleYAnim.timingFunctions = timingFunctions; - scaleYAnim.fillMode = kCAFillModeBoth; - scaleYAnim.removedOnCompletion = NO; - [_animations addObject:scaleYAnim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.transform = CATransform3DConcat(self.transform, - CATransform3DMakeScale([[xValues firstObject] floatValue], - [[yValues firstObject] floatValue], - 1.0)); -} - -- (void)_applyPositionAnimation:(KFVectorAnimation *)positionAnimation -{ - NSArray *firstPosition = [[positionAnimation.keyValues firstObject] keyValue]; - CGPoint firstPoint = CGPointMake([firstPosition[0] floatValue] * _scaleToCanvas.x, [firstPosition[1] floatValue] * _scaleToCanvas.y); - CGPoint offsetFromAnchor = CGPointMake(self.position.x - firstPoint.x, - self.position.y - firstPoint.y); - - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.repeatCount = self.repeatCount; - anim.values = KFMapArray(positionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - CGPoint position = CGPointMake([value[0] floatValue] * self->_scaleToCanvas.x, [value[1] floatValue] * self->_scaleToCanvas.y); - return [NSValue valueWithCGPoint:CGPointMake(position.x + offsetFromAnchor.x, position.y + offsetFromAnchor.y)]; - }); - anim.keyTimes = KFMapArray(positionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(positionAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; -} - -- (void)_applyXPositionAnimation:(KFVectorAnimation *)xPositionAnimation -{ - NSArray *xValues = KFMapArray(xPositionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([[keyValue.keyValue firstObject] floatValue] * self->_scaleToCanvas.x); - }); - if (xValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.repeatCount = self.repeatCount; - anim.values = xValues; - anim.keyTimes = KFMapArray(xPositionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(xPositionAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.position = CGPointMake([[xValues firstObject] floatValue], self.position.y); -} - -- (void)_applyYPositionAnimation:(KFVectorAnimation *)yPositionAnimation -{ - NSArray *yValues = KFMapArray(yPositionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([[keyValue.keyValue firstObject] floatValue] * self->_scaleToCanvas.y); - }); - if (yValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position.y"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.repeatCount = self.repeatCount; - anim.values = yValues; - anim.keyTimes = KFMapArray(yPositionAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(yPositionAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.position = CGPointMake(self.position.x, [[yValues firstObject] floatValue]); -} - -- (void)_applyAnchorPointAnimation:(KFVectorAnimation *)anchorPointAnimation -{ - NSArray *anchorPointValues = KFMapArray(anchorPointAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - CGPoint anchor = CGPointMake([value[0] floatValue] * self->_scaleToLayer.x, [value[1] floatValue] * self->_scaleToLayer.y); - return [NSValue valueWithCGPoint:CGPointMake(anchor.x / CGRectGetWidth(self.bounds), anchor.y / CGRectGetHeight(self.bounds))]; - }); - if (anchorPointValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"anchorPoint"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = anchorPointValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(anchorPointAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(anchorPointAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.anchorPoint = [[anchorPointValues firstObject] CGPointValue]; -} - -- (void)_applyRotationAnimation:(KFVectorAnimation *)rotationAnimation -{ - NSArray *rotationValues = KFMapArray(rotationAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([[keyValue.keyValue firstObject] floatValue] * M_PI / 180); - }); - if (rotationValues.count > 1) { - // Rotate along the key value, for our custom CGFloat property. - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = rotationValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(rotationAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(rotationAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.transform = CATransform3DConcat(self.transform, - CATransform3DMakeRotation([[rotationValues firstObject] floatValue], - 0.0, - 0.0, - 1.0)); -} - -- (void)_applyOpacityAnimation:(KFVectorAnimation *)opacityAnimation -{ - NSArray *opacityValues = KFMapArray(opacityAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([[keyValue.keyValue firstObject] floatValue] / 100.0); - }); - if (opacityValues.count > 1) { - // Rotate along the key value, for our custom CGFloat property. - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = opacityValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(opacityAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(opacityAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.opacity = [[opacityValues firstObject] floatValue]; -} - -- (void)_applyStrokeWidthAnimation:(KFVectorAnimation *)strokeWidthAnimation -{ - NSArray *strokeWidthValues = KFMapArray(strokeWidthAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([[keyValue.keyValue firstObject] floatValue] * self->_scaleToCanvas.x); - }); - if (strokeWidthValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"lineWidth"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = strokeWidthValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(strokeWidthAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(strokeWidthAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.lineWidth = [[strokeWidthValues firstObject] floatValue]; -} - -- (void)_applyStrokeColorAnimation:(KFVectorAnimation *)strokeColorAnimation -{ - NSArray *strokeColorValues = KFMapArray(strokeColorAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return (__bridge id)KFColorWithHexString(keyValue.keyValue).CGColor; - }); - if (strokeColorValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"strokeColor"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = strokeColorValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(strokeColorAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(strokeColorAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.strokeColor = (__bridge CGColorRef)[strokeColorValues firstObject]; -} - -- (void)_applyFillColorAnimation:(KFVectorAnimation *)fillColorAnimation -{ - NSArray *fillColorValues = KFMapArray(fillColorAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return (__bridge id)KFColorWithHexString(keyValue.keyValue).CGColor; - }); - if (fillColorValues.count > 1) { - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"fillColor"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = fillColorValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(fillColorAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.timingFunctions = KFVectorLayerMediaTimingFunction(fillColorAnimation.timingCurves); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.fillColor = (__bridge CGColorRef)[fillColorValues firstObject]; -} - -- (void)_applyHiddenAnimation:(KFVectorAnimation *)hiddenAnimation -{ - NSArray *hiddenValues = KFMapArray(hiddenAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @([keyValue.keyValue boolValue]); - }); - if (hiddenValues.count > 1) { - _hasHiddenAnimation = YES; - CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"hidden"]; - anim.duration = self.frameCount * 1.0 / self.frameRate; - anim.values = hiddenValues; - anim.repeatCount = self.repeatCount; - anim.keyTimes = KFMapArray(hiddenAnimation.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - anim.fillMode = kCAFillModeBoth; - anim.removedOnCompletion = NO; - [_animations addObject:anim]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - self.hidden = [[hiddenValues firstObject] boolValue]; -} - -#pragma mark - NSCoding - -- (instancetype)initWithCoder:(NSCoder *)coder -{ - self = [super initWithCoder:coder]; - if (self) { - _animations = [coder decodeObjectForKey:@"KFVectorAnimationLayer*_animations"]; - } - return self; -} - --(void)encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:_animations forKey:@"KFVectorAnimationLayer*_animations"]; -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.h deleted file mode 100755 index e7b6600..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -#import "KFVectorAnimationLayer.h" -#import "KFVectorFeatureLayerInterface.h" - -/** - * @discussion Use this class to draw the feature that is backed with still bitmaps. - */ -@interface KFVectorBitmapFeatureLayer : KFVectorAnimationLayer - -/** Designated initializer. Given a backed image of the layer. */ -- (instancetype)initWithImage:(UIImage *)image; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.m deleted file mode 100755 index 4771fd8..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorBitmapFeatureLayer.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorBitmapFeatureLayer.h" - -@implementation KFVectorBitmapFeatureLayer - -- (instancetype)initWithImage:(UIImage *)image -{ - if (self = [super init]) { - self.contents = (__bridge id)image.CGImage; - } - return self; -} - -- (void)setFeature:(KFVectorFeature *)feature canvasSize:(CGSize)canvasSize -{ - // empty -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.h deleted file mode 100755 index 3211cec..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -#import "KFVectorAnimationLayer.h" -#import "KFVectorFeatureLayerInterface.h" - -/** - * @discussion Use this class to draw each feature of the face. - * - * Animates the keyframes of KFVectorFeature. - */ -@interface KFVectorFeatureLayer : KFVectorAnimationLayer - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.m deleted file mode 100755 index f4f527b..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayer.m +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorFeatureLayer.h" - -#import "KFVectorAnimation.h" -#import "KFVectorAnimationKeyValue.h" -#import "KFVectorBezierPathsHelper.h" -#import "KFVectorFeature.h" -#import "KFVectorFeatureKeyFrame.h" -#import "KFVectorGradientEffect.h" -#import "KFVectorLayerHelper.h" -#import "KFUtilities.h" -#import "UIBezierPath+KFVectorLayer.h" - -@implementation KFVectorFeatureLayer -{ - NSArray *_keyFramePaths; - NSArray *_keyTimes; - NSArray *_timingFunctions; - CAKeyframeAnimation *_pathAnimation; -} - -- (void)setFeature:(KFVectorFeature *)feature canvasSize:(CGSize)canvasSize -{ - if (feature.pathTrim) { - // path trimming is supported by precompute all paths - NSAssert(feature.keyFrames.count == 1, @"does not support path trimming w/ shape morphing"); - - CGFloat duration = 1.0 * self.frameCount / self.frameRate; - NSMutableArray *keyFramePaths = [NSMutableArray new]; - NSMutableArray *keyTimes = [NSMutableArray new]; - KFVectorFeatureKeyFrame *firstKeyframe = [feature.keyFrames firstObject]; - UIBezierPath *path = KFVectorBezierPathsFromCommandList(firstKeyframe.paths, canvasSize, self.bounds.size); - for (NSUInteger i = feature.fromFrame; i <= feature.toFrame; ++i) { - CGFloat progress = 1.0 * i / self.frameCount; - CGFloat offset = KFVectorTimingFunctionValueAtTime(feature.pathTrim.pathTrimOffset, progress * duration, self.frameRate); - CGFloat start = KFVectorTimingFunctionValueAtTime(feature.pathTrim.pathTrimStart, progress * duration, self.frameRate) / 100.0; - CGFloat end = KFVectorTimingFunctionValueAtTime(feature.pathTrim.pathTrimEnd, progress * duration, self.frameRate) / 100.0; - offset = fmod(offset, 360) / 360; - start = start + offset; - end = end + offset; - if (start < 0 || end < 0) { - start += 1.0; - end += 1.0; - } - if (start > 1.0 || end > 1.0) { - start -= 1.0; - end -= 1.0; - } - start = MAX(MIN(start, 1.0), 0.0); - end = MAX(MIN(end, 1.0), 0.0); - [keyFramePaths addObject:(__bridge id)[path pathTrimFrom:start to:end].CGPath]; - [keyTimes addObject:@(progress)]; - } - - _keyFramePaths = keyFramePaths; - _keyTimes = keyTimes; - _timingFunctions = nil; - } else { - _keyFramePaths = KFMapArray(feature.keyFrames, ^id(KFVectorFeatureKeyFrame *keyFrame) { - return (__bridge id)KFVectorBezierPathsFromCommandList(keyFrame.paths, canvasSize, self.bounds.size).CGPath; - }); - - _keyTimes = KFMapArray(feature.keyFrames, ^id(KFVectorFeatureKeyFrame *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - - _timingFunctions = KFVectorLayerMediaTimingFunction(feature.timingCurves); - } - - self.fillColor = feature.fillColor.CGColor; - self.strokeColor = feature.strokeColor.CGColor; - self.lineWidth = feature.strokeWidth * MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)); - - // TO DO: for backward capability, should be deprecated - if (KFVersionLessThan(self.formatVersion, @"1.0")) { - if (feature.strokeColor) { - self.lineCap = kCALineCapRound; - } - } - - if (!KFVersionLessThan(self.formatVersion, @"1.0")) { - if ([feature.strokeLineCap isEqualToString:@"butt"]) { - self.lineCap = kCALineCapButt; - } else if ([feature.strokeLineCap isEqualToString:@"round"]) { - self.lineCap = kCALineCapRound; - } else if ([feature.strokeLineCap isEqualToString:@"square"]) { - self.lineCap = kCALineCapSquare; - } - } - - [self _addAnimations]; -} - -- (void)resetAnimations -{ - [super resetAnimations]; - [self addAnimation:_pathAnimation forKey:_pathAnimation.keyPath]; -} - -- (void)setRepeatCount:(float)repeatCount -{ - super.repeatCount = repeatCount; - _pathAnimation.repeatCount = repeatCount; -} - -- (void)_addAnimations -{ - // Apply animations. - if (_keyFramePaths.count > 1) { - _pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"path"]; - _pathAnimation.duration = self.frameCount * 1.0 / self.frameRate; - _pathAnimation.repeatCount = self.repeatCount; - _pathAnimation.values = _keyFramePaths; - _pathAnimation.keyTimes = _keyTimes; - _pathAnimation.timingFunctions = _timingFunctions; - _pathAnimation.fillMode = kCAFillModeBoth; - _pathAnimation.removedOnCompletion = NO; - } - - self.path = (__bridge CGPathRef)[_keyFramePaths firstObject]; -} - -#pragma mark - NSCoding - -- (instancetype)initWithCoder:(NSCoder *)coder -{ - self = [super initWithCoder:coder]; - if (self) { - _pathAnimation = [coder decodeObjectForKey:@"KFVectorFeatureLayer*_pathAnimation"]; - } - return self; -} - --(void)encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:_pathAnimation forKey:@"KFVectorFeatureLayer*_pathAnimation"]; -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayerInterface.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayerInterface.h deleted file mode 100755 index dee32b8..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorFeatureLayerInterface.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -@class KFVectorFeature; - -@protocol KFVectorFeatureLayerInterface - -/** - * Setup the face with a feature, and initialize to frame 0. - */ -- (void)setFeature:(KFVectorFeature *)feature canvasSize:(CGSize)canvasSize; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.h deleted file mode 100755 index 62e4ab8..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -#import "KFVectorAnimationLayer.h" -#import "KFVectorFeatureLayerInterface.h" - -/** - * @discussion Use this class to draw each feature of the face. - * - * Animates the keyframes of KFVectorFeature. - */ -@interface KFVectorGradientFeatureLayer : KFVectorAnimationLayer - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.m deleted file mode 100755 index 5903601..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorGradientFeatureLayer.m +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorGradientFeatureLayer.h" - -#import "KFUtilities.h" -#import "KFVectorAnimation.h" -#import "KFVectorAnimationKeyValue.h" -#import "KFVectorBezierPathsHelper.h" -#import "KFVectorFeature.h" -#import "KFVectorFeatureLayer.h" -#import "KFVectorFeatureKeyFrame.h" -#import "KFVectorGradientEffect.h" -#import "KFVectorLayerHelper.h" - -@implementation KFVectorGradientFeatureLayer -{ - CAGradientLayer *_gradientLayer; - KFVectorFeatureLayer *_gradientMaskLayer; - CGSize _canvasSize; - NSMutableArray *_animations; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _animations = [NSMutableArray new]; - } - return self; -} - -- (void)setFeature:(KFVectorFeature *)feature canvasSize:(CGSize)canvasSize -{ - // Make sure feature has a gradient effect - NSParameterAssert(feature && feature.gradientEffect); - - if ([feature.gradientEffect.gradientTypeString isEqualToString:@"linear"]) { - _canvasSize = canvasSize; - _gradientMaskLayer = [KFVectorFeatureLayer layer]; - _gradientMaskLayer.formatVersion = self.formatVersion; - _gradientMaskLayer.name = [self.name stringByAppendingString:@"+maskLayer"]; - _gradientMaskLayer.frameRate = self.frameRate; - _gradientMaskLayer.frameCount = self.frameCount; - _gradientMaskLayer.frame = self.bounds; - _gradientMaskLayer.repeatCount = self.repeatCount; - [_gradientMaskLayer setFeature:feature canvasSize:canvasSize]; - - _gradientLayer = [CAGradientLayer layer]; - _gradientLayer.frame = self.bounds; - _gradientLayer.mask = _gradientMaskLayer; - [self addSublayer:_gradientLayer]; - - [self _addColorsAnimationsWithStartColor:feature.gradientEffect.colorStart endColor:feature.gradientEffect.colorEnd]; - if (feature.gradientEffect.rampStart) { - [self _addRampStartPointAnimation:feature.gradientEffect.rampStart]; - } - if (feature.gradientEffect.rampEnd) { - [self _addRampEndPointAnimation:feature.gradientEffect.rampEnd]; - } - } else { - NSLog(@"Unknown gradient type passed in: %@", feature.gradientEffect.gradientTypeString); - } -} - -- (void)resetAnimations -{ - [super resetAnimations]; - [_gradientMaskLayer resetAnimations]; - [_gradientLayer removeAllAnimations]; - for (CAPropertyAnimation *animation in _animations) { - [_gradientLayer addAnimation:animation forKey:animation.keyPath]; - } -} - -- (void)setRepeatCount:(float)repeatCount -{ - super.repeatCount = repeatCount; - _gradientMaskLayer.repeatCount = repeatCount; - _gradientLayer.repeatCount = repeatCount; - - for (CAPropertyAnimation *animation in _animations) { - animation.repeatCount = repeatCount; - } -} - -- (void)setAnimations:(NSArray *)animations scaleToCanvas:(CGPoint)scaleToCanvas scaleToLayer:(CGPoint)scaleToLayer -{ - [_gradientMaskLayer setAnimations:animations scaleToCanvas:scaleToCanvas scaleToLayer:scaleToLayer]; -} - -- (void)_addColorsAnimationsWithStartColor:(KFVectorAnimation *)colorStart endColor:(KFVectorAnimation *)colorEnd -{ - NSMutableArray *colorsArray = [NSMutableArray array]; - for (int x = 0; x < MAX(colorStart.keyValues.count, colorEnd.keyValues.count); x++) { - NSUInteger startColorIndex = x; - if (colorStart.keyValues.count <= startColorIndex) { - startColorIndex = colorStart.keyValues.count - 1; - } - UIColor *startColor = KFColorWithHexString([[[colorStart keyValues] objectAtIndex:startColorIndex] keyValue]); - - NSUInteger endColorIndex = x; - if (colorEnd.keyValues.count <= endColorIndex) { - endColorIndex = colorEnd.keyValues.count - 1; - } - UIColor *endColor = KFColorWithHexString([[[colorEnd keyValues] objectAtIndex:endColorIndex] keyValue]); - - [colorsArray addObject:@[(id)startColor.CGColor, (id)endColor.CGColor]]; - } - if (colorsArray.count > 1) { - CAKeyframeAnimation *colorAnimation = [CAKeyframeAnimation animationWithKeyPath:@"colors"]; - colorAnimation.duration = self.frameCount * 1.0 / self.frameRate; - colorAnimation.repeatCount = self.repeatCount; - colorAnimation.values = colorsArray; - - KFVectorAnimation *animationToUseForTimingCurve = colorStart; - if (colorEnd.timingCurves.count == colorsArray.count - 1) { - animationToUseForTimingCurve = colorEnd; - } - colorAnimation.timingFunctions = KFVectorLayerMediaTimingFunction(animationToUseForTimingCurve.timingCurves); - colorAnimation.keyTimes = KFMapArray(animationToUseForTimingCurve.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - return @(keyValue.startFrame * 1.0 / self.frameCount); - }); - colorAnimation.removedOnCompletion = NO; - [_animations addObject:colorAnimation]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - _gradientLayer.colors = [colorsArray firstObject]; -} - -- (void)_addRampStartPointAnimation:(KFVectorAnimation *)rampStart -{ - NSArray *rampStartValues = KFMapArray(rampStart.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - CGPoint point = CGPointMake([value[0] floatValue] / self->_canvasSize.width, [value[1] floatValue] / self->_canvasSize.height); - return [NSValue valueWithCGPoint:CGPointMake(point.x, point.y)]; - }); - if (rampStartValues.count > 1) { - CAKeyframeAnimation *rampStartAnimation = [CAKeyframeAnimation animationWithKeyPath:@"startPoint"]; - rampStartAnimation.duration = self.frameCount * 1.0 / self.frameRate; - rampStartAnimation.repeatCount = self.repeatCount; - rampStartAnimation.values = rampStartValues; - rampStartAnimation.keyTimes = KFMapArray(rampStart.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - rampStartAnimation.timingFunctions = KFVectorLayerMediaTimingFunction(rampStart.timingCurves); - rampStartAnimation.fillMode = kCAFillModeBoth; - rampStartAnimation.removedOnCompletion = NO; - [_animations addObject:rampStartAnimation]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - _gradientLayer.startPoint = [[rampStartValues firstObject] CGPointValue]; -} - -- (void)_addRampEndPointAnimation:(KFVectorAnimation *)rampEnd -{ - NSArray *rampEndValues = KFMapArray(rampEnd.keyValues, ^id(KFVectorAnimationKeyValue *keyValue) { - NSArray *value = keyValue.keyValue; - CGPoint point = CGPointMake([value[0] floatValue] / self->_canvasSize.width, [value[1] floatValue] / self->_canvasSize.height); - return [NSValue valueWithCGPoint:CGPointMake(point.x, point.y)]; - }); - if (rampEndValues.count > 1) { - CAKeyframeAnimation *rampEndAnimation = [CAKeyframeAnimation animationWithKeyPath:@"endPoint"]; - rampEndAnimation.duration = self.frameCount * 1.0 / self.frameRate; - rampEndAnimation.repeatCount = self.repeatCount; - rampEndAnimation.values = rampEndValues; - rampEndAnimation.keyTimes = KFMapArray(rampEnd.keyValues, ^id(KFVectorAnimationKeyValue *keyFrame) { - return @(keyFrame.startFrame * 1.0 / self.frameCount); - }); - rampEndAnimation.timingFunctions = KFVectorLayerMediaTimingFunction(rampEnd.timingCurves); - rampEndAnimation.fillMode = kCAFillModeBoth; - rampEndAnimation.removedOnCompletion = NO; - [_animations addObject:rampEndAnimation]; - } - - // When layer is initialized, and unanimated, layer renders without the first animation applied. This fixes it. - _gradientLayer.endPoint = [[rampEndValues firstObject] CGPointValue]; -} - -#pragma mark - NSCoding - -- (instancetype)initWithCoder:(NSCoder *)coder -{ - self = [super initWithCoder:coder]; - if (self) { - _animations = [coder decodeObjectForKey:@"KFVectorGradientFeatureLayer*_animations"]; - _gradientLayer = (CAGradientLayer *)[[self sublayers] firstObject]; - _gradientMaskLayer = (KFVectorFeatureLayer *)_gradientLayer.mask; - } - return self; -} - --(void)encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:_animations forKey:@"KFVectorGradientFeatureLayer*_animations"]; -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.h deleted file mode 100755 index 5eced08..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -@class KFVector; - -/** - * KFVectorFeatureLayer uses vector data to draw and animate reaction faces. - * Since this is bezier path drawing, reaction type change - * can be animated. Used for original single face input. - */ -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 || KEYFRAMES_CALAYER_CAANIMATIONDELEGATE_PROTOCOL -@interface KFVectorLayer : CALayer -#else -@interface KFVectorLayer : CALayer -#endif - -/** - * Setup layers based on the vector model. - */ -- (void)setFaceModel:(KFVector *)faceModel; - -@property (copy, nonatomic) void (^animationDidStopBlock)(BOOL finished); - -/** - * Path based face view initially starts off with frame stuck at 0. - * Call this method to kick off animation. - */ -- (void)startAnimation; - -/** - * Call this method to pause vector animation. To resume, call resumeAnimation. - */ -- (void)pauseAnimation; - -/** - * Call this method to resume vector animation. - */ -- (void)resumeAnimation; - -/** - * Call this method seek the animation to a given progress, progress is in range of [0, 1]. - */ -- (void)seekToProgress:(CGFloat)progress; - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.m deleted file mode 100755 index 4ba986e..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayer.m +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorLayer.h" - -#import "KFUtilities.h" -#import "KFVector.h" -#import "KFVectorAnimation.h" -#import "KFVectorAnimationGroup.h" -#import "KFVectorAnimationLayer.h" -#import "KFVectorFeature.h" -#import "KFVectorBitmapFeatureLayer.h" -#import "KFVectorFeatureLayer.h" -#import "KFVectorGradientFeatureLayer.h" - -@implementation KFVectorLayer -{ - CALayer *_containerLayer; - CABasicAnimation *_mockAnimation; - CGFloat _duration; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - self.repeatCount = HUGE_VALF; - } - return self; -} - -- (void)setFaceModel:(KFVector *)faceModel -{ - NSAssert(self.bounds.size.width > 0 && self.bounds.size.height > 0, @"Ensure layer has > 0 size."); - - _containerLayer = [CALayer layer]; - _containerLayer.frame = self.bounds; - self.speed = 0.0; - [self addSublayer:_containerLayer]; - [self _setupFace:faceModel]; -} - -- (void)_setupFace:(KFVector *)vector -{ - self.name = vector.name; - _duration = vector.animationFrameCount * 1.0 / vector.frameRate; - - // Feature layers are in one array, and animation groups are in another array. - // Feature arrays can be nested within animation groups (as a sublayer). - // 1) we need to create the groups, - // 2) create feature layers. - // 3) Add root level feature layers. - // 4) Add animation groups to self.layer according to their dependency graph - // 5) Add leaf level feature layers into appropriate animation groups. - // 6) Add a mock animation for invoking stop callback. - - // 1) we need to create the groups, - NSMutableDictionary *groupIdToLayerMap = [NSMutableDictionary dictionary]; - [vector.animationGroups enumerateObjectsUsingBlock:^(KFVectorAnimationGroup *animationGroup, - NSUInteger idx, - BOOL *stop) { - KFVectorAnimationLayer *animationGroupLayer = [KFVectorAnimationLayer layer]; - animationGroupLayer.formatVersion = vector.formatVersion; - animationGroupLayer.name = animationGroup.groupName; - animationGroupLayer.frameRate = vector.frameRate; - animationGroupLayer.frameCount = vector.animationFrameCount; - animationGroupLayer.frame = self.bounds; - animationGroupLayer.repeatCount = self.repeatCount; - groupIdToLayerMap[@(animationGroup.groupId)] = animationGroupLayer; - }]; - - // 2) create feature layers. - // 3) Add root level feature layers. - NSArray *featureLayers = KFMapArrayWithIndex(vector.features, ^id(KFVectorFeature *feature, NSUInteger index) - { - KFVectorAnimationLayer *featureLayer; - - if (feature.backedImage) { - NSAssert(vector.bitmaps[feature.backedImage] != nil, @"Image asset does not exist"); - featureLayer = [[KFVectorBitmapFeatureLayer alloc] initWithImage:vector.bitmaps[feature.backedImage]]; - } else if (feature.gradientEffect) { - featureLayer = [KFVectorGradientFeatureLayer layer]; - } else { - featureLayer = [KFVectorFeatureLayer layer]; - } - featureLayer.formatVersion = vector.formatVersion; - featureLayer.name = feature.name; - featureLayer.frameRate = vector.frameRate; - featureLayer.frameCount = vector.animationFrameCount; - featureLayer.frame = CGRectMake(0, 0, - CGRectGetWidth(self.bounds) * feature.featureSize.width / vector.canvasSize.width, - CGRectGetHeight(self.bounds) * feature.featureSize.height / vector.canvasSize.height); - featureLayer.repeatCount = self.repeatCount; - [featureLayer setFeature:feature canvasSize:vector.canvasSize]; - - if (!KFVersionLessThan(vector.formatVersion, @"1.0")) { - [featureLayer setLifespanFromFrame:feature.fromFrame toFrom:feature.toFrame]; - } - - KFVectorAnimationLayer *animatedFeatureLayer = featureLayer; - if (KFVersionLessThan(vector.formatVersion, @"1.0")) { - // TO DO: for backward capability, should be deprecated - if (feature.featureAnimations.count) { - KFVectorAnimationLayer *animationLayer = [KFVectorAnimationLayer layer]; - animationLayer.formatVersion = vector.formatVersion; - animationLayer.name = featureLayer.name; - animationLayer.frameRate = vector.frameRate; - animationLayer.frameCount = vector.animationFrameCount; - animationLayer.frame = self.bounds; - animationLayer.repeatCount = self.repeatCount; - [animationLayer addSublayer:featureLayer]; - [animationLayer setAnimations:feature.featureAnimations - scaleToCanvas:[self _scaleFromSize:vector.canvasSize toSize:self.bounds.size] - scaleToLayer:[self _scaleFromSize:feature.featureSize toSize:animationLayer.bounds.size]]; - animatedFeatureLayer = animationLayer; - } - } - - if (!KFVersionLessThan(vector.formatVersion, @"1.0")) { - [animatedFeatureLayer setAnimations:feature.featureAnimations - scaleToCanvas:[self _scaleFromSize:vector.canvasSize toSize:self.bounds.size] - scaleToLayer:[self _scaleFromSize:feature.featureSize toSize:animatedFeatureLayer.bounds.size]]; - - if (feature.masking) { - // handle masking - KFVectorFeatureLayer *maskLayer = [KFVectorFeatureLayer layer]; - maskLayer.formatVersion = vector.formatVersion; - maskLayer.name = feature.name; - maskLayer.frameRate = vector.frameRate; - maskLayer.frameCount = vector.animationFrameCount; - maskLayer.frame = self.bounds; - maskLayer.repeatCount = self.repeatCount; - [maskLayer setFeature:feature.masking canvasSize:vector.canvasSize]; - [maskLayer setLifespanFromFrame:feature.masking.fromFrame toFrom:feature.masking.toFrame]; - [maskLayer setAnimations:feature.masking.featureAnimations - scaleToCanvas:[self _scaleFromSize:vector.canvasSize toSize:self.bounds.size] - scaleToLayer:[self _scaleFromSize:feature.masking.featureSize toSize:maskLayer.bounds.size]]; - - if (feature.masking.animationGroupId == feature.featureId) { - // masking under feature layer transforms - animatedFeatureLayer.mask = maskLayer; - } else { - // masking not under feature layer transforms - KFVectorAnimationLayer *parentLayer = [KFVectorAnimationLayer layer]; - parentLayer.formatVersion = vector.formatVersion; - parentLayer.name = animatedFeatureLayer.name; - parentLayer.frameRate = vector.frameRate; - parentLayer.frameCount = vector.animationFrameCount; - parentLayer.frame = self.bounds; - parentLayer.repeatCount = self.repeatCount; - parentLayer.mask = maskLayer; - [parentLayer addSublayer:animatedFeatureLayer]; - animatedFeatureLayer = parentLayer; - } - } - } - - if (feature.animationGroupId == NSNotFound) { - [self->_containerLayer addSublayer:animatedFeatureLayer]; - } - return animatedFeatureLayer; - }); - - // 4) Add animation groups to self according to their dependency graph - [vector.animationGroups enumerateObjectsUsingBlock:^(KFVectorAnimationGroup *animationGroup, - NSUInteger idx, - BOOL *stop) { - CALayer *animationGroupLayer = groupIdToLayerMap[@(animationGroup.groupId)]; - if (groupIdToLayerMap[@(animationGroup.parentGroupId)]) { - CALayer *parentGroupLayer = groupIdToLayerMap[@(animationGroup.parentGroupId)]; - [parentGroupLayer addSublayer:animationGroupLayer]; - } else { - // parent is nil. add to the root layer - [self->_containerLayer addSublayer:animationGroupLayer]; - } - }]; - - // 5) Add leaf level feature layers into appropriate animation groups. - [featureLayers enumerateObjectsUsingBlock:^(CAShapeLayer *featureLayer, NSUInteger idx, BOOL *stop) { - KFVectorFeature *feature = vector.features[idx]; - if (feature.animationGroupId != NSNotFound) { - KFVectorAnimationLayer *animationGroupLayer = groupIdToLayerMap[@(feature.animationGroupId)]; - [animationGroupLayer addSublayer:featureLayer]; - } - }]; - - [vector.animationGroups enumerateObjectsUsingBlock:^(KFVectorAnimationGroup *animationGroup, NSUInteger idx, BOOL *stop) { - // Apply all animation to animation layer for now - KFVectorAnimationLayer *animationGroupLayer = groupIdToLayerMap[@(animationGroup.groupId)]; - [animationGroupLayer setAnimations:animationGroup.animations - scaleToCanvas:[self _scaleFromSize:vector.canvasSize toSize:self.bounds.size] - scaleToLayer:[self _scaleFromSize:vector.canvasSize toSize:animationGroupLayer.bounds.size]]; - }]; - - // 6) Add a mock animation for invoking stop callback. - _mockAnimation = [self _createMockAnimation]; - - [self _resetAnimations]; -} - -- (CABasicAnimation *)_createMockAnimation -{ - CABasicAnimation *mockAnimation = [CABasicAnimation animationWithKeyPath:@"hidden"]; - mockAnimation.fromValue = @(NO); - mockAnimation.toValue = @(NO); - mockAnimation.duration = _duration; - mockAnimation.repeatCount = 1; - mockAnimation.delegate = self; - return mockAnimation; -} - -- (void)setRepeatCount:(float)repeatCount -{ - super.repeatCount = repeatCount; - - for (KFVectorAnimationLayer *sublayer in _containerLayer.sublayers) { - sublayer.repeatCount = repeatCount; - } -} - -- (void)_resetAnimations -{ - self.speed = 0; - [self removeAllAnimations]; - for (KFVectorAnimationLayer *sublayer in _containerLayer.sublayers) { - [sublayer resetAnimations]; - } - [self addAnimation:_mockAnimation forKey:_mockAnimation.keyPath]; -} - -- (void)startAnimation -{ - [self _resetAnimations]; - - self.speed = 1.0; - self.timeOffset = 0.0; - self.beginTime = 0.0; -} - -- (void)resumeAnimation -{ - if (self.speed > 0) { - return; - } - - CFTimeInterval pausedTime = [self timeOffset]; - self.speed = 1.0; - self.timeOffset = 0.0; - self.beginTime = 0.0; - CFTimeInterval timeSincePause = [self convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; - self.beginTime = timeSincePause; -} - -- (void)pauseAnimation -{ - CFTimeInterval pausedTime = [self convertTime:CACurrentMediaTime() fromLayer:nil]; - self.speed = 0.0; - self.timeOffset = pausedTime; -} - -- (void)seekToProgress:(CGFloat)progress -{ - self.timeOffset = progress * _duration; -} - -- (void)layoutSublayers -{ - [super layoutSublayers]; - [CATransaction begin]; - [CATransaction setValue:(id)kCFBooleanTrue - forKey:kCATransactionDisableActions]; - _containerLayer.transform = CATransform3DMakeScale(CGRectGetWidth(self.bounds) / CGRectGetWidth(_containerLayer.bounds), - CGRectGetHeight(self.bounds) / CGRectGetHeight(_containerLayer.bounds), - 1.0); - _containerLayer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); - [CATransaction commit]; -} - -#pragma mark - NSCoding - -- (instancetype)initWithCoder:(NSCoder *)coder -{ - self = [super initWithCoder:coder]; - if (self) { - _containerLayer = [[self sublayers] firstObject]; - _mockAnimation = [coder decodeObjectForKey:@"KFVectorLayer*_mockAnimation"]; - _mockAnimation.delegate = self; - _duration = [[coder decodeObjectForKey:@"KFVectorLayer*_duration"] doubleValue]; - } - return self; -} - --(void)encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:_mockAnimation forKey:@"KFVectorLayer*_mockAnimation"]; - [aCoder encodeObject:@(_duration) forKey:@"KFVectorLayer*_duration"]; -} - -#pragma mark - CAAnimationDelegate - -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished -{ - if (_animationDidStopBlock && - [anim isKindOfClass:[CABasicAnimation class]] && - [((CABasicAnimation *)anim).keyPath isEqualToString:_mockAnimation.keyPath]) { - _animationDidStopBlock(finished); - } - if (finished) { - // Recreating mock animation for invoking stop callback again - _mockAnimation = [self _createMockAnimation]; - [self addAnimation:_mockAnimation forKey:_mockAnimation.keyPath]; - } -} - -#pragma mark - Private - -- (CGPoint)_scaleFromSize:(CGSize)sizeA toSize:(CGSize)sizeB -{ - return CGPointMake(sizeB.width / sizeA.width, sizeB.height / sizeA.height); -} - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.h b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.h deleted file mode 100755 index d8646d7..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" -#import "KFUtilities.h" -#import "KFVectorAnimation.h" - -KF_EXTERN_C_BEGIN - -/// Helper method to build media timing functions from value graph. -NSArray *KFVectorLayerMediaTimingFunction(NSArray *timingCurves); - -/// Interpolate the y value with given x value. -CGFloat KFVectorTimingFunctionValueAtTime(KFVectorAnimation *animation, CGFloat time, NSUInteger frameRate); - -KF_EXTERN_C_END diff --git a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.m b/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.m deleted file mode 100755 index 62864f9..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Layers/KFVectorLayerHelper.m +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "CAMediaTimingFunction+KFVectorLayer.h" -#import "KFVectorLayerHelper.h" -#import "KFVectorAnimationKeyValue.h" - -NSArray *KFVectorLayerMediaTimingFunction(NSArray *timingCurves) -{ - return KFMapArray(timingCurves, ^id(NSArray *controlPoints) { - CGPoint controlPoint1 = [controlPoints[0] CGPointValue]; - CGPoint controlPoint2 = [controlPoints[1] CGPointValue]; - return [CAMediaTimingFunction functionWithControlPoints:controlPoint1.x :controlPoint1.y :controlPoint2.x :controlPoint2.y]; - }); -} - -CGFloat KFVectorTimingFunctionValueAtTime(KFVectorAnimation *animation, CGFloat time, NSUInteger frameRate) -{ - KFVectorAnimationKeyValue *firstKeyframe = [animation.keyValues firstObject]; - CGFloat lastX = firstKeyframe.startFrame * 1.0 / frameRate;; - CGFloat lastY = [[firstKeyframe.keyValue firstObject] floatValue]; - - NSArray *timingFunctions = KFVectorLayerMediaTimingFunction(animation.timingCurves); - - if (time < lastX) { - return lastY; - } - - for (int i = 1; i < animation.keyValues.count; ++i) { - KFVectorAnimationKeyValue *keyframe = animation.keyValues[i]; - CGFloat x = keyframe.startFrame * 1.0 / frameRate; - CGFloat y = [[keyframe.keyValue firstObject] floatValue]; - if (lastX <= time && time <= x) { - CAMediaTimingFunction *timingFunction = timingFunctions[i - 1]; - CGFloat yRatio = [timingFunction valueAtX:(time - lastX) / (x - lastX) inDuration:x - lastX]; - return (y - lastY) * yRatio + lastY; - } - lastX = x; - lastY = y; - } - - KFVectorAnimationKeyValue *lastKeyframe = [animation.keyValues lastObject]; - return [[lastKeyframe.keyValue firstObject] floatValue]; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.h b/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.h deleted file mode 100755 index d061dea..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" -#import "KFUtilities.h" - -KF_EXTERN_C_BEGIN - -/// Given array of command list, return UIBezierPath to use for drawing -UIBezierPath *KFVectorBezierPathsFromCommandList(NSArray *commandList, CGSize canvasSize, CGSize viewSize); - -KF_EXTERN_C_END diff --git a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.m b/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.m deleted file mode 100755 index 268c0d2..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorBezierPathsHelper.m +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorBezierPathsHelper.h" - -static CGPoint _pointFromNormalizedSpaceToCoordinateSize(CGPoint normalizedPoint, CGSize coordinateSize); -static CGFloat _normalizedFloatFromArrayAtIndex(NSArray *floats, NSUInteger index, CGFloat coordinateSpace); -static void _generateAndAddToPathFromACommand(UIBezierPath *path, NSString *singleCommand, CGSize canvasSize, CGSize viewSize); - -#pragma mark - Public functions - -UIBezierPath *KFVectorBezierPathsFromCommandList(NSArray *commandList, CGSize canvasSize, CGSize viewSize) -{ - UIBezierPath *path = [UIBezierPath bezierPath]; - for (NSString *command in commandList) { - _generateAndAddToPathFromACommand(path, command, canvasSize, viewSize); - } - return path; -} - -#pragma mark - Helpers - -static CGPoint _pointFromNormalizedSpaceToCoordinateSize(CGPoint normalizedPoint, CGSize coordinateSize) -{ - return CGPointMake(normalizedPoint.x * coordinateSize.width, normalizedPoint.y * coordinateSize.height); -} - -static CGFloat _normalizedFloatFromArrayAtIndex(NSArray *floats, NSUInteger index, CGFloat coordinateSpace) -{ - return [floats[index] floatValue] / coordinateSpace; -} - -// Given a command, and a path, append proper curve to the path. -static void _generateAndAddToPathFromACommand(UIBezierPath *path, NSString *singleCommand, CGSize canvasSize, CGSize viewSize) -{ - NSString *command = [singleCommand substringToIndex:1]; - NSArray *points = [[singleCommand substringWithRange:NSMakeRange(1, [singleCommand length] - 2)] componentsSeparatedByString:@","]; - - if ([command isEqualToString:@"M"]) { - // Move with absolute coordinate - CGPoint toPoint = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 0, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 1, canvasSize.height)); - [path moveToPoint:_pointFromNormalizedSpaceToCoordinateSize(toPoint, viewSize)]; - } else if ([command isEqualToString:@"L"]) { - // Line with absolute coordinate - CGPoint toPoint = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 0, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 1, canvasSize.height)); - [path addLineToPoint:_pointFromNormalizedSpaceToCoordinateSize(toPoint, viewSize)]; - } else if ([command isEqualToString:@"C"]) { - // Cubic curve with absolute coordinate - // for cubic curve, we are given 6 points. (p0,p1) is control 1, (p2,p3) is control 2, (p4, p5) is to point. - CGPoint controlPoint1 = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 0, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 1, canvasSize.height)); - CGPoint controlPoint2 = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 2, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 3, canvasSize.height)); - CGPoint toPoint = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 4, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 5, canvasSize.height)); - [path addCurveToPoint:_pointFromNormalizedSpaceToCoordinateSize(toPoint, viewSize) - controlPoint1:_pointFromNormalizedSpaceToCoordinateSize(controlPoint1, viewSize) - controlPoint2:_pointFromNormalizedSpaceToCoordinateSize(controlPoint2, viewSize)]; - } else if ([command isEqualToString:@"Q"]) { - // Quadratic curve with absolute coordinate - // for quad curve, we are given 4 points. (p0,p1) is control, (p2,p3) is to point. - CGPoint controlPoint = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 0, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 1, canvasSize.height)); - CGPoint toPoint = CGPointMake(_normalizedFloatFromArrayAtIndex(points, 2, canvasSize.width), _normalizedFloatFromArrayAtIndex(points, 3, canvasSize.height)); - [path addQuadCurveToPoint:_pointFromNormalizedSpaceToCoordinateSize(toPoint, viewSize) - controlPoint:_pointFromNormalizedSpaceToCoordinateSize(controlPoint, viewSize)]; - } -} diff --git a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.h b/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.h deleted file mode 100755 index b6b68dc..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFUtilities.h" - -@class KFVector; -@class UIImage; - -KF_EXTERN_C_BEGIN - -KFVector *KFVectorFromDictionary(NSDictionary *faceDictionary); -KFVector *KFVectorFromDictionaryInRange(NSDictionary *faceDictionary, NSUInteger fromFrame, NSUInteger toFrame); -KFVector *KFVectorFromBitmapReplacement(KFVector *vector, NSString *key, UIImage *bitmap); - -KF_EXTERN_C_END diff --git a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.m b/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.m deleted file mode 100755 index dfca251..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/ParsingHelpers/KFVectorParsingHelper.m +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorParsingHelper.h" - -#import "KFVector.h" -#import "KFVectorAnimation.h" -#import "KFVectorAnimationGroup.h" -#import "KFVectorAnimationKeyValue.h" -#import "KFVectorBezierPathsHelper.h" -#import "KFVectorFeature.h" -#import "KFVectorFeatureKeyFrame.h" -#import "KFVectorGradientEffect.h" -#import "KFVectorPathTrim.h" - -#pragma mark - Internal structure helpers - -static NSArray *_buildControlPoints(NSArray *points) -{ - NSArray *point1Array = points[0]; - NSArray *point2Array = points[1]; - - CGPoint point1 = CGPointMake([point1Array[0] floatValue], [point1Array[1] floatValue]); - CGPoint point2 = CGPointMake([point2Array[0] floatValue], [point2Array[1] floatValue]); - return @[[NSValue valueWithCGPoint:point1], [NSValue valueWithCGPoint:point2]]; -} - -static KFVectorAnimation *_buildAnimationModelFromDictionary(NSDictionary *animationDictionary, - NSUInteger fromFrame, - NSUInteger toFrame, - CGSize canvasSize) -{ - if (animationDictionary == nil) { - return nil; - } - CGPoint anchor = CGPointZero; - if (animationDictionary[@"anchor"]) { - CGFloat anchorX = [animationDictionary[@"anchor"][0] floatValue] / canvasSize.width; - CGFloat anchorY = [animationDictionary[@"anchor"][1] floatValue] / canvasSize.height; - anchor = CGPointMake(anchorX, anchorY); - } - - NSMutableArray *keyValues = [NSMutableArray new]; - NSMutableArray *timingCurves = nil; - if (animationDictionary[@"timing_curves"]) { - timingCurves = [NSMutableArray new]; - } - for (NSUInteger index = 0; index < [animationDictionary[@"key_values"] count]; ++index) { - NSDictionary *keyFrameDictionary = animationDictionary[@"key_values"][index]; - NSUInteger startFrame = [keyFrameDictionary[@"start_frame"] unsignedIntegerValue]; - if (fromFrame <= startFrame && startFrame <= toFrame) { - [keyValues addObject:[[KFVectorAnimationKeyValue alloc] - initWithKeyValue:keyFrameDictionary[@"data"] - startFrame:startFrame - fromFrame]]; - if (index > 0 && keyValues.count > 1 && animationDictionary[@"timing_curves"]) { - NSArray *points = animationDictionary[@"timing_curves"][index - 1]; - [timingCurves addObject:_buildControlPoints(points)]; - } - } else if ([animationDictionary[@"key_values"] count] == 1 && startFrame == 0) { - // handle static value - [keyValues addObject:[[KFVectorAnimationKeyValue alloc] - initWithKeyValue:keyFrameDictionary[@"data"] - startFrame:0]]; - } - } - - return [[KFVectorAnimation alloc] - initWithProperty:animationDictionary[@"property"] - anchor:anchor - keyValues:keyValues - timingCurves:timingCurves]; -} - -static KFVectorGradientEffect *_buildGradientEffectsArrayFromArray(NSDictionary *effectsDictionary, - NSUInteger fromFrame, - NSUInteger toFrame, - CGSize canvasSize) -{ - if (!effectsDictionary[@"gradient"]) { - return nil; - } - - NSDictionary *gradientEffectDictionary = effectsDictionary[@"gradient"]; - return [[KFVectorGradientEffect alloc] - initWithGradientTypeString:gradientEffectDictionary[@"gradient_type"] - colorStart:_buildAnimationModelFromDictionary(gradientEffectDictionary[@"color_start"], fromFrame, toFrame, canvasSize) - colorEnd:_buildAnimationModelFromDictionary(gradientEffectDictionary[@"color_end"], fromFrame, toFrame, canvasSize) - rampStart:_buildAnimationModelFromDictionary(gradientEffectDictionary[@"ramp_start"], fromFrame, toFrame, canvasSize) - rampEnd:_buildAnimationModelFromDictionary(gradientEffectDictionary[@"ramp_end"], fromFrame, toFrame, canvasSize)]; -} - -static KFVectorPathTrim *_buildPathTrimModelFromDictionary(NSDictionary *pathTrimDictionary, - NSUInteger fromFrame, - NSUInteger toFrame, - CGSize canvasSize) -{ - if (!pathTrimDictionary) { - return nil; - } - - return [[KFVectorPathTrim alloc] - initWithPathTrimStart:_buildAnimationModelFromDictionary(pathTrimDictionary[@"path_trim_start"], fromFrame, toFrame, canvasSize) - pathTrimEnd:_buildAnimationModelFromDictionary(pathTrimDictionary[@"path_trim_end"], fromFrame, toFrame, canvasSize) - pathTrimOffset:_buildAnimationModelFromDictionary(pathTrimDictionary[@"path_trim_offset"], fromFrame, toFrame, canvasSize)]; -} - -static KFVectorFeature *_buildFeatureModelFromDictionary(NSDictionary *featureDictionary, - NSUInteger fromFrame, - NSUInteger toFrame, - CGSize canvasSize) -{ - if (!featureDictionary) { - return nil; - } - NSUInteger featureFromFrame = (featureDictionary[@"from_frame"] ? [featureDictionary[@"from_frame"] unsignedIntegerValue] : fromFrame); - NSUInteger featureToFrame = (featureDictionary[@"to_frame"] ? [featureDictionary[@"to_frame"] unsignedIntegerValue] : toFrame); - if (featureFromFrame > toFrame || featureToFrame < fromFrame) { - return nil; - } - - NSMutableArray *keyFrames = [NSMutableArray new]; - NSMutableArray *timingCurves = [NSMutableArray new]; - for (NSUInteger index = 0; index < [featureDictionary[@"key_frames"] count]; ++index) { - NSDictionary *keyFrameDictionary = featureDictionary[@"key_frames"][index]; - NSUInteger startFrame = [keyFrameDictionary[@"start_frame"] unsignedIntegerValue]; - if (fromFrame <= startFrame && startFrame <= toFrame) { - [keyFrames addObject:[[KFVectorFeatureKeyFrame alloc] - initWithType:keyFrameDictionary[@"type"] - paths:keyFrameDictionary[@"data"] - startFrame:startFrame - fromFrame]]; - if (index > 0 && keyFrames.count > 1) { - NSArray *points = featureDictionary[@"timing_curves"][index - 1]; - [timingCurves addObject:_buildControlPoints(points)]; - } - } else if ([featureDictionary[@"key_frames"] count] == 1 && startFrame == 0) { - // handle static value - [keyFrames addObject:[[KFVectorFeatureKeyFrame alloc] - initWithType:keyFrameDictionary[@"type"] - paths:keyFrameDictionary[@"data"] - startFrame:0]]; - } - } - NSArray *featureAnimations = KFMapArray(featureDictionary[@"feature_animations"], ^id(NSDictionary *featureAnimationDictionary) { - return _buildAnimationModelFromDictionary(featureAnimationDictionary, fromFrame, toFrame, canvasSize); - }); - CGSize featureSize = featureDictionary[@"size"] ? CGSizeMake([featureDictionary[@"size"][0] floatValue], [featureDictionary[@"size"][1] floatValue]) : canvasSize; - - return [[KFVectorFeature alloc] - initWithName:featureDictionary[@"name"] - featureId:[featureDictionary[@"feature_id"] integerValue] - featureSize:featureSize - animationGroupId:featureDictionary[@"animation_group"] ? [featureDictionary[@"animation_group"] unsignedIntegerValue] : NSNotFound - fromFrame:featureFromFrame < fromFrame ? 0 : featureFromFrame - fromFrame - toFrame:featureToFrame - fromFrame - fillColor:featureDictionary[@"fill_color"] ? KFColorWithHexString(featureDictionary[@"fill_color"]) : [UIColor clearColor] - strokeColor:featureDictionary[@"stroke_color"] ? KFColorWithHexString(featureDictionary[@"stroke_color"]) : [UIColor clearColor] - strokeWidth:[featureDictionary[@"stroke_width"] floatValue] / MIN(canvasSize.width, canvasSize.height) - strokeLineCap:featureDictionary[@"stroke_line_cap"] - keyFrames:keyFrames - timingCurves:timingCurves - featureAnimations:featureAnimations - backedImage:featureDictionary[@"backed_image"] - masking:_buildFeatureModelFromDictionary(featureDictionary[@"masking"], fromFrame, toFrame, canvasSize) - gradientEffect:_buildGradientEffectsArrayFromArray(featureDictionary[@"effects"], fromFrame, toFrame, canvasSize) - pathTrim:_buildPathTrimModelFromDictionary(featureDictionary[@"path_trim"], fromFrame, toFrame, canvasSize)]; -} - -static KFVectorAnimationGroup *_buildAnimationGroupModelFromDictionary(NSDictionary *animationGroupDictionary, - NSUInteger fromFrame, - NSUInteger toFrame, - CGSize canvasSize) -{ - return - [[KFVectorAnimationGroup alloc] - initWithGroupName:animationGroupDictionary[@"group_name"] - groupId:[animationGroupDictionary[@"group_id"] integerValue] - parentGroupId:animationGroupDictionary[@"parent_group"] ? [animationGroupDictionary[@"parent_group"] integerValue] : NSNotFound - animations:KFMapArray(animationGroupDictionary[@"animations"], ^id(NSDictionary *animationDictionary) { - return _buildAnimationModelFromDictionary(animationDictionary, fromFrame, toFrame, canvasSize); - })]; -} - -static NSDictionary *_buildBitmapsFromDictionary(NSDictionary *bitmapsDictionary) -{ - if (!bitmapsDictionary) { - return nil; - } - NSMutableDictionary *bitmaps = [NSMutableDictionary new]; - for (NSString *bitmapName in bitmapsDictionary) { - NSString *base64String = bitmapsDictionary[bitmapName]; - NSData *data = [[NSData alloc] initWithBase64EncodedString:base64String options:0]; - bitmaps[bitmapName] = [UIImage imageWithData:data]; - } - return bitmaps; -} - -#pragma mark - Public method - -KFVector *KFVectorFromDictionary(NSDictionary *faceDictionary) -{ - NSUInteger animationFrameCount = [faceDictionary[@"animation_frame_count"] unsignedIntegerValue]; - return KFVectorFromDictionaryInRange(faceDictionary, 0, animationFrameCount); -} - -KFVector *KFVectorFromDictionaryInRange(NSDictionary *faceDictionary, NSUInteger fromFrame, NSUInteger toFrame) -{ - NSCAssert(fromFrame <= toFrame, @"From frame should be less than to frame."); - NSCAssert(fromFrame >= 0, @"From frame should be greater or equal than zero."); - NSCAssert(toFrame <= [faceDictionary[@"animation_frame_count"] unsignedIntegerValue], @"To frame should be less than frame count."); - - CGSize canvasSize = CGSizeMake([faceDictionary[@"canvas_size"][0] floatValue], [faceDictionary[@"canvas_size"][1] floatValue]); - - NSUInteger frameRate = [faceDictionary[@"frame_rate"] unsignedIntegerValue]; - NSMutableArray *featuresArray = [NSMutableArray new]; - for (NSDictionary *featureDictionary in faceDictionary[@"features"]) { - KFVectorFeature *feature = _buildFeatureModelFromDictionary(featureDictionary, fromFrame, toFrame, canvasSize); - if (feature) { - [featuresArray addObject:feature]; - } - } - - NSArray *animationGroups = KFMapArray(faceDictionary[@"animation_groups"], ^id(NSDictionary *animationGroupDictionary) { - return _buildAnimationGroupModelFromDictionary(animationGroupDictionary, fromFrame, toFrame, canvasSize); - }); - - return - [[KFVector alloc] - initWithCanvasSize:canvasSize - name:faceDictionary[@"name"] - formatVersion:faceDictionary[@"formatVersion"] ? faceDictionary[@"formatVersion"] : @"0.0" - key:[faceDictionary[@"key"] integerValue] - frameRate:frameRate - animationFrameCount:toFrame - fromFrame - features:featuresArray - animationGroups:animationGroups - bitmaps:_buildBitmapsFromDictionary(faceDictionary[@"bitmaps"])]; -} - -KFVector *KFVectorFromBitmapReplacement(KFVector *vector, NSString *key, UIImage *bitmap) -{ - NSMutableDictionary *const bitmaps = vector.bitmaps.mutableCopy; - bitmaps[key] = bitmap; - - return - [[KFVector alloc] - initWithCanvasSize:vector.canvasSize - name:vector.name - formatVersion:vector.formatVersion - key:vector.key - frameRate:vector.frameRate - animationFrameCount:vector.animationFrameCount - features:vector.features - animationGroups:vector.animationGroups - bitmaps:bitmaps]; -} diff --git a/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.h b/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.h deleted file mode 100755 index 9559beb..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "Compatibility.h" - -@class KFVector; - -#if TARGET_OS_OSX - @interface KFView: NSView - @end -#else - @interface KFView: UIView - @end -#endif - -@interface KFVectorView : KFView - -- (instancetype)initWithFrame:(CGRect)frame faceVector:(KFVector *)faceVector NS_DESIGNATED_INITIALIZER; - -- (instancetype)init __attribute__((unavailable("Must use designated initializer"))); - -- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("Must use designated initializer"))); - -- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("Must use designated initializer"))); - -@end diff --git a/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.m b/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.m deleted file mode 100755 index daece08..0000000 --- a/ios/Classes/Keyframes/keyframes-ios/Views/KFVectorView.m +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "KFVectorView.h" - -#import "KFVector.h" -#import "KFVectorLayer.h" - -// We need to initialize the layer with size greater than 0, because face layer is based on CAShapeLayer, which doesn't resize properly on -// bounds change. So when we resize the bounds, we force the redraw using scale transform. - -static const CGFloat kInititialFaceSize = 64; - -@implementation KFVectorView - -+ (Class)layerClass -{ - return [KFVectorLayer class]; -} - -#pragma mark - lifecycle - -- (instancetype)initWithFrame:(CGRect)frame - faceVector:(KFVector *)faceVector -{ - if (self = [super initWithFrame:frame]) { - // It needs to be a non-zero size so we don't divide by zero in layoutSubviews. - CGRect arbitraryNonZeroFrame = CGRectMake(0.0, - 0.0, - kInititialFaceSize, - kInititialFaceSize); - [self _faceLayer].frame = arbitraryNonZeroFrame; - [self _faceLayer].faceModel = faceVector; - [self _faceLayer].frame = frame; - } - return self; -} - -#pragma mark - helpers - -- (KFVectorLayer *)_faceLayer -{ - return (KFVectorLayer *)self.layer; -} - -@end - -@implementation KFView - -#if TARGET_OS_OSX - -- (instancetype)initWithFrame:(NSRect)frameRect -{ - if (self = [super initWithFrame:frameRect]) { - [self setWantsLayer:YES]; - } - - return self; -} - -- (BOOL)isFlipped -{ - return YES; -} - -- (CALayer *)makeBackingLayer -{ - return [KFVectorLayer layer]; -} - -#endif - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.h b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.h deleted file mode 100755 index b52e0d6..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// LOTCompositionContainer.h -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTLayerContainer.h" -#import "LOTAssetGroup.h" - -@interface LOTCompositionContainer : LOTLayerContainer - -- (instancetype _Nonnull)initWithModel:(LOTLayer * _Nullable)layer - inLayerGroup:(LOTLayerGroup * _Nullable)layerGroup - withLayerGroup:(LOTLayerGroup * _Nullable)childLayerGroup - withAssestGroup:(LOTAssetGroup * _Nullable)assetGroup; - -- (nullable NSArray *)keysForKeyPath:(nonnull LOTKeypath *)keypath; - -- (CGPoint)convertPoint:(CGPoint)point - toKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent; - -- (CGRect)convertRect:(CGRect)rect - toKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent; - -- (CGPoint)convertPoint:(CGPoint)point - fromKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent; - -- (CGRect)convertRect:(CGRect)rect - fromKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent; - -- (void)addSublayer:(nonnull CALayer *)subLayer - toKeypathLayer:(nonnull LOTKeypath *)keypath; - -- (void)maskSublayer:(nonnull CALayer *)subLayer - toKeypathLayer:(nonnull LOTKeypath *)keypath; - -@property (nonatomic, readonly, nonnull) NSArray *childLayers; -@property (nonatomic, readonly, nonnull) NSDictionary *childMap; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.m b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.m deleted file mode 100755 index 18f8ffb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTCompositionContainer.m +++ /dev/null @@ -1,239 +0,0 @@ -// -// LOTCompositionContainer.m -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTCompositionContainer.h" -#import "LOTAsset.h" -#import "CGGeometry+LOTAdditions.h" -#import "LOTHelpers.h" -#import "LOTValueInterpolator.h" -#import "LOTAnimatorNode.h" -#import "LOTRenderNode.h" -#import "LOTRenderGroup.h" -#import "LOTNumberInterpolator.h" - -@implementation LOTCompositionContainer { - NSNumber *_frameOffset; - CALayer *DEBUG_Center; - NSMutableDictionary *_keypathCache; - LOTNumberInterpolator *_timeInterpolator; -} - -- (instancetype)initWithModel:(LOTLayer *)layer - inLayerGroup:(LOTLayerGroup *)layerGroup - withLayerGroup:(LOTLayerGroup *)childLayerGroup - withAssestGroup:(LOTAssetGroup *)assetGroup { - self = [super initWithModel:layer inLayerGroup:layerGroup]; - if (self) { - DEBUG_Center = [CALayer layer]; - - DEBUG_Center.bounds = CGRectMake(0, 0, 20, 20); - DEBUG_Center.borderColor = [UIColor orangeColor].CGColor; - DEBUG_Center.borderWidth = 2; - DEBUG_Center.masksToBounds = YES; - if (ENABLE_DEBUG_SHAPES) { - [self.wrapperLayer addSublayer:DEBUG_Center]; - } - if (layer.startFrame) { - _frameOffset = layer.startFrame; - } else { - _frameOffset = @0; - } - - if (layer.timeRemapping) { - _timeInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:layer.timeRemapping.keyframes]; - } - - [self initializeWithChildGroup:childLayerGroup withAssetGroup:assetGroup]; - } - return self; -} - -- (void)initializeWithChildGroup:(LOTLayerGroup *)childGroup - withAssetGroup:(LOTAssetGroup *)assetGroup { - NSMutableDictionary *childMap = [NSMutableDictionary dictionary]; - NSMutableArray *children = [NSMutableArray array]; - NSArray *reversedItems = [[childGroup.layers reverseObjectEnumerator] allObjects]; - - CALayer *maskedLayer = nil; - for (LOTLayer *layer in reversedItems) { - LOTAsset *asset; - if (layer.referenceID) { - // Get relevant Asset - asset = [assetGroup assetModelForID:layer.referenceID]; - } - - LOTLayerContainer *child = nil; - if (asset.layerGroup) { - // Layer is a precomp - LOTCompositionContainer *compLayer = [[LOTCompositionContainer alloc] initWithModel:layer inLayerGroup:childGroup withLayerGroup:asset.layerGroup withAssestGroup:assetGroup]; - child = compLayer; - } else { - child = [[LOTLayerContainer alloc] initWithModel:layer inLayerGroup:childGroup]; - } - if (maskedLayer) { - maskedLayer.mask = child; - maskedLayer = nil; - } else { - if (layer.matteType == LOTMatteTypeAdd) { - maskedLayer = child; - } - [self.wrapperLayer addSublayer:child]; - } - [children addObject:child]; - if (child.layerName) { - [childMap setObject:child forKey:child.layerName]; - } - } - _childMap = childMap; - _childLayers = children; -} - -- (void)displayWithFrame:(NSNumber *)frame forceUpdate:(BOOL)forceUpdate { - if (ENABLE_DEBUG_LOGGING) NSLog(@"-------------------- Composition Displaying Frame %@ --------------------", frame); - [super displayWithFrame:frame forceUpdate:forceUpdate]; - NSNumber *newFrame = @((frame.floatValue - _frameOffset.floatValue) / self.timeStretchFactor.floatValue); - if (_timeInterpolator) { - newFrame = @([_timeInterpolator floatValueForFrame:newFrame]); - } - for (LOTLayerContainer *child in _childLayers) { - [child displayWithFrame:newFrame forceUpdate:forceUpdate]; - } - if (ENABLE_DEBUG_LOGGING) NSLog(@"-------------------- ------------------------------- --------------------"); - if (ENABLE_DEBUG_LOGGING) NSLog(@"-------------------- ------------------------------- --------------------"); -} - -- (void)setViewportBounds:(CGRect)viewportBounds { - [super setViewportBounds:viewportBounds]; - for (LOTLayerContainer *layer in _childLayers) { - layer.viewportBounds = viewportBounds; - } -} - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath { - if (self.layerName != nil) { - [super searchNodesForKeypath:keypath]; - } - if (self.layerName == nil || - [keypath pushKey:self.layerName]) { - for (LOTLayerContainer *child in _childLayers) { - [child searchNodesForKeypath:keypath]; - } - if (self.layerName != nil) { - [keypath popKey]; - } - } -} - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath { - if (self.layerName != nil) { - [super setValueDelegate:delegate forKeypath:keypath]; - } - if (self.layerName == nil || - [keypath pushKey:self.layerName]) { - for (LOTLayerContainer *child in _childLayers) { - [child setValueDelegate:delegate forKeypath:keypath]; - } - if (self.layerName != nil) { - [keypath popKey]; - } - } -} - -- (nullable NSArray *)keysForKeyPath:(nonnull LOTKeypath *)keypath { - if (_keypathCache == nil) { - _keypathCache = [NSMutableDictionary dictionary]; - } - [self searchNodesForKeypath:keypath]; - [_keypathCache addEntriesFromDictionary:keypath.searchResults]; - return keypath.searchResults.allKeys; -} - -- (CALayer *)_layerForKeypath:(nonnull LOTKeypath *)keypath { - id node = _keypathCache[keypath.absoluteKeypath]; - if (node == nil) { - [self keysForKeyPath:keypath]; - node = _keypathCache[keypath.absoluteKeypath]; - } - if (node == nil) { - NSLog(@"LOTComposition could not find layer for keypath:%@", keypath.absoluteKeypath); - return nil; - } - if ([node isKindOfClass:[CALayer class]]) { - return (CALayer *)node; - } - if (![node isKindOfClass:[LOTRenderNode class]]) { - NSLog(@"LOTComposition: Keypath return non-layer node:%@ ", keypath.absoluteKeypath); - return nil; - } - if ([node isKindOfClass:[LOTRenderGroup class]]) { - return [(LOTRenderGroup *)node containerLayer]; - } - LOTRenderNode *renderNode = (LOTRenderNode *)node; - return renderNode.outputLayer; -} - -- (CGPoint)convertPoint:(CGPoint)point - toKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent{ - CALayer *layer = [self _layerForKeypath:keypath]; - if (!layer) { - return CGPointZero; - } - return [parent convertPoint:point toLayer:layer]; -} - -- (CGRect)convertRect:(CGRect)rect - toKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent{ - CALayer *layer = [self _layerForKeypath:keypath]; - if (!layer) { - return CGRectZero; - } - return [parent convertRect:rect toLayer:layer]; -} - -- (CGPoint)convertPoint:(CGPoint)point - fromKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent{ - CALayer *layer = [self _layerForKeypath:keypath]; - if (!layer) { - return CGPointZero; - } - return [parent convertPoint:point fromLayer:layer]; -} - -- (CGRect)convertRect:(CGRect)rect - fromKeypathLayer:(nonnull LOTKeypath *)keypath - withParentLayer:(CALayer *_Nonnull)parent{ - CALayer *layer = [self _layerForKeypath:keypath]; - if (!layer) { - return CGRectZero; - } - return [parent convertRect:rect fromLayer:layer]; -} - -- (void)addSublayer:(nonnull CALayer *)subLayer - toKeypathLayer:(nonnull LOTKeypath *)keypath { - CALayer *layer = [self _layerForKeypath:keypath]; - if (layer) { - [layer addSublayer:subLayer]; - } -} - -- (void)maskSublayer:(nonnull CALayer *)subLayer - toKeypathLayer:(nonnull LOTKeypath *)keypath { - CALayer *layer = [self _layerForKeypath:keypath]; - if (layer) { - [layer.superlayer addSublayer:subLayer]; - [layer removeFromSuperlayer]; - subLayer.mask = layer; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.h b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.h deleted file mode 100755 index 6e4be74..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// LOTLayerContainer.h -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPlatformCompat.h" -#import "LOTLayer.h" -#import "LOTLayerGroup.h" -#import "LOTKeypath.h" -#import "LOTValueDelegate.h" - -@class LOTValueCallback; - -@interface LOTLayerContainer : CALayer - -- (instancetype _Nonnull)initWithModel:(LOTLayer * _Nullable)layer - inLayerGroup:(LOTLayerGroup * _Nullable)layerGroup; - -@property (nonatomic, readonly, strong, nullable) NSString *layerName; -@property (nonatomic, nullable) NSNumber *currentFrame; -@property (nonatomic, readonly, nonnull) NSNumber *timeStretchFactor; -@property (nonatomic, assign) CGRect viewportBounds; -@property (nonatomic, readonly, nonnull) CALayer *wrapperLayer; -@property (nonatomic, readonly, nonnull) NSDictionary *valueInterpolators; - -- (void)displayWithFrame:(NSNumber * _Nonnull)frame; -- (void)displayWithFrame:(NSNumber * _Nonnull)frame forceUpdate:(BOOL)forceUpdate; - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath; - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m deleted file mode 100755 index 52de91d..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m +++ /dev/null @@ -1,313 +0,0 @@ -// -// LOTLayerContainer.m -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTLayerContainer.h" -#import "LOTTransformInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "CGGeometry+LOTAdditions.h" -#import "LOTRenderGroup.h" -#import "LOTHelpers.h" -#import "LOTMaskContainer.h" -#import "LOTAsset.h" - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import "LOTCacheProvider.h" -#endif - -@implementation LOTLayerContainer { - LOTTransformInterpolator *_transformInterpolator; - LOTNumberInterpolator *_opacityInterpolator; - NSNumber *_inFrame; - NSNumber *_outFrame; - CALayer *DEBUG_Center; - LOTRenderGroup *_contentsGroup; - LOTMaskContainer *_maskLayer; -} - -@dynamic currentFrame; - -- (instancetype)initWithModel:(LOTLayer *)layer - inLayerGroup:(LOTLayerGroup *)layerGroup { - self = [super init]; - if (self) { - _wrapperLayer = [CALayer new]; - [self addSublayer:_wrapperLayer]; - DEBUG_Center = [CALayer layer]; - - DEBUG_Center.bounds = CGRectMake(0, 0, 20, 20); - DEBUG_Center.borderColor = [UIColor blueColor].CGColor; - DEBUG_Center.borderWidth = 2; - DEBUG_Center.masksToBounds = YES; - - if (ENABLE_DEBUG_SHAPES) { - [_wrapperLayer addSublayer:DEBUG_Center]; - } - self.actions = @{@"hidden" : [NSNull null], @"opacity" : [NSNull null], @"transform" : [NSNull null]}; - _wrapperLayer.actions = [self.actions copy]; - _timeStretchFactor = @1; - [self commonInitializeWith:layer inLayerGroup:layerGroup]; - } - return self; -} - -- (void)commonInitializeWith:(LOTLayer *)layer - inLayerGroup:(LOTLayerGroup *)layerGroup { - if (layer == nil) { - return; - } - _layerName = layer.layerName; - if (layer.layerType == LOTLayerTypeImage || - layer.layerType == LOTLayerTypeSolid || - layer.layerType == LOTLayerTypePrecomp) { - _wrapperLayer.bounds = CGRectMake(0, 0, layer.layerWidth.floatValue, layer.layerHeight.floatValue); - _wrapperLayer.anchorPoint = CGPointMake(0, 0); - _wrapperLayer.masksToBounds = YES; - DEBUG_Center.position = LOT_RectGetCenterPoint(self.bounds); - } - - if (layer.layerType == LOTLayerTypeImage) { - [self _setImageForAsset:layer.imageAsset]; - } - - _inFrame = [layer.inFrame copy]; - _outFrame = [layer.outFrame copy]; - - _timeStretchFactor = [layer.timeStretch copy]; - _transformInterpolator = [LOTTransformInterpolator transformForLayer:layer]; - - if (layer.parentID) { - NSNumber *parentID = layer.parentID; - LOTTransformInterpolator *childInterpolator = _transformInterpolator; - while (parentID != nil) { - LOTLayer *parentModel = [layerGroup layerModelForID:parentID]; - LOTTransformInterpolator *interpolator = [LOTTransformInterpolator transformForLayer:parentModel]; - childInterpolator.inputNode = interpolator; - childInterpolator = interpolator; - parentID = parentModel.parentID; - } - } - _opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:layer.opacity.keyframes]; - if (layer.layerType == LOTLayerTypeShape && - layer.shapes.count) { - [self buildContents:layer.shapes]; - } - if (layer.layerType == LOTLayerTypeSolid) { - _wrapperLayer.backgroundColor = layer.solidColor.CGColor; - } - if (layer.masks.count) { - _maskLayer = [[LOTMaskContainer alloc] initWithMasks:layer.masks]; - _wrapperLayer.mask = _maskLayer; - } - - NSMutableDictionary *interpolators = [NSMutableDictionary dictionary]; - interpolators[@"Opacity"] = _opacityInterpolator; - interpolators[@"Anchor Point"] = _transformInterpolator.anchorInterpolator; - interpolators[@"Scale"] = _transformInterpolator.scaleInterpolator; - interpolators[@"Rotation"] = _transformInterpolator.rotationInterpolator; - if (_transformInterpolator.positionXInterpolator && - _transformInterpolator.positionYInterpolator) { - interpolators[@"X Position"] = _transformInterpolator.positionXInterpolator; - interpolators[@"Y Position"] = _transformInterpolator.positionYInterpolator; - } else if (_transformInterpolator.positionInterpolator) { - interpolators[@"Position"] = _transformInterpolator.positionInterpolator; - } - - // Deprecated - interpolators[@"Transform.Opacity"] = _opacityInterpolator; - interpolators[@"Transform.Anchor Point"] = _transformInterpolator.anchorInterpolator; - interpolators[@"Transform.Scale"] = _transformInterpolator.scaleInterpolator; - interpolators[@"Transform.Rotation"] = _transformInterpolator.rotationInterpolator; - if (_transformInterpolator.positionXInterpolator && - _transformInterpolator.positionYInterpolator) { - interpolators[@"Transform.X Position"] = _transformInterpolator.positionXInterpolator; - interpolators[@"Transform.Y Position"] = _transformInterpolator.positionYInterpolator; - } else if (_transformInterpolator.positionInterpolator) { - interpolators[@"Transform.Position"] = _transformInterpolator.positionInterpolator; - } - _valueInterpolators = interpolators; -} - -- (void)buildContents:(NSArray *)contents { - _contentsGroup = [[LOTRenderGroup alloc] initWithInputNode:nil contents:contents keyname:_layerName]; - [_wrapperLayer addSublayer:_contentsGroup.containerLayer]; -} - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -- (void)_setImageForAsset:(LOTAsset *)asset { - if (asset.imageName) { - UIImage *image; - if (asset.rootDirectory.length > 0) { - NSString *rootDirectory = asset.rootDirectory; - if (asset.imageDirectory.length > 0) { - rootDirectory = [rootDirectory stringByAppendingPathComponent:asset.imageDirectory]; - } - NSString *imagePath = [rootDirectory stringByAppendingPathComponent:asset.imageName]; - - id imageCache = [LOTCacheProvider imageCache]; - if (imageCache) { - image = [imageCache imageForKey:imagePath]; - if (!image) { - image = [UIImage imageWithContentsOfFile:imagePath]; - [imageCache setImage:image forKey:imagePath]; - } - } else { - image = [UIImage imageWithContentsOfFile:imagePath]; - } - } else { - NSString *imagePath = [asset.assetBundle pathForResource:asset.imageName ofType:nil]; - image = [UIImage imageWithContentsOfFile:imagePath]; - } - - if (image) { - _wrapperLayer.contents = (__bridge id _Nullable)(image.CGImage); - } else { - NSLog(@"%s: Warn: image not found: %@", __PRETTY_FUNCTION__, asset.imageName); - } - } -} - -#else - -- (void)_setImageForAsset:(LOTAsset *)asset { - 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]; - _wrapperLayer.contents = layerContents; - } - } - -} - -#endif - -// MARK - Animation - -+ (BOOL)needsDisplayForKey:(NSString *)key { - if ([key isEqualToString:@"currentFrame"]) { - return YES; - } - return [super needsDisplayForKey:key]; -} - -- (id)actionForKey:(NSString *)event { - if ([event isEqualToString:@"currentFrame"]) { - CABasicAnimation *theAnimation = [CABasicAnimation - animationWithKeyPath:event]; - theAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; - theAnimation.fromValue = [[self presentationLayer] valueForKey:event]; - return theAnimation; - } - return [super actionForKey:event]; -} - -- (id)initWithLayer:(id)layer { - if (self = [super initWithLayer:layer]) { - if ([layer isKindOfClass:[LOTLayerContainer class]]) { - LOTLayerContainer *other = (LOTLayerContainer *)layer; - self.currentFrame = [other.currentFrame copy]; - } - } - return self; -} - -- (void)display { - @synchronized(self) { - LOTLayerContainer *presentation = self; - if (self.animationKeys.count && - self.presentationLayer) { - presentation = (LOTLayerContainer *)self.presentationLayer; - } - [self displayWithFrame:presentation.currentFrame]; - } -} - -- (void)displayWithFrame:(NSNumber *)frame { - [self displayWithFrame:frame forceUpdate:NO]; -} - -- (void)displayWithFrame:(NSNumber *)frame forceUpdate:(BOOL)forceUpdate { - NSNumber *newFrame = @(frame.floatValue / self.timeStretchFactor.floatValue); - if (ENABLE_DEBUG_LOGGING) NSLog(@"View %@ Displaying Frame %@, with local time %@", self, frame, newFrame); - BOOL hidden = NO; - if (_inFrame && _outFrame) { - hidden = (frame.floatValue < _inFrame.floatValue || - frame.floatValue > _outFrame.floatValue); - } - self.hidden = hidden; - if (hidden) { - return; - } - if (_opacityInterpolator && [_opacityInterpolator hasUpdateForFrame:newFrame]) { - self.opacity = [_opacityInterpolator floatValueForFrame:newFrame]; - } - if (_transformInterpolator && [_transformInterpolator hasUpdateForFrame:newFrame]) { - _wrapperLayer.transform = [_transformInterpolator transformForFrame:newFrame]; - } - [_contentsGroup updateWithFrame:newFrame withModifierBlock:nil forceLocalUpdate:forceUpdate]; - _maskLayer.currentFrame = newFrame; -} - -- (void)setViewportBounds:(CGRect)viewportBounds { - _viewportBounds = viewportBounds; - if (_maskLayer) { - CGPoint center = LOT_RectGetCenterPoint(viewportBounds); - viewportBounds.origin = CGPointMake(-center.x, -center.y); - _maskLayer.bounds = viewportBounds; - } -} - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath { - if (_contentsGroup == nil && [keypath pushKey:self.layerName]) { - // Matches self. - if ([keypath pushKey:@"Transform"]) { - // Is a transform node, check interpolators - LOTValueInterpolator *interpolator = _valueInterpolators[keypath.currentKey]; - if (interpolator) { - // We have a match! - [keypath pushKey:keypath.currentKey]; - [keypath addSearchResultForCurrentPath:_wrapperLayer]; - [keypath popKey]; - } - if (keypath.endOfKeypath) { - [keypath addSearchResultForCurrentPath:_wrapperLayer]; - } - [keypath popKey]; - } - if (keypath.endOfKeypath) { - [keypath addSearchResultForCurrentPath:_wrapperLayer]; - } - [keypath popKey]; - } - [_contentsGroup searchNodesForKeypath:keypath]; -} - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath { - if ([keypath pushKey:self.layerName]) { - // Matches self. - if ([keypath pushKey:@"Transform"]) { - // Is a transform node, check interpolators - LOTValueInterpolator *interpolator = _valueInterpolators[keypath.currentKey]; - if (interpolator) { - // We have a match! - [interpolator setValueDelegate:delegate]; - } - [keypath popKey]; - } - [keypath popKey]; - } - [_contentsGroup setValueDelegate:delegate forKeypath:keypath]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.h b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.h deleted file mode 100755 index f8be5c9..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// LOTMaskContainer.h -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTMask.h" - -@interface LOTMaskContainer : CALayer - -- (instancetype _Nonnull)initWithMasks:(NSArray * _Nonnull)masks; - -@property (nonatomic, strong, nullable) NSNumber *currentFrame; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.m b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.m deleted file mode 100755 index e14fd83..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableLayers/LOTMaskContainer.m +++ /dev/null @@ -1,107 +0,0 @@ -// -// LOTMaskContainer.m -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTMaskContainer.h" -#import "LOTPathInterpolator.h" -#import "LOTNumberInterpolator.h" - -@interface LOTMaskNodeLayer : CAShapeLayer - -@property (nonatomic, readonly) LOTMask *maskNode; - -- (instancetype)initWithMask:(LOTMask *)maskNode; -- (BOOL)hasUpdateForFrame:(NSNumber *)frame; - -@end - -@implementation LOTMaskNodeLayer { - LOTPathInterpolator *_pathInterpolator; - LOTNumberInterpolator *_opacityInterpolator; - LOTNumberInterpolator *_expansionInterpolator; -} - -- (instancetype)initWithMask:(LOTMask *)maskNode { - self = [super init]; - if (self) { - _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; - } - return self; -} - -- (void)updateForFrame:(NSNumber *)frame withViewBounds:(CGRect)viewBounds { - if ([self hasUpdateForFrame:frame]) { - LOTBezierPath *path = [_pathInterpolator pathForFrame:frame cacheLengths:NO]; - - if (self.maskNode.maskMode == LOTMaskModeSubtract) { - CGMutablePathRef pathRef = CGPathCreateMutable(); - CGPathAddRect(pathRef, NULL, viewBounds); - CGPathAddPath(pathRef, NULL, path.CGPath); - self.path = pathRef; - self.fillRule = @"even-odd"; - CGPathRelease(pathRef); - } else { - self.path = path.CGPath; - } - - self.opacity = [_opacityInterpolator floatValueForFrame:frame]; - } -} - -- (BOOL)hasUpdateForFrame:(NSNumber *)frame { - return ([_pathInterpolator hasUpdateForFrame:frame] || - [_opacityInterpolator hasUpdateForFrame:frame]); -} - -@end - -@implementation LOTMaskContainer { - NSArray *_masks; -} - -- (instancetype)initWithMasks:(NSArray *)masks { - self = [super init]; - if (self) { - NSMutableArray *maskNodes = [NSMutableArray array]; - CALayer *containerLayer = [CALayer layer]; - - for (LOTMask *mask in masks) { - LOTMaskNodeLayer *node = [[LOTMaskNodeLayer alloc] initWithMask:mask]; - [maskNodes addObject:node]; - if (mask.maskMode == LOTMaskModeAdd || - mask == masks.firstObject) { - [containerLayer addSublayer:node]; - } else { - containerLayer.mask = node; - CALayer *newContainer = [CALayer layer]; - [newContainer addSublayer:containerLayer]; - containerLayer = newContainer; - } - } - [self addSublayer:containerLayer]; - _masks = maskNodes; - - } - return self; -} - -- (void)setCurrentFrame:(NSNumber *)currentFrame { - if (_currentFrame == currentFrame) { - return; - } - _currentFrame = currentFrame; - - for (LOTMaskNodeLayer *nodeLayer in _masks) { - [nodeLayer updateForFrame:currentFrame withViewBounds:self.bounds]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.h b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.h deleted file mode 100755 index 132d100..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// LOTBezierData.h -// Lottie -// -// Created by brandon_withrow on 7/10/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTBezierData : NSObject - -- (instancetype)initWithData:(NSDictionary *)bezierData; - -@property (nonatomic, readonly) NSInteger count; -@property (nonatomic, readonly) BOOL closed; - -- (CGPoint)vertexAtIndex:(NSInteger)index; -- (CGPoint)inTangentAtIndex:(NSInteger)index; -- (CGPoint)outTangentAtIndex:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.m b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.m deleted file mode 100755 index b33e32b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTBezierData.m +++ /dev/null @@ -1,100 +0,0 @@ -// -// LOTBezierData.m -// Lottie -// -// Created by brandon_withrow on 7/10/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTBezierData.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTBezierData { - CGPoint *_vertices; - CGPoint *_inTangents; - CGPoint *_outTangents; -} - -- (instancetype)initWithData:(NSDictionary *)bezierData -{ - self = [super init]; - if (self) { - [self initializeData:bezierData]; - } - return self; -} - -- (void)dealloc { - free(_vertices); - free(_inTangents); - free(_outTangents); -} - -- (CGPoint)vertexAtIndex:(NSInteger)index { - NSAssert((index < _count && - index >= 0), - @"Lottie: Index out of bounds"); - return _vertices[index]; -} - -- (CGPoint)inTangentAtIndex:(NSInteger)index { - NSAssert((index < _count && - index >= 0), - @"Lottie: Index out of bounds"); - return _inTangents[index]; -} - -- (CGPoint)outTangentAtIndex:(NSInteger)index { - NSAssert((index < _count && - index >= 0), - @"Lottie: Index out of bounds"); - return _outTangents[index]; -} - -- (void)initializeData:(NSDictionary *)bezierData { - - NSArray *pointsArray = bezierData[@"v"]; - NSArray *inTangents = bezierData[@"i"]; - NSArray *outTangents = bezierData[@"o"]; - - if (pointsArray.count == 0) { - NSLog(@"%s: Warning: shape has no vertices", __PRETTY_FUNCTION__); - return ; - } - - NSAssert((pointsArray.count == inTangents.count && - pointsArray.count == outTangents.count), - @"Lottie: Incorrect number of points and tangents"); - _count = pointsArray.count; - _vertices = (CGPoint *)malloc(sizeof(CGPoint) * pointsArray.count); - _inTangents = (CGPoint *)malloc(sizeof(CGPoint) * pointsArray.count); - _outTangents = (CGPoint *)malloc(sizeof(CGPoint) * pointsArray.count); - if (bezierData[@"c"]) { - _closed = [bezierData[@"c"] boolValue]; - } - for (int i = 0; i < pointsArray.count; i ++) { - CGPoint vertex = [self _vertexAtIndex:i inArray:pointsArray]; - CGPoint outTan = LOT_PointAddedToPoint(vertex, [self _vertexAtIndex:i inArray:outTangents]); - CGPoint inTan = LOT_PointAddedToPoint(vertex, [self _vertexAtIndex:i inArray:inTangents]); - // BW BUG Straight Lines - Test Later - // Bake fix for lines here - _vertices[i] = vertex; - _inTangents[i] = inTan; - _outTangents[i] = outTan; - } -} - -- (CGPoint)_vertexAtIndex:(NSInteger)idx inArray:(NSArray *)points { - NSAssert((idx < points.count), - @"Lottie: Vertex Point out of bounds"); - - NSArray *pointArray = points[idx]; - - NSAssert((pointArray.count >= 2 && - [pointArray.firstObject isKindOfClass:[NSNumber class]]), - @"Lottie: Point Data Malformed"); - - return CGPointMake([(NSNumber *)pointArray[0] floatValue], [(NSNumber *)pointArray[1] floatValue]); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.h b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.h deleted file mode 100755 index c2e3778..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// LOTKeyframe.h -// Pods -// -// Created by brandon_withrow on 7/10/17. -// -// - -#import -#import -#import "LOTPlatformCompat.h" -#import "LOTBezierData.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTKeyframe : NSObject - -- (instancetype)initWithKeyframe:(NSDictionary *)keyframe; -- (instancetype)initWithValue:(id)value; -- (void)remapValueWithBlock:(CGFloat (^)(CGFloat inValue))remapBlock; -- (LOTKeyframe *)copyWithData:(id)data; - -@property (nonatomic, readonly) NSNumber *keyframeTime; -@property (nonatomic, readonly) BOOL isHold; -@property (nonatomic, readonly) CGPoint inTangent; -@property (nonatomic, readonly) CGPoint outTangent; -@property (nonatomic, readonly) CGPoint spatialInTangent; -@property (nonatomic, readonly) CGPoint spatialOutTangent; - -@property (nonatomic, readonly) CGFloat floatValue; -@property (nonatomic, readonly) CGPoint pointValue; -@property (nonatomic, readonly) CGSize sizeValue; -@property (nonatomic, readonly) UIColor *colorValue; -@property (nonatomic, readonly, nullable) LOTBezierData *pathData; -@property (nonatomic, readonly) NSArray *arrayValue; - -@end - -@interface LOTKeyframeGroup : NSObject - -- (instancetype)initWithData:(id)data; - -- (void)remapKeyframesWithBlock:(CGFloat (^)(CGFloat inValue))remapBlock; - -@property (nonatomic, readonly) NSArray *keyframes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.m b/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.m deleted file mode 100755 index a77a073..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/AnimatableProperties/LOTKeyframe.m +++ /dev/null @@ -1,242 +0,0 @@ -// -// LOTKeyframe.m -// Pods -// -// Created by brandon_withrow on 7/10/17. -// -// - -#import "LOTKeyframe.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTKeyframe - -- (instancetype)initWithKeyframe:(NSDictionary *)keyframe { - self = [super init]; - if (self) { - _keyframeTime = keyframe[@"t"]; - _inTangent = CGPointZero; - _outTangent = CGPointZero; - _spatialInTangent = CGPointZero; - _spatialOutTangent = CGPointZero; - NSDictionary *timingOutTangent = keyframe[@"o"]; - NSDictionary *timingInTangent = keyframe[@"i"]; - if (timingInTangent) { - _inTangent = [self _pointFromValueDict:timingInTangent]; - } - if (timingOutTangent) { - _outTangent = [self _pointFromValueDict:timingOutTangent]; - } - if ([keyframe[@"h"] boolValue]) { - _isHold = YES; - } - if (keyframe[@"to"]) { - NSArray *to = keyframe[@"to"]; - _spatialOutTangent = [self _pointFromValueArray:to]; - } - if (keyframe[@"ti"]) { - NSArray *ti = keyframe[@"ti"]; - _spatialInTangent = [self _pointFromValueArray:ti]; - } - id data = keyframe[@"s"]; - if (data) { - [self setupOutputWithData:data]; - } - } - return self; -} - -- (instancetype)initWithValue:(id)value { - self = [super init]; - if (self) { - _keyframeTime = @0; - _isHold = YES; - [self setupOutputWithData:value]; - } - return self; -} - -- (instancetype)initWithLOTKeyframe:(LOTKeyframe *)keyframe { - self = [super init]; - if (self) { - _keyframeTime = [keyframe.keyframeTime copy]; - _inTangent = keyframe.inTangent; - _outTangent = keyframe.outTangent; - _spatialInTangent = keyframe.spatialInTangent; - _spatialOutTangent = keyframe.spatialOutTangent; - _isHold = keyframe.isHold; - } - return self; -} - -- (LOTKeyframe *)copyWithData:(id)data { - LOTKeyframe *newFrame = [[LOTKeyframe alloc] initWithLOTKeyframe:self]; - [newFrame setData:data]; - return newFrame; -} - -- (void)setData:(id)data { - [self setupOutputWithData:data]; -} - -- (void)remapValueWithBlock:(CGFloat (^)(CGFloat inValue))remapBlock { - _floatValue = remapBlock(_floatValue); - _pointValue = CGPointMake(remapBlock(_pointValue.x), remapBlock(_pointValue.y)); - _sizeValue = CGSizeMake(remapBlock(_sizeValue.width), remapBlock(_sizeValue.height)); -} - -- (void)setupOutputWithData:(id)data { - if ([data isKindOfClass:[NSNumber class]]) { - _floatValue = [(NSNumber *)data floatValue]; - } - if ([data isKindOfClass:[NSArray class]] && - [[(NSArray *)data firstObject] isKindOfClass:[NSNumber class]]) { - NSArray *numberArray = (NSArray *)data; - if (numberArray.count > 0) { - _floatValue = [(NSNumber *)numberArray[0] floatValue]; - } - if (numberArray.count > 1) { - _pointValue = CGPointMake(_floatValue = [(NSNumber *)numberArray[0] floatValue], - _floatValue = [(NSNumber *)numberArray[1] floatValue]); - _sizeValue = CGSizeMake(_pointValue.x, _pointValue.y); - } - if (numberArray.count > 3) { - _colorValue = [self _colorValueFromArray:numberArray]; - } - _arrayValue = numberArray; - } else if ([data isKindOfClass:[NSArray class]] && - [[(NSArray *)data firstObject] isKindOfClass:[NSDictionary class]]) { - _pathData = [[LOTBezierData alloc] initWithData:[(NSArray *)data firstObject]]; - } else if ([data isKindOfClass:[NSDictionary class]]) { - _pathData = [[LOTBezierData alloc] initWithData:data]; - } -} - -- (CGPoint)_pointFromValueArray:(NSArray *)values { - CGPoint returnPoint = CGPointZero; - if (values.count > 1) { - returnPoint.x = [(NSNumber *)values[0] floatValue]; - returnPoint.y = [(NSNumber *)values[1] floatValue]; - } - return returnPoint; -} - -- (CGPoint)_pointFromValueDict:(NSDictionary *)values { - NSNumber *xValue = @0, *yValue = @0; - if ([values[@"x"] isKindOfClass:[NSNumber class]]) { - xValue = values[@"x"]; - } else if ([values[@"x"] isKindOfClass:[NSArray class]]) { - xValue = values[@"x"][0]; - } - - if ([values[@"y"] isKindOfClass:[NSNumber class]]) { - yValue = values[@"y"]; - } else if ([values[@"y"] isKindOfClass:[NSArray class]]) { - yValue = values[@"y"][0]; - } - - return CGPointMake([xValue floatValue], [yValue floatValue]); -} - -- (UIColor *)_colorValueFromArray:(NSArray *)colorArray { - if (colorArray.count == 4) { - BOOL shouldUse255 = NO; - for (NSNumber *number in colorArray) { - if (number.floatValue > 1) { - shouldUse255 = YES; - } - } - return [UIColor colorWithRed:colorArray[0].floatValue / (shouldUse255 ? 255.f : 1.f) - green:colorArray[1].floatValue / (shouldUse255 ? 255.f : 1.f) - blue:colorArray[2].floatValue / (shouldUse255 ? 255.f : 1.f) - alpha:colorArray[3].floatValue / (shouldUse255 ? 255.f : 1.f)]; - } - return nil; -} - -@end - -@implementation LOTKeyframeGroup - -- (instancetype)initWithData:(id)data { - self = [super init]; - if (self) { - if ([data isKindOfClass:[NSDictionary class]] && - [(NSDictionary *)data valueForKey:@"k"]) { - [self buildKeyframesFromData:[(NSDictionary *)data valueForKey:@"k"]]; - } else { - [self buildKeyframesFromData:data]; - } - } - return self; -} - -- (void)buildKeyframesFromData:(id)data { - if ([data isKindOfClass:[NSArray class]] && - [[(NSArray *)data firstObject] isKindOfClass:[NSDictionary class]] && - [(NSArray *)data firstObject][@"t"]) { - // Array of Keyframes - NSArray *keyframes = (NSArray *)data; - NSMutableArray *keys = [NSMutableArray array]; - NSDictionary *previousFrame = nil; - for (NSDictionary *keyframe in keyframes) { - NSMutableDictionary *currentFrame = [NSMutableDictionary dictionary]; - if (keyframe[@"t"]) { - // Set time - currentFrame[@"t"] = keyframe[@"t"]; - } - if (keyframe[@"s"]) { - // Set Value for Keyframe - currentFrame[@"s"] = keyframe[@"s"]; - } else if (previousFrame[@"e"]) { - // Set Value for Keyframe - currentFrame[@"s"] = previousFrame[@"e"]; - } - if (keyframe[@"o"]) { - // Set out tangent - currentFrame[@"o"] = keyframe[@"o"]; - } - if (previousFrame[@"i"]) { - currentFrame[@"i"] = previousFrame[@"i"]; - } - if (keyframe[@"to"]) { - // Set out tangent - currentFrame[@"to"] = keyframe[@"to"]; - } - if (previousFrame[@"ti"]) { - currentFrame[@"ti"] = previousFrame[@"ti"]; - } - if (keyframe[@"h"]) { - currentFrame[@"h"] = keyframe[@"h"]; - } - LOTKeyframe *key = [[LOTKeyframe alloc] initWithKeyframe:currentFrame]; - [keys addObject:key]; - previousFrame = keyframe; - } - _keyframes = keys; - - } else { - LOTKeyframe *key = [[LOTKeyframe alloc] initWithValue:data]; - _keyframes = @[key]; - } -} - -- (void)remapKeyframesWithBlock:(CGFloat (^)(CGFloat))remapBlock { - for (LOTKeyframe *keyframe in _keyframes) { - [keyframe remapValueWithBlock:remapBlock]; - } -} - -@end -/* - +KeyFrameObject has - + i (PointObject) // Timing curve in tangent - + o (PointObject) // Timing curve out tangent - + n (array of string) // String representation of timing curve - + t (integer) // Keyframe time for start of keyframe - + s (float or array of float or PathObject) // The key information - + e (float or array of float or PathObject) // The end key information - + to (array of float) // For spacial bezier path interpolation, the in tangent - + ti (array of float) // For spacial bezier path interpolation, the out tangent - + h (integer) // If the keyframe is a Hold keyframe or not -*/ diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.h b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.h deleted file mode 100755 index 2821223..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.h +++ /dev/null @@ -1,98 +0,0 @@ - -#import "LOTPlatformCompat.h" - -#import - -// -// Core Graphics Geometry Additions -// - -extern const CGSize CGSizeMax; - -CGRect LOT_RectIntegral(CGRect rect); - -// Centering - -// Returns a rectangle of the given size, centered at a point -CGRect LOT_RectCenteredAtPoint(CGPoint center, CGSize size, BOOL integral); - -// Returns the center point of a CGRect -CGPoint LOT_RectGetCenterPoint(CGRect rect); - -// Insetting - -// Inset the rectangle on a single edge -CGRect LOT_RectInsetLeft(CGRect rect, CGFloat inset); -CGRect LOT_RectInsetRight(CGRect rect, CGFloat inset); -CGRect LOT_RectInsetTop(CGRect rect, CGFloat inset); -CGRect LOT_RectInsetBottom(CGRect rect, CGFloat inset); - -// Inset the rectangle on two edges -CGRect LOT_RectInsetHorizontal(CGRect rect, CGFloat leftInset, CGFloat rightInset); -CGRect LOT_RectInsetVertical(CGRect rect, CGFloat topInset, CGFloat bottomInset); - -// Inset the rectangle on all edges -CGRect LOT_RectInsetAll(CGRect rect, CGFloat leftInset, CGFloat rightInset, CGFloat topInset, CGFloat bottomInset); - -// Framing - -// Returns a rectangle of size framed in the center of the given rectangle -CGRect LOT_RectFramedCenteredInRect(CGRect rect, CGSize size, BOOL integral); - -// Returns a rectangle of size framed in the given rectangle and inset -CGRect LOT_RectFramedLeftInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral); -CGRect LOT_RectFramedRightInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral); -CGRect LOT_RectFramedTopInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral); -CGRect LOT_RectFramedBottomInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral); - -CGRect LOT_RectFramedTopLeftInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral); -CGRect LOT_RectFramedTopRightInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral); -CGRect LOT_RectFramedBottomLeftInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral); -CGRect LOT_RectFramedBottomRightInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral); - -// Divides a rect into sections and returns the section at specified index - -CGRect LOT_RectDividedSection(CGRect rect, NSInteger sections, NSInteger index, CGRectEdge fromEdge); - -// Returns a rectangle of size attached to the given rectangle -CGRect LOT_RectAttachedLeftToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral); -CGRect LOT_RectAttachedRightToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral); -CGRect LOT_RectAttachedTopToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral); -CGRect LOT_RectAttachedBottomToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral); - -CGRect LOT_RectAttachedBottomLeftToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral); -CGRect LOT_RectAttachedBottomRightToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral); -CGRect LOT_RectAttachedTopRightToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral); -CGRect LOT_RectAttachedTopLeftToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral); - -BOOL LOT_CGPointIsZero(CGPoint point); - -// Combining -// Adds all values of the 2nd rect to the first rect -CGRect LOT_RectAddRect(CGRect rect, CGRect other); -CGRect LOT_RectAddPoint(CGRect rect, CGPoint point); -CGRect LOT_RectAddSize(CGRect rect, CGSize size); -CGRect LOT_RectBounded(CGRect rect); - -CGPoint LOT_PointAddedToPoint(CGPoint point1, CGPoint point2); - -CGRect LOT_RectSetHeight(CGRect rect, CGFloat height); - -CGFloat LOT_PointDistanceFromPoint(CGPoint point1, CGPoint point2); -CGFloat LOT_DegreesToRadians(CGFloat degrees); - -CGFloat LOT_RemapValue(CGFloat value, CGFloat low1, CGFloat high1, CGFloat low2, CGFloat high2 ); -CGPoint LOT_PointByLerpingPoints(CGPoint point1, CGPoint point2, CGFloat value); - -CGPoint LOT_PointInLine(CGPoint A, CGPoint B, CGFloat T); -CGPoint LOT_PointInCubicCurve(CGPoint start, CGPoint cp1, CGPoint cp2, CGPoint end, CGFloat T); - -CGFloat LOT_CubicBezeirInterpolate(CGPoint P0, CGPoint P1, CGPoint P2, CGPoint P3, CGFloat x); -CGFloat LOT_SolveCubic(CGFloat a, CGFloat b, CGFloat c, CGFloat d); -CGFloat LOT_SolveQuadratic(CGFloat a, CGFloat b, CGFloat c); -CGFloat LOT_Squared(CGFloat f); -CGFloat LOT_Cubed(CGFloat f); -CGFloat LOT_CubicRoot(CGFloat f); - -CGFloat LOT_CubicLength(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint1, CGPoint controlPoint2); -CGFloat LOT_CubicLengthWithPrecision(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint1, CGPoint controlPoint2, CGFloat iterations); diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.m b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.m deleted file mode 100755 index 61aa460..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/CGGeometry+LOTAdditions.m +++ /dev/null @@ -1,480 +0,0 @@ - -#import "CGGeometry+LOTAdditions.h" - -const CGSize CGSizeMax = {CGFLOAT_MAX, CGFLOAT_MAX}; -// -// Core Graphics Geometry Additions -// - -// CGRectIntegral returns a rectangle with the smallest integer values for its origin and size that contains the source rectangle. -// For a rect with .origin={5, 5.5}, .size=(10, 10), it will return .origin={5,5}, .size={10, 11}; -// LOT_RectIntegral will return {5,5}, {10, 10}. -CGRect LOT_RectIntegral(CGRect rect) { - rect.origin = CGPointMake(rintf(rect.origin.x), rintf(rect.origin.y)); - rect.size = CGSizeMake(ceilf(rect.size.width), ceil(rect.size.height)); - return rect; -} - -// -// Centering - -// Returns a rectangle of the given size, centered at a point - -CGRect LOT_RectCenteredAtPoint(CGPoint center, CGSize size, BOOL integral) { - CGRect result; - result.origin.x = center.x - 0.5f * size.width; - result.origin.y = center.y - 0.5f * size.height; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -// Returns the center point of a CGRect -CGPoint LOT_RectGetCenterPoint(CGRect rect) { - return CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); -} - -// -// Insetting - -// Inset the rectangle on a single edge - -CGRect LOT_RectInsetLeft(CGRect rect, CGFloat inset) { - rect.origin.x += inset; - rect.size.width -= inset; - return rect; -} - -CGRect LOT_RectInsetRight(CGRect rect, CGFloat inset) { - rect.size.width -= inset; - return rect; -} - -CGRect LOT_RectInsetTop(CGRect rect, CGFloat inset) { - rect.origin.y += inset; - rect.size.height -= inset; - return rect; -} - -CGRect LOT_RectInsetBottom(CGRect rect, CGFloat inset) { - rect.size.height -= inset; - return rect; -} - -// Inset the rectangle on two edges - -CGRect LOT_RectInsetHorizontal(CGRect rect, CGFloat leftInset, CGFloat rightInset) { - rect.origin.x += leftInset; - rect.size.width -= (leftInset + rightInset); - return rect; -} - -CGRect LOT_RectInsetVertical(CGRect rect, CGFloat topInset, CGFloat bottomInset) { - rect.origin.y += topInset; - rect.size.height -= (topInset + bottomInset); - return rect; -} - -// Inset the rectangle on all edges - -CGRect LOT_RectInsetAll(CGRect rect, CGFloat leftInset, CGFloat rightInset, CGFloat topInset, CGFloat bottomInset) { - rect.origin.x += leftInset; - rect.origin.y += topInset; - rect.size.width -= (leftInset + rightInset); - rect.size.height -= (topInset + bottomInset); - return rect; -} - -// -// Framing - -// Returns a rectangle of size framed in the center of the given rectangle - -CGRect LOT_RectFramedCenteredInRect(CGRect rect, CGSize size, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rintf(0.5f * (rect.size.width - size.width)); - result.origin.y = rect.origin.y + rintf(0.5f * (rect.size.height - size.height)); - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -// Returns a rectangle of size framed in the given rectangle and inset - -CGRect LOT_RectFramedLeftInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + inset; - result.origin.y = rect.origin.y + rintf(0.5f * (rect.size.height - size.height)); - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedRightInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width - size.width - inset; - result.origin.y = rect.origin.y + rintf(0.5f * (rect.size.height - size.height)); - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedTopInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rintf(0.5f * (rect.size.width - size.width)); - result.origin.y = rect.origin.y + inset; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedBottomInRect(CGRect rect, CGSize size, CGFloat inset, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rintf(0.5f * (rect.size.width - size.width)); - result.origin.y = rect.origin.y + rect.size.height - size.height - inset; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedTopLeftInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + insetWidth; - result.origin.y = rect.origin.y + insetHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedTopRightInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width - size.width - insetWidth; - result.origin.y = rect.origin.y + insetHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedBottomLeftInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + insetWidth; - result.origin.y = rect.origin.y + rect.size.height - size.height - insetHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectFramedBottomRightInRect(CGRect rect, CGSize size, CGFloat insetWidth, CGFloat insetHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width - size.width - insetWidth; - result.origin.y = rect.origin.y + rect.size.height - size.height - insetHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -// Returns a rectangle of size attached to the given rectangle - -CGRect LOT_RectAttachedLeftToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x - size.width - margin; - result.origin.y = rect.origin.y + rintf(0.5f * (rect.size.height - size.height)); - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedRightToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width + margin; - result.origin.y = rect.origin.y + rintf(0.5f * (rect.size.height - size.height)); - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedTopToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rintf(0.5f * (rect.size.width - size.width)); - result.origin.y = rect.origin.y - size.height - margin; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedTopLeftToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + marginWidth; - result.origin.y = rect.origin.y - size.height - marginHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedTopRightToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width - size.width - marginWidth; - result.origin.y = rect.origin.y - rect.size.height - marginHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedBottomToRect(CGRect rect, CGSize size, CGFloat margin, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rintf(0.5f * (rect.size.width - size.width)); - result.origin.y = rect.origin.y + rect.size.height + margin; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedBottomLeftToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + marginWidth; - result.origin.y = rect.origin.y + rect.size.height + marginHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -CGRect LOT_RectAttachedBottomRightToRect(CGRect rect, CGSize size, CGFloat marginWidth, CGFloat marginHeight, BOOL integral) { - CGRect result; - result.origin.x = rect.origin.x + rect.size.width - size.width - marginWidth; - result.origin.y = rect.origin.y + rect.size.height + marginHeight; - result.size = size; - - if (integral) { result = LOT_RectIntegral(result); } - return result; -} - -// Divides a rect into sections and returns the section at specified index - -CGRect LOT_RectDividedSection(CGRect rect, NSInteger sections, NSInteger index, CGRectEdge fromEdge) { - if (sections == 0) { - return CGRectZero; - } - CGRect r = rect; - if (fromEdge == CGRectMaxXEdge || fromEdge == CGRectMinXEdge) { - r.size.width = rect.size.width / sections; - r.origin.x += r.size.width * index; - } else { - r.size.height = rect.size.height / sections; - r.origin.y += r.size.height * index; - } - return r; -} - - -CGRect LOT_RectAddRect(CGRect rect, CGRect other) { - return CGRectMake(rect.origin.x + other.origin.x, rect.origin.y + other.origin.y, - rect.size.width + other.size.width, rect.size.height + other.size.height); -} - -CGRect LOT_RectAddPoint(CGRect rect, CGPoint point) { - return CGRectMake(rect.origin.x + point.x, rect.origin.y + point.y, - rect.size.width, rect.size.height); -} - -CGRect LOT_RectAddSize(CGRect rect, CGSize size) { - return CGRectMake(rect.origin.x, rect.origin.y, - rect.size.width + size.width, rect.size.height + size.height); -} - -CGRect LOT_RectBounded(CGRect rect) { - CGRect returnRect = rect; - returnRect.origin = CGPointZero; - return returnRect; -} - -CGPoint LOT_PointAddedToPoint(CGPoint point1, CGPoint point2) { - CGPoint returnPoint = point1; - returnPoint.x += point2.x; - returnPoint.y += point2.y; - return returnPoint; -} - -CGRect LOT_RectSetHeight(CGRect rect, CGFloat height) { - return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, height); -} - -CGFloat LOT_DegreesToRadians(CGFloat degrees) { - return degrees * M_PI / 180; -} - -CGFloat LOT_PointDistanceFromPoint(CGPoint point1, CGPoint point2) { - CGFloat xDist = (point2.x - point1.x); - CGFloat yDist = (point2.y - point1.y); - CGFloat distance = sqrt((xDist * xDist) + (yDist * yDist)); - return distance; -} - -CGFloat LOT_RemapValue(CGFloat value, CGFloat low1, CGFloat high1, CGFloat low2, CGFloat high2 ) { - return low2 + (value - low1) * (high2 - low2) / (high1 - low1); -} - -CGPoint LOT_PointByLerpingPoints(CGPoint point1, CGPoint point2, CGFloat value) { - CGFloat xDiff = point2.x - point1.x; - CGFloat yDiff = point2.y - point1.y; - CGPoint transposed = CGPointMake(fabs(xDiff), fabs(yDiff)); - CGPoint returnPoint; - if (xDiff == 0 || yDiff == 0) { - returnPoint.x = xDiff == 0 ? point1.x : LOT_RemapValue(value, 0, 1, point1.x, point2.x); - returnPoint.y = yDiff == 0 ? point1.y : LOT_RemapValue(value, 0, 1, point1.y, point2.y); - } else { - CGFloat rx = transposed.x / transposed.y; - CGFloat yLerp = LOT_RemapValue(value, 0, 1, 0, transposed.y); - CGFloat xLerp = yLerp * rx; - CGPoint interpolatedPoint = CGPointMake(point2.x < point1.x ? xLerp * -1 : xLerp, - point2.y < point1.y ? yLerp * -1 : yLerp); - returnPoint = LOT_PointAddedToPoint(point1, interpolatedPoint); - } - return returnPoint; -} - -CGPoint LOT_PointInLine(CGPoint A, CGPoint B, CGFloat T) { - CGPoint C; - C.x = A.x - ((A.x - B.x) * T); - C.y = A.y - ((A.y - B.y) * T); - return C; -} - -CGFloat LOT_CubicBezierGetY(CGPoint cp1, CGPoint cp2, CGFloat T) { -// (1-x)^3 * y0 + 3*(1-x)^2 * x * y1 + 3*(1-x) * x^2 * y2 + x^3 * y3 - return 3 * powf(1.f - T, 2.f) * T * cp1.y + 3.f * (1.f - T) * powf(T, 2.f) * cp2.y + powf(T, 3.f); -} - -CGPoint LOT_PointInCubicCurve(CGPoint start, CGPoint cp1, CGPoint cp2, CGPoint end, CGFloat T) { - CGPoint A = LOT_PointInLine(start, cp1, T); - CGPoint B = LOT_PointInLine(cp1, cp2, T); - CGPoint C = LOT_PointInLine(cp2, end, T); - CGPoint D = LOT_PointInLine(A, B, T); - CGPoint E = LOT_PointInLine(B, C, T); - CGPoint F = LOT_PointInLine(D, E, T); - return F; -} - -CGFloat LOT_SolveCubic(CGFloat a, CGFloat b, CGFloat c, CGFloat d) { - if (a == 0) return LOT_SolveQuadratic(b, c, d); - if (d == 0) return 0; - - b /= a; - c /= a; - d /= a; - CGFloat q = (3.0 * c - LOT_Squared(b)) / 9.0; - CGFloat r = (-27.0 * d + b * (9.0 * c - 2.0 * LOT_Squared(b))) / 54.0; - CGFloat disc = LOT_Cubed(q) + LOT_Squared(r); - CGFloat term1 = b / 3.0; - - if (disc > 0) { - double s = r + sqrtf(disc); - s = (s < 0) ? - LOT_CubicRoot(-s) : LOT_CubicRoot(s); - double t = r - sqrtf(disc); - t = (t < 0) ? - LOT_CubicRoot(-t) : LOT_CubicRoot(t); - - double result = -term1 + s + t; - if (result >= 0 && result <= 1) return result; - } else if (disc == 0) { - double r13 = (r < 0) ? - LOT_CubicRoot(-r) : LOT_CubicRoot(r); - - double result = -term1 + 2.0 * r13; - if (result >= 0 && result <= 1) return result; - - result = -(r13 + term1); - if (result >= 0 && result <= 1) return result; - } else { - q = -q; - double dum1 = q * q * q; - dum1 = acosf(r / sqrtf(dum1)); - double r13 = 2.0 * sqrtf(q); - - double result = -term1 + r13 * cos(dum1 / 3.0); - if (result >= 0 && result <= 1) return result; - - result = -term1 + r13 * cos((dum1 + 2.0 * M_PI) / 3.0); - if (result >= 0 && result <= 1) return result; - - result = -term1 + r13 * cos((dum1 + 4.0 * M_PI) / 3.0); - if (result >= 0 && result <= 1) return result; - } - - return -1; -} - -CGFloat LOT_SolveQuadratic(CGFloat a, CGFloat b, CGFloat c) { - CGFloat result = (-b + sqrtf(LOT_Squared(b) - 4 * a * c)) / (2 * a); - if (result >= 0 && result <= 1) return result; - - result = (-b - sqrtf(LOT_Squared(b) - 4 * a * c)) / (2 * a); - if (result >= 0 && result <= 1) return result; - - return -1; -} - -CGFloat LOT_Squared(CGFloat f) { return f * f; } - -CGFloat LOT_Cubed(CGFloat f) { return f * f * f; } - -CGFloat LOT_CubicRoot(CGFloat f) { return powf(f, 1.0 / 3.0); } - -CGFloat LOT_CubicBezeirInterpolate(CGPoint P0, CGPoint P1, CGPoint P2, CGPoint P3, CGFloat x) { - CGFloat t; - if (x == P0.x) { - // Handle corner cases explicitly to prevent rounding errors - t = 0; - } else if (x == P3.x) { - t = 1; - } else { - // Calculate t - CGFloat a = -P0.x + 3 * P1.x - 3 * P2.x + P3.x; - CGFloat b = 3 * P0.x - 6 * P1.x + 3 * P2.x; - CGFloat c = -3 * P0.x + 3 * P1.x; - CGFloat d = P0.x - x; - CGFloat tTemp = LOT_SolveCubic(a, b, c, d); - if (tTemp == -1) return -1; - t = tTemp; - } - - // Calculate y from t - return LOT_Cubed(1 - t) * P0.y + 3 * t * LOT_Squared(1 - t) * P1.y + 3 * LOT_Squared(t) * (1 - t) * P2.y + LOT_Cubed(t) * P3.y; -} - -CGFloat LOT_CubicLengthWithPrecision(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint1, CGPoint controlPoint2, CGFloat iterations) { - CGFloat length = 0; - CGPoint previousPoint = fromPoint; - iterations = ceilf(iterations); - for (int i = 1; i <= iterations; ++i) { - float s = (float)i / iterations; - - CGPoint p = LOT_PointInCubicCurve(fromPoint, controlPoint1, controlPoint2, toPoint, s); - - length += LOT_PointDistanceFromPoint(previousPoint, p); - previousPoint = p; - } - return length; -} - -CGFloat LOT_CubicLength(CGPoint fromPoint, CGPoint toPoint, CGPoint controlPoint1, CGPoint controlPoint2) { - return LOT_CubicLengthWithPrecision(fromPoint, toPoint, controlPoint1, controlPoint2, 20); -} - -BOOL LOT_CGPointIsZero(CGPoint point) { - return CGPointEqualToPoint(point, CGPointZero); -} diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.h b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.h deleted file mode 100755 index 5c90b5b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// LOTBezierPath.h -// Lottie -// -// Created by brandon_withrow on 7/20/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPlatformCompat.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTBezierPath : NSObject - -+ (instancetype)pathWithCGPath:(CGPathRef)path; - -+ (instancetype)newPath; - -- (void)LOT_moveToPoint:(CGPoint)point; - -- (void)LOT_addLineToPoint:(CGPoint)point; - -- (void)LOT_addCurveToPoint:(CGPoint)point - controlPoint1:(CGPoint)cp1 - controlPoint2:(CGPoint)cp2; - -- (void)LOT_closePath; - -- (void)LOT_removeAllPoints; - -- (void)LOT_appendPath:(LOTBezierPath *)bezierPath; - -- (void)trimPathFromT:(CGFloat)fromT toT:(CGFloat)toT offset:(CGFloat)offset; - -- (void)LOT_applyTransform:(CGAffineTransform)transform; - -@property (nonatomic, assign) BOOL cacheLengths; - -@property (nonatomic, readonly) CGFloat length; - -@property (nonatomic, readonly) CGPathRef CGPath; -@property (nonatomic, readonly) CGPoint currentPoint; -@property (nonatomic) CGFloat lineWidth; -@property (nonatomic) CGLineCap lineCapStyle; -@property (nonatomic) CGLineJoin lineJoinStyle; -@property (nonatomic) CGFloat miterLimit; -@property (nonatomic) CGFloat flatness; -@property (nonatomic) BOOL usesEvenOddFillRule; -@property (readonly, getter=isEmpty) BOOL empty; -@property (nonatomic, readonly) CGRect bounds; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.m b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.m deleted file mode 100755 index 499e712..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTBezierPath.m +++ /dev/null @@ -1,471 +0,0 @@ -// -// LOTBezierPath.m -// Lottie -// -// Created by brandon_withrow on 7/20/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTBezierPath.h" -#import "CGGeometry+LOTAdditions.h" - -typedef struct LOT_Subpath LOT_Subpath; -typedef void(^LOTBezierPathEnumerationHandler)(const CGPathElement *element); - -struct LOT_Subpath { - CGPathElementType type; - CGFloat length; - CGPoint endPoint; - CGPoint controlPoint1; - CGPoint controlPoint2; - LOT_Subpath *nextSubpath; -}; - -@interface LOTBezierPath () -@property (nonatomic, readonly) LOT_Subpath *headSubpath; -@end - -@implementation LOTBezierPath { - LOT_Subpath *headSubpath_; - LOT_Subpath *tailSubpath_; - CGPoint subpathStartPoint_; - CGFloat *_lineDashPattern; - NSInteger _lineDashCount; - CGFloat _lineDashPhase; - CGMutablePathRef _path; -} - -// MARK - Lifecycle - -+ (instancetype)pathWithCGPath:(CGPathRef)path { - LOTBezierPath *returnPath = [LOTBezierPath newPath]; - [returnPath setWithCGPath:path]; - return returnPath; -} - -+ (instancetype)newPath { - return [[LOTBezierPath alloc] init]; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _length = 0; - headSubpath_ = NULL; - tailSubpath_ = NULL; - _path = CGPathCreateMutable(); - _lineWidth = 1; - _lineCapStyle = kCGLineCapButt; - _lineJoinStyle = kCGLineJoinMiter; - _miterLimit = 10; - _flatness = 0.6; - _usesEvenOddFillRule = NO; - _lineDashPattern = NULL; - _lineDashCount = 0; - _lineDashPhase = 0; - _cacheLengths = NO; - } - return self; -} - -- (void)dealloc { - [self removeAllSubpaths]; - if (_path) CGPathRelease(_path); -} - -- (id)copyWithZone:(NSZone *)zone { - LOTBezierPath *copy = [[self class] new]; - - copy.cacheLengths = self.cacheLengths; - copy.lineWidth = self.lineWidth; - copy.lineCapStyle = self.lineCapStyle; - copy.lineJoinStyle = self.lineJoinStyle; - copy.miterLimit = self.miterLimit; - copy.flatness = self.flatness; - copy.usesEvenOddFillRule = self.usesEvenOddFillRule; - - [copy LOT_appendPath:self]; - - return copy; -} - -// MARK - Subpaths List - -- (void)removeAllSubpaths { - LOT_Subpath *node = headSubpath_; - while (node) { - LOT_Subpath *nextNode = node->nextSubpath; - node->nextSubpath = NULL; - free(node); - node = nextNode; - } - headSubpath_ = NULL; - tailSubpath_ = NULL; -} - -- (void)addSubpathWithType:(CGPathElementType)type - length:(CGFloat)length - endPoint:(CGPoint)endPoint - controlPoint1:(CGPoint)controlPoint1 - controlPoint1:(CGPoint)controlPoint2 { - LOT_Subpath *subPath = (LOT_Subpath *)malloc(sizeof(LOT_Subpath)); - subPath->type = type; - subPath->length = length; - subPath->endPoint = endPoint; - subPath->controlPoint1 = controlPoint1; - subPath->controlPoint2 = controlPoint2; - subPath->nextSubpath = NULL; - if (tailSubpath_ == NULL) { - headSubpath_ = subPath; - tailSubpath_ = subPath; - } else { - tailSubpath_->nextSubpath = subPath; - tailSubpath_ = subPath; - } -} - -// MARK Getters Setters - -- (CGPoint)currentPoint { - CGPoint previousPoint = tailSubpath_ ? tailSubpath_->endPoint : CGPointZero; - return previousPoint; -} - -- (CGPathRef)CGPath { - return _path; -} - -- (LOT_Subpath *)headSubpath { - return headSubpath_; -} - -// MARK - External - -- (void)LOT_moveToPoint:(CGPoint)point { - subpathStartPoint_ = point; - [self addSubpathWithType:kCGPathElementMoveToPoint length:0 endPoint:point controlPoint1:CGPointZero controlPoint1:CGPointZero]; - CGPathMoveToPoint(_path, NULL, point.x, point.y); -} - -- (void)LOT_addLineToPoint:(CGPoint)point { - CGFloat length = 0; - if (_cacheLengths) { - length = LOT_PointDistanceFromPoint(self.currentPoint, point); - _length = _length + length; - } - [self addSubpathWithType:kCGPathElementAddLineToPoint length:length endPoint:point controlPoint1:CGPointZero controlPoint1:CGPointZero]; - CGPathAddLineToPoint(_path, NULL, point.x, point.y); -} - -- (void)LOT_addCurveToPoint:(CGPoint)point - controlPoint1:(CGPoint)cp1 - controlPoint2:(CGPoint)cp2 { - CGFloat length = 0; - if (_cacheLengths) { - length = LOT_CubicLengthWithPrecision(self.currentPoint, point, cp1, cp2, 5); - _length = _length + length; - } - [self addSubpathWithType:kCGPathElementAddCurveToPoint length:length endPoint:point controlPoint1:cp1 controlPoint1:cp2]; - CGPathAddCurveToPoint(_path, NULL, cp1.x, cp1.y, cp2.x, cp2.y, point.x, point.y); -} - -- (void)LOT_closePath { - CGFloat length = 0; - if (_cacheLengths) { - length = LOT_PointDistanceFromPoint(self.currentPoint, subpathStartPoint_); - _length = _length + length; - } - [self addSubpathWithType:kCGPathElementCloseSubpath length:length endPoint:subpathStartPoint_ controlPoint1:CGPointZero controlPoint1:CGPointZero]; - CGPathCloseSubpath(_path); -} - -- (void)_clearPathData { - _length = 0; - subpathStartPoint_ = CGPointZero; - CGPathRelease(_path); - _path = CGPathCreateMutable(); -} - -- (void)LOT_removeAllPoints { - [self removeAllSubpaths]; - [self _clearPathData]; -} - -- (BOOL)containsPoint:(CGPoint)point { - return CGPathContainsPoint(_path, NULL, point, _usesEvenOddFillRule); -} - -- (BOOL)isEmpty { - return CGPathIsEmpty(_path); -} - -- (CGRect)bounds { - return CGPathGetBoundingBox(_path); -} - -- (void)LOT_applyTransform:(CGAffineTransform)transform { - CGMutablePathRef mutablePath = CGPathCreateMutable(); - CGPathAddPath(mutablePath, &transform, _path); - CGPathRelease(_path); - _path = mutablePath; -} - -- (void)LOT_appendPath:(LOTBezierPath *)bezierPath { - CGPathAddPath(_path, NULL, bezierPath.CGPath); - - LOT_Subpath *nextSubpath = bezierPath.headSubpath; - while (nextSubpath) { - CGFloat length = 0; - if (self.cacheLengths) { - if (bezierPath.cacheLengths) { - length = nextSubpath->length; - } else { - // No previous length data, measure. - if (nextSubpath->type == kCGPathElementAddLineToPoint) { - length = LOT_PointDistanceFromPoint(self.currentPoint, nextSubpath->endPoint); - } else if (nextSubpath->type == kCGPathElementAddCurveToPoint) { - length = LOT_CubicLengthWithPrecision(self.currentPoint, nextSubpath->endPoint, nextSubpath->controlPoint1, nextSubpath->controlPoint2, 5); - } else if (nextSubpath->type == kCGPathElementCloseSubpath) { - length = LOT_PointDistanceFromPoint(self.currentPoint, nextSubpath->endPoint); - } - } - } - _length = _length + length; - [self addSubpathWithType:nextSubpath->type - length:length - endPoint:nextSubpath->endPoint - controlPoint1:nextSubpath->controlPoint1 - controlPoint1:nextSubpath->controlPoint2]; - - nextSubpath = nextSubpath->nextSubpath; - } -} - -- (void)trimPathFromT:(CGFloat)fromT toT:(CGFloat)toT offset:(CGFloat)offset { - fromT = MIN(MAX(0, fromT), 1); - toT = MIN(MAX(0, toT), 1); - if (fromT > toT) { - CGFloat to = fromT; - fromT = toT; - toT = to; - } - - offset = offset - floor(offset); - CGFloat fromLength = fromT + offset; - CGFloat toLength = toT + offset; - - if (toT - fromT == 1) { - // Do Nothing, Full Path returned. - return; - } - - if (fromLength == toLength) { - // Empty Path - [self LOT_removeAllPoints]; - return; - } - - if (fromLength >= 1) { - fromLength = fromLength - floor(fromLength); - } - if (toLength > 1) { - toLength = toLength - floor(toLength); - } - - if (fromLength == 0 && - toLength == 1) { - // Do Nothing. Full Path returned. - return; - } - - if (fromLength == toLength) { - // Empty Path - [self LOT_removeAllPoints]; - return; - } - - CGFloat totalLength = _length; - - [self _clearPathData]; - - LOT_Subpath *subpath = headSubpath_; - headSubpath_ = NULL; - tailSubpath_ = NULL; - - fromLength = fromLength * totalLength; - toLength = toLength * totalLength; - - CGFloat currentStartLength = fromLength < toLength ? fromLength : 0; - CGFloat currentEndLength = toLength; - - CGFloat subpathBeginningLength = 0; - CGPoint currentPoint = CGPointZero; - - while (subpath) { - - CGFloat pathLength = subpath->length; - if (!_cacheLengths) { - if (subpath->type == kCGPathElementAddLineToPoint) { - pathLength = LOT_PointDistanceFromPoint(currentPoint, subpath->endPoint); - } else if (subpath->type == kCGPathElementAddCurveToPoint) { - pathLength = LOT_CubicLengthWithPrecision(currentPoint, subpath->endPoint, subpath->controlPoint1, subpath->controlPoint2, 5); - } else if (subpath->type == kCGPathElementCloseSubpath) { - pathLength = LOT_PointDistanceFromPoint(currentPoint, subpath->endPoint); - } - } - CGFloat subpathEndLength = subpathBeginningLength + pathLength; - - if (subpath->type != kCGPathElementMoveToPoint && - subpathEndLength > currentStartLength) { - // The end of this path overlaps the current drawing region - - // x x x x - // ---------------ooooooooooooooooooooooooooooooooooooooooooooooooo------------------- - // Start |currentStartLength currentEndLength| End - - CGFloat currentSpanStartT = LOT_RemapValue(currentStartLength, subpathBeginningLength, subpathEndLength, 0, 1); - CGFloat currentSpanEndT = LOT_RemapValue(currentEndLength, subpathBeginningLength, subpathEndLength, 0, 1); - - // At this point currentSpan start and end T can be less than 0 or greater than 1 - - if (subpath->type == kCGPathElementAddLineToPoint) { - - if (currentSpanStartT >= 0) { - // The current drawable span either starts with this subpath or along this subpath. - // If this is the middle of a segment then currentSpanStartT would be less than 0 - if (currentSpanStartT > 0) { - currentPoint = LOT_PointInLine(currentPoint, subpath->endPoint, currentSpanStartT); - } - [self LOT_moveToPoint:currentPoint]; - // Now we are ready to draw a line - } - - CGPoint toPoint = subpath->endPoint; - if (currentSpanEndT < 1) { - // The end of the span is inside of the current subpath. Find it. - toPoint = LOT_PointInLine(currentPoint, subpath->endPoint, currentSpanEndT); - } - [self LOT_addLineToPoint:toPoint]; - currentPoint = toPoint; - } else if (subpath->type == kCGPathElementAddCurveToPoint) { - - CGPoint cp1, cp2, end; - cp1 = subpath->controlPoint1; - cp2 = subpath->controlPoint2; - end = subpath->endPoint; - - if (currentSpanStartT >= 0) { - // The current drawable span either starts with this subpath or along this subpath. - // If this is the middle of a segment then currentSpanStartT would be less than 0 - // Beginning of a segment Move start point and calculate cp1 and 2 is necessary - if (currentSpanStartT > 0) { - CGPoint A = LOT_PointInLine(currentPoint, cp1, currentSpanStartT); - CGPoint B = LOT_PointInLine(cp1, cp2, currentSpanStartT); - CGPoint C = LOT_PointInLine(cp2, end, currentSpanStartT); - CGPoint D = LOT_PointInLine(A, B, currentSpanStartT); - CGPoint E = LOT_PointInLine(B, C, currentSpanStartT); - CGPoint F = LOT_PointInLine(D, E, currentSpanStartT); - currentPoint = F; - cp1 = E; - cp2 = C; - currentSpanEndT = LOT_RemapValue(currentSpanEndT, currentSpanStartT, 1, 0, 1); - } - [self LOT_moveToPoint:currentPoint]; - } - - if (currentSpanEndT < 1) { - CGPoint A = LOT_PointInLine(currentPoint, cp1, currentSpanEndT); - CGPoint B = LOT_PointInLine(cp1, cp2, currentSpanEndT); - CGPoint C = LOT_PointInLine(cp2, end, currentSpanEndT); - CGPoint D = LOT_PointInLine(A, B, currentSpanEndT); - CGPoint E = LOT_PointInLine(B, C, currentSpanEndT); - CGPoint F = LOT_PointInLine(D, E, currentSpanEndT); - cp1 = A; - cp2 = D; - end = F; - } - [self LOT_addCurveToPoint:end controlPoint1:cp1 controlPoint2:cp2]; - } - - if (currentSpanEndT <= 1) { - // We have possibly reached the end. - // Current From and To will possibly need to be reset. - if (fromLength < toLength) { - while (subpath) { - LOT_Subpath *nextNode = subpath->nextSubpath; - subpath->nextSubpath = NULL; - free(subpath); - subpath = nextNode; - } - break; - } else { - currentStartLength = fromLength; - currentEndLength = totalLength; - if (fromLength < (subpathBeginningLength + pathLength) && - fromLength > subpathBeginningLength && - currentSpanEndT < 1) { - // Loop over this subpath one more time. - // In this case the path start and end trim fall within this subpath bounds - continue; - } - } - } - } - currentPoint = subpath->endPoint; - subpathBeginningLength = subpathEndLength; - - LOT_Subpath *nextNode = subpath->nextSubpath; - subpath->nextSubpath = NULL; - free(subpath); - subpath = nextNode; - } -} - -#pragma mark - From CGPath - -- (void)setWithCGPath:(CGPathRef)path { - [self lot_enumeratePath:path elementsUsingBlock:^(const CGPathElement *element) { - switch (element->type) { - case kCGPathElementMoveToPoint: { - CGPoint point = element ->points[0]; - [self LOT_moveToPoint:point]; - break; - } - case kCGPathElementAddLineToPoint: { - CGPoint point = element ->points[0]; - [self LOT_addLineToPoint:point]; - break; - } - case kCGPathElementAddQuadCurveToPoint: { - break; - } - case kCGPathElementAddCurveToPoint: { - CGPoint point1 = element->points[0]; - CGPoint point2 = element->points[1]; - CGPoint point3 = element->points[2]; - [self LOT_addCurveToPoint:point3 controlPoint1:point1 controlPoint2:point2]; - break; - } - case kCGPathElementCloseSubpath: { - [self LOT_closePath]; - break; - } - } - }]; -} - -- (void)lot_enumeratePath:(CGPathRef)cgPath elementsUsingBlock:(LOTBezierPathEnumerationHandler)handler { - void CGPathEnumerationCallback(void *info, const CGPathElement *element); - CGPathApply(cgPath, (__bridge void * _Nullable)(handler), CGPathEnumerationCallback); -} - -@end - -void CGPathEnumerationCallback(void *info, const CGPathElement *element) -{ - LOTBezierPathEnumerationHandler handler = (__bridge LOTBezierPathEnumerationHandler)(info); - if (handler) { - handler(element); - } -} diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTHelpers.h b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTHelpers.h deleted file mode 100755 index 420b0a0..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTHelpers.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// LOTHelpers.h -// Lottie -// -// Created by Brandon Withrow on 7/28/16. -// Copyright © 2016 Brandon Withrow. All rights reserved. -// - -#ifndef LOTHelpers_h -#define LOTHelpers_h - -#import "UIColor+Expanded.h" -#import "CGGeometry+LOTAdditions.h" -#import "LOTBezierPath.h" - -#define ENABLE_DEBUG_LOGGING NO -#define ENABLE_DEBUG_SHAPES NO - -#endif /* LOTHelpers_h */ - -// TODO Feature Phase -/* - - Trim Path individually - - Image Cache Support - - Skew transform - */ diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.h b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.h deleted file mode 100755 index 4cc4288..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// LOTAnimationView -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// -#import -#import - -@interface LOTRadialGradientLayer : CALayer - -@property CGPoint startPoint; -@property CGPoint endPoint; - -@property (nonatomic, copy) NSArray *colors; -@property (nonatomic, copy) NSArray *locations; -@property (nonatomic, assign) BOOL isRadial; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.m b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.m deleted file mode 100755 index f6bef1f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/LOTRadialGradientLayer.m +++ /dev/null @@ -1,89 +0,0 @@ -// -// LOTAnimationView -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTRadialGradientLayer.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTRadialGradientLayer - -@dynamic isRadial; -@dynamic startPoint; -@dynamic endPoint; -@dynamic colors; -@dynamic locations; - -+ (BOOL)needsDisplayForKey:(NSString *)key { - if ([key isEqualToString:@"startPoint"] || - [key isEqualToString:@"endPoint"] || - [key isEqualToString:@"colors"] || - [key isEqualToString:@"locations"] || - [key isEqualToString:@"isRadial"]) { - return YES; - } - return [super needsDisplayForKey:key]; -} - -- (id)actionForKey:(NSString *)key { - id action = self.actions[key]; - if (action) { - if (action == [NSNull null]) { - return nil; - } - return action; - } - - if ([key isEqualToString:@"startPoint"] || - [key isEqualToString:@"endPoint"] || - [key isEqualToString:@"colors"] || - [key isEqualToString:@"locations"] || - [key isEqualToString:@"isRadial"]) { - CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:key]; - theAnimation.fromValue = [self.presentationLayer valueForKey:key]; - return theAnimation; - } - return [super actionForKey:key]; -} - -- (void)drawInContext:(CGContextRef)ctx { - if (self.colors.count == 0) { - return; - } - - NSInteger numberOfLocations = self.locations.count; - CGColorRef colorRef = (__bridge CGColorRef)[self.colors objectAtIndex:0]; - NSInteger numberOfComponents = CGColorGetNumberOfComponents(colorRef); - CGColorSpaceRef colorSpace = CGColorGetColorSpace(colorRef); - - CGPoint origin = self.startPoint; - CGFloat radius = LOT_PointDistanceFromPoint(self.startPoint, self.endPoint); - - CGFloat gradientLocations[numberOfLocations]; - CGFloat gradientComponents[numberOfLocations * numberOfComponents]; - - for (NSInteger locationIndex = 0; locationIndex < numberOfLocations; locationIndex++) { - - gradientLocations[locationIndex] = [self.locations[locationIndex] floatValue]; - const CGFloat *colorComponents = CGColorGetComponents((__bridge CGColorRef)self.colors[locationIndex]); - - for (NSInteger componentIndex = 0; componentIndex < numberOfComponents; componentIndex++) { - gradientComponents[numberOfComponents * locationIndex + componentIndex] = colorComponents[componentIndex]; - } - } - - CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradientComponents, gradientLocations, numberOfLocations); - - if (self.isRadial) { - CGContextDrawRadialGradient(ctx, gradient, origin, 0, origin, radius, kCGGradientDrawsAfterEndLocation); - } else { - CGContextDrawLinearGradient(ctx, gradient, self.startPoint, self.endPoint, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); - } - - CGGradientRelease(gradient); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.h b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.h deleted file mode 100755 index 8589c92..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.h +++ /dev/null @@ -1,51 +0,0 @@ -#import "LOTPlatformCompat.h" - -// From http://github.com/ars/uicolor-utilities -#define CLAMP(val,min,max) MIN(MAX(val,min),max) - -@interface UIColor (UIColor_Expanded) -@property (nonatomic, readonly) CGColorSpaceModel colorSpaceModel; -@property (nonatomic, readonly) BOOL canProvideRGBComponents; -@property (nonatomic, readonly) CGFloat red; // Only valid if canProvideRGBComponents is YES -@property (nonatomic, readonly) CGFloat green; // Only valid if canProvideRGBComponents is YES -@property (nonatomic, readonly) CGFloat blue; // Only valid if canProvideRGBComponents is YES -@property (nonatomic, readonly) CGFloat white; // Only valid if colorSpaceModel == kCGColorSpaceModelMonochrome -@property (nonatomic, readonly) CGFloat alpha; -@property (nonatomic, readonly) UInt32 rgbHex; - -- (NSString *)LOT_colorSpaceString; - -- (NSArray *)LOT_arrayFromRGBAComponents; - -- (BOOL)LOT_red:(CGFloat *)r green:(CGFloat *)g blue:(CGFloat *)b alpha:(CGFloat *)a; - -- (UIColor *)LOT_colorByLuminanceMapping; - -- (UIColor *)LOT_colorByMultiplyingByRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -- (UIColor *) LOT_colorByAddingRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -- (UIColor *) LOT_colorByLighteningToRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -- (UIColor *) LOT_colorByDarkeningToRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; - -- (UIColor *)LOT_colorByMultiplyingBy:(CGFloat)f; -- (UIColor *) LOT_colorByAdding:(CGFloat)f; -- (UIColor *) LOT_colorByLighteningTo:(CGFloat)f; -- (UIColor *) LOT_colorByDarkeningTo:(CGFloat)f; - -- (UIColor *)LOT_colorByMultiplyingByColor:(UIColor *)color; -- (UIColor *) LOT_colorByAddingColor:(UIColor *)color; -- (UIColor *) LOT_colorByLighteningToColor:(UIColor *)color; -- (UIColor *) LOT_colorByDarkeningToColor:(UIColor *)color; - -- (NSString *)LOT_stringFromColor; -- (NSString *)LOT_hexStringValue; - -+ (UIColor *)LOT_randomColor; -+ (UIColor *)LOT_colorWithString:(NSString *)stringToConvert; -+ (UIColor *)LOT_colorWithRGBHex:(UInt32)hex; -+ (UIColor *)LOT_colorWithHexString:(NSString *)stringToConvert; - -+ (UIColor *)LOT_colorWithName:(NSString *)cssColorName; - -+ (UIColor *)LOT_colorByLerpingFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor amount:(CGFloat)amount; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.m b/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.m deleted file mode 100755 index d1f92d5..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Extensions/UIColor+Expanded.m +++ /dev/null @@ -1,483 +0,0 @@ -// From http://github.com/ars/uicolor-utilities - -#import "UIColor+Expanded.h" - -/* - - Thanks to Poltras, Millenomi, Eridius, Nownot, WhatAHam, jberry, - and everyone else who helped out but whose name is inadvertantly omitted - - */ - -/* - Current outstanding request list: - - - PolarBearFarm - color descriptions ([UIColor warmGrayWithHintOfBlueTouchOfRedAndSplashOfYellowColor]) - - Crayola color set - - Eridius - UIColor needs a method that takes 2 colors and gives a third complementary one - - Consider UIMutableColor that can be adjusted (brighter, cooler, warmer, thicker-alpha, etc) - */ - -/* - FOR REFERENCE: Color Space Models: enum CGColorSpaceModel { - kCGColorSpaceModelUnknown = -1, - kCGColorSpaceModelMonochrome, - kCGColorSpaceModelRGB, - kCGColorSpaceModelCMYK, - kCGColorSpaceModelLab, - kCGColorSpaceModelDeviceN, - kCGColorSpaceModelIndexed, - kCGColorSpaceModelPattern - }; - */ - -// Static cache of looked up color names. Used with +LOT_colorWithName: -static NSMutableDictionary *colorNameCache = nil; - -@interface UIColor (UIColor_Expanded_Support) -+ (UIColor *)searchForColorByName:(NSString *)cssColorName; -@end - -#pragma mark - - -@implementation UIColor (UIColor_Expanded) - -- (CGColorSpaceModel)colorSpaceModel { - return CGColorSpaceGetModel(CGColorGetColorSpace(self.CGColor)); -} - -- (NSString *)LOT_colorSpaceString { - switch (self.colorSpaceModel) { - case kCGColorSpaceModelUnknown: - return @"kCGColorSpaceModelUnknown"; - case kCGColorSpaceModelMonochrome: - return @"kCGColorSpaceModelMonochrome"; - case kCGColorSpaceModelRGB: - return @"kCGColorSpaceModelRGB"; - case kCGColorSpaceModelCMYK: - return @"kCGColorSpaceModelCMYK"; - case kCGColorSpaceModelLab: - return @"kCGColorSpaceModelLab"; - case kCGColorSpaceModelDeviceN: - return @"kCGColorSpaceModelDeviceN"; - case kCGColorSpaceModelIndexed: - return @"kCGColorSpaceModelIndexed"; - case kCGColorSpaceModelPattern: - return @"kCGColorSpaceModelPattern"; - default: - return @"Not a valid color space"; - } -} - -- (BOOL)canProvideRGBComponents { - switch (self.colorSpaceModel) { - case kCGColorSpaceModelRGB: - case kCGColorSpaceModelMonochrome: - return YES; - default: - return NO; - } -} - -- (NSArray *)LOT_arrayFromRGBAComponents { - NSAssert(self.canProvideRGBComponents, @"Must be an RGB color to use -LOT_arrayFromRGBAComponents"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [NSArray arrayWithObjects: - [NSNumber numberWithFloat:r], - [NSNumber numberWithFloat:g], - [NSNumber numberWithFloat:b], - [NSNumber numberWithFloat:a], - nil]; -} - -- (BOOL)LOT_red:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha { - const CGFloat *components = CGColorGetComponents(self.CGColor); - - CGFloat r,g,b,a; - - switch (self.colorSpaceModel) { - case kCGColorSpaceModelMonochrome: - r = g = b = components[0]; - a = components[1]; - break; - case kCGColorSpaceModelRGB: - r = components[0]; - g = components[1]; - b = components[2]; - a = components[3]; - break; - default: // We don't know how to handle this model - return NO; - } - - if (red) *red = r; - if (green) *green = g; - if (blue) *blue = b; - if (alpha) *alpha = a; - - return YES; -} - -- (CGFloat)red { - NSAssert(self.canProvideRGBComponents, @"Must be an RGB color to use -red"); - const CGFloat *c = CGColorGetComponents(self.CGColor); - return c[0]; -} - -- (CGFloat)green { - NSAssert(self.canProvideRGBComponents, @"Must be an RGB color to use -green"); - const CGFloat *c = CGColorGetComponents(self.CGColor); - if (self.colorSpaceModel == kCGColorSpaceModelMonochrome) return c[0]; - return c[1]; -} - -- (CGFloat)blue { - NSAssert(self.canProvideRGBComponents, @"Must be an RGB color to use -blue"); - const CGFloat *c = CGColorGetComponents(self.CGColor); - if (self.colorSpaceModel == kCGColorSpaceModelMonochrome) return c[0]; - return c[2]; -} - -- (CGFloat)white { - NSAssert(self.colorSpaceModel == kCGColorSpaceModelMonochrome, @"Must be a Monochrome color to use -white"); - const CGFloat *c = CGColorGetComponents(self.CGColor); - return c[0]; -} - -- (CGFloat)alpha { - return CGColorGetAlpha(self.CGColor); -} - -- (UInt32)rgbHex { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use rgbHex"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return 0; - - r = MIN(MAX(self.red, 0.0f), 1.0f); - g = MIN(MAX(self.green, 0.0f), 1.0f); - b = MIN(MAX(self.blue, 0.0f), 1.0f); - - return (((int)roundf(r * 255)) << 16) - | (((int)roundf(g * 255)) << 8) - | (((int)roundf(b * 255))); -} - -#pragma mark Arithmetic operations - -- (UIColor *)LOT_colorByLuminanceMapping { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - // http://en.wikipedia.org/wiki/Luma_(video) - // Y = 0.2126 R + 0.7152 G + 0.0722 B - return [UIColor colorWithWhite:r*0.2126f + g*0.7152f + b*0.0722f - alpha:a]; - -} - -- (UIColor *)LOT_colorByMultiplyingByRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [UIColor colorWithRed:MAX(0.0, MIN(1.0, r * red)) - green:MAX(0.0, MIN(1.0, g * green)) - blue:MAX(0.0, MIN(1.0, b * blue)) - alpha:MAX(0.0, MIN(1.0, a * alpha))]; -} - -- (UIColor *)LOT_colorByAddingRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [UIColor colorWithRed:MAX(0.0, MIN(1.0, r + red)) - green:MAX(0.0, MIN(1.0, g + green)) - blue:MAX(0.0, MIN(1.0, b + blue)) - alpha:MAX(0.0, MIN(1.0, a + alpha))]; -} - -- (UIColor *)LOT_colorByLighteningToRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [UIColor colorWithRed:MAX(r, red) - green:MAX(g, green) - blue:MAX(b, blue) - alpha:MAX(a, alpha)]; -} - -- (UIColor *)LOT_colorByDarkeningToRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [UIColor colorWithRed:MIN(r, red) - green:MIN(g, green) - blue:MIN(b, blue) - alpha:MIN(a, alpha)]; -} - -- (UIColor *)LOT_colorByMultiplyingBy:(CGFloat)f { - return [self LOT_colorByMultiplyingByRed:f green:f blue:f alpha:1.0f]; -} - -- (UIColor *)LOT_colorByAdding:(CGFloat)f { - return [self LOT_colorByMultiplyingByRed:f green:f blue:f alpha:0.0f]; -} - -- (UIColor *)LOT_colorByLighteningTo:(CGFloat)f { - return [self LOT_colorByLighteningToRed:f green:f blue:f alpha:0.0f]; -} - -- (UIColor *)LOT_colorByDarkeningTo:(CGFloat)f { - return [self LOT_colorByDarkeningToRed:f green:f blue:f alpha:1.0f]; -} - -- (UIColor *)LOT_colorByMultiplyingByColor:(UIColor *)color { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [self LOT_colorByMultiplyingByRed:r green:g blue:b alpha:1.0f]; -} - -- (UIColor *)LOT_colorByAddingColor:(UIColor *)color { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [self LOT_colorByAddingRed:r green:g blue:b alpha:0.0f]; -} - -- (UIColor *)LOT_colorByLighteningToColor:(UIColor *)color { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [self LOT_colorByLighteningToRed:r green:g blue:b alpha:0.0f]; -} - -- (UIColor *)LOT_colorByDarkeningToColor:(UIColor *)color { - NSAssert(self.canProvideRGBComponents, @"Must be a RGB color to use arithmatic operations"); - - CGFloat r,g,b,a; - if (![self LOT_red:&r green:&g blue:&b alpha:&a]) return nil; - - return [self LOT_colorByDarkeningToRed:r green:g blue:b alpha:1.0f]; -} - -#pragma mark String utilities - -- (NSString *)LOT_stringFromColor { - NSAssert(self.canProvideRGBComponents, @"Must be an RGB color to use -LOT_stringFromColor"); - NSString *result; - switch (self.colorSpaceModel) { - case kCGColorSpaceModelRGB: - result = [NSString stringWithFormat:@"{%0.3f, %0.3f, %0.3f, %0.3f}", self.red, self.green, self.blue, self.alpha]; - break; - case kCGColorSpaceModelMonochrome: - result = [NSString stringWithFormat:@"{%0.3f, %0.3f}", self.white, self.alpha]; - break; - default: - result = nil; - } - return result; -} - -- (NSString *)LOT_hexStringValue { - return [NSString stringWithFormat:@"%0.6X", (unsigned int)self.rgbHex]; -} - -+ (UIColor *)LOT_colorWithString:(NSString *)stringToConvert { - NSScanner *scanner = [NSScanner scannerWithString:stringToConvert]; - if (![scanner scanString:@"{" intoString:NULL]) return nil; - const NSUInteger kMaxComponents = 4; - float c[kMaxComponents]; - NSUInteger i = 0; - if (![scanner scanFloat:&c[i++]]) return nil; - while (1) { - if ([scanner scanString:@"}" intoString:NULL]) break; - if (i >= kMaxComponents) return nil; - if ([scanner scanString:@"," intoString:NULL]) { - if (![scanner scanFloat:&c[i++]]) return nil; - } else { - // either we're at the end of there's an unexpected character here - // both cases are error conditions - return nil; - } - } - if (![scanner isAtEnd]) return nil; - UIColor *color; - switch (i) { - case 2: // monochrome - color = [UIColor colorWithWhite:c[0] alpha:c[1]]; - break; - case 4: // RGB - color = [UIColor colorWithRed:c[0] green:c[1] blue:c[2] alpha:c[3]]; - break; - default: - color = nil; - } - return color; -} - -#pragma mark Class methods - -+ (UIColor *)LOT_randomColor { - return [UIColor colorWithRed:(CGFloat)random() / (CGFloat)RAND_MAX - green:(CGFloat)random() / (CGFloat)RAND_MAX - blue:(CGFloat)random() / (CGFloat)RAND_MAX - alpha:1.0f]; -} - -+ (UIColor *)LOT_colorWithRGBHex:(UInt32)hex { - int r = (hex >> 16) & 0xFF; - int g = (hex >> 8) & 0xFF; - int b = (hex) & 0xFF; - - return [UIColor colorWithRed:r / 255.0f - green:g / 255.0f - blue:b / 255.0f - alpha:1.0f]; -} - -// Returns a UIColor by scanning the string for a hex number and passing that to +[UIColor LOT_colorWithRGBHex:] -// Skips any leading whitespace and ignores any trailing characters -+ (UIColor *)LOT_colorWithHexString:(NSString *)stringToConvert { - NSString *strippedString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""]; - NSScanner *scanner = [NSScanner scannerWithString:strippedString]; - unsigned hexNum; - if (![scanner scanHexInt:&hexNum]) return nil; - return [UIColor LOT_colorWithRGBHex:hexNum]; -} - -// Lookup a color using css 3/svg color name -+ (UIColor *)LOT_colorWithName:(NSString *)cssColorName { - UIColor *color; - @synchronized(colorNameCache) { - // Look for the color in the cache - color = [colorNameCache objectForKey:cssColorName]; - - if ((id)color == [NSNull null]) { - // If it wasn't there previously, it's still not there now - color = nil; - } else if (!color) { - // Color not in cache, so search for it now - color = [self searchForColorByName:cssColorName]; - - // Set the value in cache, storing NSNull on failure - [colorNameCache setObject:(color ?: (id)[NSNull null]) - forKey:cssColorName]; - } - } - - return color; -} - -+ (UIColor *)LOT_colorByLerpingFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor amount:(CGFloat)amount { - NSAssert((toColor != nil && fromColor != nil), @"Passing Nil Color"); - amount = CLAMP(amount, 0.f, 1.f); - const CGFloat *fromComponents = CGColorGetComponents(fromColor.CGColor); - const CGFloat *toComponents = CGColorGetComponents(toColor.CGColor); - float r = fromComponents[0] + ((toComponents[0] - fromComponents[0]) * amount); - float g = fromComponents[1] + ((toComponents[1] - fromComponents[1]) * amount); - float b = fromComponents[2] + ((toComponents[2] - fromComponents[2]) * amount); - float a = fromComponents[3] + ((toComponents[3] - fromComponents[3]) * amount); - return [UIColor colorWithRed:r green:g blue:b alpha:a]; -} - -#pragma mark UIColor_Expanded initialization - -+ (void)load { - colorNameCache = [[NSMutableDictionary alloc] init]; -} - -@end - -#pragma mark - - -@implementation UIColor (UIColor_Expanded_Support) -/* - * Database of color names and hex rgb values, derived - * from the css 3 color spec: - * http://www.w3.org/TR/css3-color/ - * - * We think this is a very compact way of storing - * this information, and relatively cheap to lookup. - * - * Note that we search for color names starting with ',' - * and terminated by '#', so that we don't get false matches. - * For this reason, the database begins with ','. - */ -static const char *colorNameDB = "," -"aliceblue#f0f8ff,antiquewhite#faebd7,aqua#00ffff,aquamarine#7fffd4,azure#f0ffff," -"beige#f5f5dc,bisque#ffe4c4,black#000000,blanchedalmond#ffebcd,blue#0000ff," -"blueviolet#8a2be2,brown#a52a2a,burlywood#deb887,cadetblue#5f9ea0,chartreuse#7fff00," -"chocolate#d2691e,coral#ff7f50,cornflowerblue#6495ed,cornsilk#fff8dc,crimson#dc143c," -"cyan#00ffff,darkblue#00008b,darkcyan#008b8b,darkgoldenrod#b8860b,darkgray#a9a9a9," -"darkgreen#006400,darkgrey#a9a9a9,darkkhaki#bdb76b,darkmagenta#8b008b," -"darkolivegreen#556b2f,darkorange#ff8c00,darkorchid#9932cc,darkred#8b0000," -"darksalmon#e9967a,darkseagreen#8fbc8f,darkslateblue#483d8b,darkslategray#2f4f4f," -"darkslategrey#2f4f4f,darkturquoise#00ced1,darkviolet#9400d3,deeppink#ff1493," -"deepskyblue#00bfff,dimgray#696969,dimgrey#696969,dodgerblue#1e90ff," -"firebrick#b22222,floralwhite#fffaf0,forestgreen#228b22,fuchsia#ff00ff," -"gainsboro#dcdcdc,ghostwhite#f8f8ff,gold#ffd700,goldenrod#daa520,gray#808080," -"green#008000,greenyellow#adff2f,grey#808080,honeydew#f0fff0,hotpink#ff69b4," -"indianred#cd5c5c,indigo#4b0082,ivory#fffff0,khaki#f0e68c,lavender#e6e6fa," -"lavenderblush#fff0f5,lawngreen#7cfc00,lemonchiffon#fffacd,lightblue#add8e6," -"lightcoral#f08080,lightcyan#e0ffff,lightgoldenrodyellow#fafad2,lightgray#d3d3d3," -"lightgreen#90ee90,lightgrey#d3d3d3,lightpink#ffb6c1,lightsalmon#ffa07a," -"lightseagreen#20b2aa,lightskyblue#87cefa,lightslategray#778899," -"lightslategrey#778899,lightsteelblue#b0c4de,lightyellow#ffffe0,lime#00ff00," -"limegreen#32cd32,linen#faf0e6,magenta#ff00ff,maroon#800000,mediumaquamarine#66cdaa," -"mediumblue#0000cd,mediumorchid#ba55d3,mediumpurple#9370db,mediumseagreen#3cb371," -"mediumslateblue#7b68ee,mediumspringgreen#00fa9a,mediumturquoise#48d1cc," -"mediumvioletred#c71585,midnightblue#191970,mintcream#f5fffa,mistyrose#ffe4e1," -"moccasin#ffe4b5,navajowhite#ffdead,navy#000080,oldlace#fdf5e6,olive#808000," -"olivedrab#6b8e23,orange#ffa500,orangered#ff4500,orchid#da70d6,palegoldenrod#eee8aa," -"palegreen#98fb98,paleturquoise#afeeee,palevioletred#db7093,papayawhip#ffefd5," -"peachpuff#ffdab9,peru#cd853f,pink#ffc0cb,plum#dda0dd,powderblue#b0e0e6," -"purple#800080,red#ff0000,rosybrown#bc8f8f,royalblue#4169e1,saddlebrown#8b4513," -"salmon#fa8072,sandybrown#f4a460,seagreen#2e8b57,seashell#fff5ee,sienna#a0522d," -"silver#c0c0c0,skyblue#87ceeb,slateblue#6a5acd,slategray#708090,slategrey#708090," -"snow#fffafa,springgreen#00ff7f,steelblue#4682b4,tan#d2b48c,teal#008080," -"thistle#d8bfd8,tomato#ff6347,turquoise#40e0d0,violet#ee82ee,wheat#f5deb3," -"white#ffffff,whitesmoke#f5f5f5,yellow#ffff00,yellowgreen#9acd32"; - -+ (UIColor *)searchForColorByName:(NSString *)cssColorName { - UIColor *result = nil; - - // Compile the string we'll use to search against the database - // We search for ",#" to avoid false matches - const char *searchString = [[NSString stringWithFormat:@",%@#", cssColorName] UTF8String]; - - // Search for the color name - const char *found = strstr(colorNameDB, searchString); - - // If found, step past the search string and grab the hex representation - if (found) { - const char *after = found + strlen(searchString); - int hex; - if (sscanf(after, "%x", &hex) == 1) { - result = [self LOT_colorWithRGBHex:hex]; - } - } - - return result; -} -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.h b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.h deleted file mode 100755 index 55cd9cb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright (c) 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import -#import - -@interface CALayer (Compat) - -@property (nonatomic, assign) BOOL allowsEdgeAntialiasing; - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.m b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.m deleted file mode 100755 index c364a7e..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/CALayer+Compat.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright (c) 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import "CALayer+Compat.h" - -@implementation CALayer (Compat) - -- (BOOL)allowsEdgeAntialiasing { return NO; } -- (void)setAllowsEdgeAntialiasing:(BOOL)allowsEdgeAntialiasing { } - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/LOTPlatformCompat.h b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/LOTPlatformCompat.h deleted file mode 100755 index eea9184..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/LOTPlatformCompat.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// LOTPlatformCompat.h -// Lottie -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright (c) 2017 Airbnb. All rights reserved. -// - -#ifndef LOTPlatformCompat_h -#define LOTPlatformCompat_h - -#include - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -#import - -#else - -#import -#import "UIColor.h" -#import "CALayer+Compat.h" -#import "NSValue+Compat.h" -#import "UIBezierPath.h" - -NS_INLINE NSString *NSStringFromCGRect(CGRect rect) { - return NSStringFromRect(rect); -} - -NS_INLINE NSString *NSStringFromCGPoint(CGPoint point) { - return NSStringFromPoint(point); -} - -typedef NSEdgeInsets UIEdgeInsets; - -#endif -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.h b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.h deleted file mode 100755 index 0672457..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright (c) 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import - -@interface NSValue (Compat) - -+ (NSValue *)valueWithCGRect:(CGRect)rect; -+ (NSValue *)valueWithCGPoint:(CGPoint)point; - -@property (nonatomic, readonly) CGRect CGRectValue; -@property(nonatomic, readonly) CGPoint CGPointValue; -@property (nonatomic, readonly) CGSize CGSizeValue; - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.m b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.m deleted file mode 100755 index 6547455..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/NSValue+Compat.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright (c) 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import "NSValue+Compat.h" - -@implementation NSValue (Compat) - -+ (NSValue *)valueWithCGRect:(CGRect)rect { - return [self valueWithRect:rect]; -} - -+ (NSValue *)valueWithCGPoint:(CGPoint)point { - return [self valueWithPoint:point]; -} - -- (CGRect)CGRectValue { - return self.rectValue; -} - -- (CGPoint)CGPointValue { - return self.pointValue; -} - -- (CGSize)CGSizeValue { - return self.sizeValue; -} - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.h b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.h deleted file mode 100755 index 6de2c31..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.h +++ /dev/null @@ -1,80 +0,0 @@ -// Kindly stolen from https://github.com/BigZaphod/Chameleon -/* - * Copyright (c) 2011, The Iconfactory. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of The Iconfactory nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import -#import - -typedef NS_OPTIONS(NSUInteger, UIRectCorner) { - UIRectCornerTopLeft = 1 << 0, - UIRectCornerTopRight = 1 << 1, - UIRectCornerBottomLeft = 1 << 2, - UIRectCornerBottomRight = 1 << 3, - UIRectCornerAllCorners = UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight -}; - -@interface UIBezierPath : NSObject - -+ (UIBezierPath *)bezierPath; -+ (UIBezierPath *)bezierPathWithRect:(CGRect)rect; -+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect; -+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius; -+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; -+ (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; -+ (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath; - -- (void)moveToPoint:(CGPoint)point; -- (void)addLineToPoint:(CGPoint)point; -- (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; -- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2; -- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint; -- (void)closePath; -- (void)removeAllPoints; -- (void)appendPath:(UIBezierPath *)bezierPath; -- (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase; -- (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase; -- (BOOL)containsPoint:(CGPoint)point; -- (void)applyTransform:(CGAffineTransform)transform; - -@property (nonatomic) CGPathRef CGPath; -@property (nonatomic, readonly) CGPoint currentPoint; -@property (nonatomic) CGFloat lineWidth; -@property (nonatomic) CGLineCap lineCapStyle; -@property (nonatomic) CGLineJoin lineJoinStyle; -@property (nonatomic) CGFloat miterLimit; -@property (nonatomic) CGFloat flatness; -@property (nonatomic) BOOL usesEvenOddFillRule; -@property (readonly, getter=isEmpty) BOOL empty; -@property (nonatomic, readonly) CGRect bounds; -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.m b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.m deleted file mode 100755 index ecc2549..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIBezierPath.m +++ /dev/null @@ -1,312 +0,0 @@ -// Kindly stolen from https://github.com/BigZaphod/Chameleon -/* - * Copyright (c) 2011, The Iconfactory. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of The Iconfactory nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import "UIBezierPath.h" - -@implementation UIBezierPath { - CGFloat *_lineDashPattern; - NSInteger _lineDashCount; - CGFloat _lineDashPhase; -} -@synthesize CGPath = _path; - -- (id)init { - self = [super init]; - if (self) { - _path = CGPathCreateMutable(); - _lineWidth = 1; - _lineCapStyle = kCGLineCapButt; - _lineJoinStyle = kCGLineJoinMiter; - _miterLimit = 10; - _flatness = 0.6; - _usesEvenOddFillRule = NO; - _lineDashPattern = NULL; - _lineDashCount = 0; - _lineDashPhase = 0; - } - return self; -} - -- (void)dealloc { - if (_path) CGPathRelease(_path); -} - -- (id)copyWithZone:(NSZone *)zone { - UIBezierPath *copy = [[self class] new]; - - copy.CGPath = self.CGPath; - copy.lineWidth = self.lineWidth; - copy.lineCapStyle = self.lineCapStyle; - copy.lineJoinStyle = self.lineJoinStyle; - copy.miterLimit = self.miterLimit; - copy.flatness = self.flatness; - copy.usesEvenOddFillRule = self.usesEvenOddFillRule; - - NSInteger lineDashCount = 0; - [self getLineDash:NULL count:&lineDashCount phase:NULL]; - - if (lineDashCount > 0) { - CGFloat *lineDashPattern = malloc(sizeof(CGFloat) * lineDashCount); - CGFloat lineDashPhase = 0; - [self getLineDash:lineDashPattern count:NULL phase:&lineDashPhase]; - [copy setLineDash:lineDashPattern count:lineDashCount phase:lineDashPhase]; - free(lineDashPattern); - } - - return copy; -} - -+ (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath { - NSAssert(CGPath != NULL, @"CGPath must not be NULL"); - UIBezierPath *bezierPath = [[self alloc] init]; - bezierPath.CGPath = CGPath; - return bezierPath; -} - -+ (UIBezierPath *)bezierPath { - UIBezierPath *bezierPath = [[self alloc] init]; - return bezierPath; -} - -+ (UIBezierPath *)bezierPathWithRect:(CGRect)rect { - CGMutablePathRef path = CGPathCreateMutable(); - CGPathAddRect(path, NULL, rect); - - UIBezierPath *bezierPath = [[self alloc] init]; - bezierPath->_path = path; - return bezierPath; -} - -+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect { - CGMutablePathRef path = CGPathCreateMutable(); - CGPathAddEllipseInRect(path, NULL, rect); - - UIBezierPath *bezierPath = [[self alloc] init]; - bezierPath->_path = path; - return bezierPath; -} - -+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect - cornerRadius:(CGFloat)cornerRadius { - return [self bezierPathWithRoundedRect:rect - byRoundingCorners:UIRectCornerAllCorners - cornerRadii:CGSizeMake(cornerRadius, cornerRadius)]; -} - -+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect - byRoundingCorners:(UIRectCorner)corners - cornerRadii:(CGSize)cornerRadii { - - CGMutablePathRef path = CGPathCreateMutable(); - - const CGPoint topLeft = rect.origin; - const CGPoint topRight = CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)); - const CGPoint bottomRight = CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)); - const CGPoint bottomLeft = CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)); - - if (corners & UIRectCornerTopLeft) { - CGPathMoveToPoint(path, NULL, topLeft.x + cornerRadii.width, topLeft.y); - } else { - CGPathMoveToPoint(path, NULL, topLeft.x, topLeft.y); - } - - if (corners & UIRectCornerTopRight) { - CGPathAddLineToPoint(path, NULL, topRight.x - cornerRadii.width, topRight.y); - CGPathAddCurveToPoint(path, NULL, topRight.x, topRight.y, topRight.x, topRight.y + cornerRadii.height, topRight.x, topRight.y + cornerRadii.height); - } else { - CGPathAddLineToPoint(path, NULL, topRight.x, topRight.y); - } - - if (corners & UIRectCornerBottomRight) { - CGPathAddLineToPoint(path, NULL, bottomRight.x, bottomRight.y - cornerRadii.height); - CGPathAddCurveToPoint(path, NULL, bottomRight.x, bottomRight.y, bottomRight.x - cornerRadii.width, bottomRight.y, bottomRight.x - cornerRadii.width, bottomRight.y); - } else { - CGPathAddLineToPoint(path, NULL, bottomRight.x, bottomRight.y); - } - - if (corners & UIRectCornerBottomLeft) { - CGPathAddLineToPoint(path, NULL, bottomLeft.x + cornerRadii.width, bottomLeft.y); - CGPathAddCurveToPoint(path, NULL, bottomLeft.x, bottomLeft.y, bottomLeft.x, bottomLeft.y - cornerRadii.height, bottomLeft.x, bottomLeft.y - cornerRadii.height); - } else { - CGPathAddLineToPoint(path, NULL, bottomLeft.x, bottomLeft.y); - } - - if (corners & UIRectCornerTopLeft) { - CGPathAddLineToPoint(path, NULL, topLeft.x, topLeft.y + cornerRadii.height); - CGPathAddCurveToPoint(path, NULL, topLeft.x, topLeft.y, topLeft.x + cornerRadii.width, topLeft.y, topLeft.x + cornerRadii.width, topLeft.y); - } else { - CGPathAddLineToPoint(path, NULL, topLeft.x, topLeft.y); - } - - CGPathCloseSubpath(path); - - UIBezierPath *bezierPath = [[self alloc] init]; - bezierPath->_path = path; - return bezierPath; -} - -+ (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center - radius:(CGFloat)radius - startAngle:(CGFloat)startAngle - endAngle:(CGFloat)endAngle - clockwise:(BOOL)clockwise { - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathAddArc(path, NULL, center.x, center.y, radius, startAngle, endAngle, clockwise); - - UIBezierPath *bezierPath = [[self alloc] init]; - bezierPath->_path = path; - return bezierPath; -} - -- (void)moveToPoint:(CGPoint)point { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathMoveToPoint(mutablePath, NULL, point.x, point.y); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)addLineToPoint:(CGPoint)point { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathAddLineToPoint(mutablePath, NULL, point.x, point.y); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathAddArc(mutablePath, NULL, center.x, center.y, radius, startAngle, endAngle, clockwise); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2 { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathAddCurveToPoint(mutablePath, NULL, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, endPoint.x, endPoint.y); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathAddQuadCurveToPoint(mutablePath, NULL, controlPoint.x, controlPoint.y, endPoint.x, endPoint.y); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)closePath { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathCloseSubpath(mutablePath); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)removeAllPoints { - CGMutablePathRef mutablePath = CGPathCreateMutable(); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -- (void)appendPath:(UIBezierPath *)bezierPath { - if (bezierPath) { - CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); - CGPathAddPath(mutablePath, NULL, bezierPath.CGPath); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); - } -} - -- (void)setCGPath:(CGPathRef)path { - NSAssert(path != NULL, @"path must not be NULL"); - if (path != _path) { - if (_path) CGPathRelease(_path); - _path = CGPathCreateCopy(path); - } -} - -- (CGPoint)currentPoint { - return CGPathGetCurrentPoint(_path); -} - -- (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase { - free(_lineDashPattern); - - if (pattern && count > 0) { - const size_t size = sizeof(CGFloat) * count; - _lineDashPattern = malloc(size); - bcopy(pattern, _lineDashPattern, size); - } else { - _lineDashPattern = NULL; - } - - _lineDashCount = count; - _lineDashPhase = phase; -} - -- (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase { - if (pattern && _lineDashPattern && _lineDashCount > 0) { - const size_t size = sizeof(CGFloat) * _lineDashCount; - bcopy(_lineDashPattern, pattern, size); - } - - if (count) { - *count = _lineDashCount; - } - - if (phase) { - *phase = _lineDashPhase; - } -} - -- (BOOL)containsPoint:(CGPoint)point { - return CGPathContainsPoint(_path, NULL, point, _usesEvenOddFillRule); -} - -- (BOOL)isEmpty { - return CGPathIsEmpty(_path); -} - -- (CGRect)bounds { - return CGPathGetBoundingBox(_path); -} - -- (void)applyTransform:(CGAffineTransform)transform { - CGMutablePathRef mutablePath = CGPathCreateMutable(); - CGPathAddPath(mutablePath, &transform, _path); - self.CGPath = mutablePath; - CGPathRelease(mutablePath); -} - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.h b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.h deleted file mode 100755 index 8e14137..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// UIColor.h -// Lottie -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import -#import - -@interface UIColor : NSObject - -+ (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha; -+ (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha; -+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -+ (UIColor *)colorWithCGColor:(CGColorRef)cgColor; - -+ (UIColor *)blackColor; -+ (UIColor *)darkGrayColor; -+ (UIColor *)lightGrayColor; -+ (UIColor *)whiteColor; -+ (UIColor *)grayColor; -+ (UIColor *)redColor; -+ (UIColor *)greenColor; -+ (UIColor *)blueColor; -+ (UIColor *)cyanColor; -+ (UIColor *)yellowColor; -+ (UIColor *)magentaColor; -+ (UIColor *)orangeColor; -+ (UIColor *)purpleColor; -+ (UIColor *)brownColor; -+ (UIColor *)clearColor; - -- (UIColor *)colorWithAlphaComponent:(CGFloat)alpha; - -@property (nonatomic, readonly) CGColorRef CGColor; - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.m b/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.m deleted file mode 100755 index ac223fe..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/MacCompatability/UIColor.m +++ /dev/null @@ -1,158 +0,0 @@ -// -// UIColor.m -// Lottie -// -// Created by Oleksii Pavlovskyi on 2/2/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#include - -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR -#import "UIColor.h" -#import - -#define StaticColor(staticColor) \ -static UIColor *color = nil; \ -static dispatch_once_t onceToken; \ -dispatch_once(&onceToken, ^{ \ - color = NSColor.staticColor.UIColor; \ -}); \ -return color; \ - -@interface UIColor () - -@property (nonatomic, strong) NSColor *color; - -- (instancetype)initWithNSColor:(NSColor *)color; - -@end - -@interface NSColor (UIColor) - -@property (nonatomic, readonly) UIColor *UIColor; - -@end - -@implementation UIColor - -- (instancetype)initWithNSColor:(NSColor *)color { - self = [super init]; - if (self) { - self.color = color; - } - return self; -} - -+ (UIColor *)colorWithNSColor:(NSColor *)color { - return [[self alloc] initWithNSColor:color]; -} - -+ (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha { - return [[NSColor colorWithWhite:white alpha:alpha] UIColor]; -} - -+ (UIColor *)colorWithHue:(CGFloat)hue - saturation:(CGFloat)saturation - brightness:(CGFloat)brightness - alpha:(CGFloat)alpha { - return [[NSColor colorWithHue:hue - saturation:saturation - brightness:brightness - alpha:alpha] UIColor]; -} - -+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - return [[NSColor colorWithRed:red - green:green - blue:blue - alpha:alpha] UIColor]; -} - -+ (UIColor *)colorWithCGColor:(CGColorRef)cgColor { - return [[NSColor colorWithCGColor:cgColor] UIColor]; -} - -+ (UIColor *)blackColor { - StaticColor(blackColor) -} - -+ (UIColor *)darkGrayColor { - StaticColor(darkGrayColor) -} - -+ (UIColor *)lightGrayColor { - StaticColor(lightGrayColor) -} - -+ (UIColor *)whiteColor { - StaticColor(whiteColor) -} - -+ (UIColor *)grayColor { - StaticColor(grayColor) -} - -+ (UIColor *)redColor { - StaticColor(redColor) -} - -+ (UIColor *)greenColor { - StaticColor(greenColor) -} - -+ (UIColor *)blueColor { - StaticColor(blueColor) -} - -+ (UIColor *)cyanColor { - StaticColor(cyanColor) -} - -+ (UIColor *)yellowColor { - StaticColor(yellowColor) -} - -+ (UIColor *)magentaColor { - StaticColor(magentaColor) -} - -+ (UIColor *)orangeColor { - StaticColor(orangeColor) -} - -+ (UIColor *)purpleColor { - StaticColor(purpleColor) -} - -+ (UIColor *)brownColor { - StaticColor(brownColor) -} - -+ (UIColor *)clearColor { - StaticColor(clearColor) -} - -- (CGColorRef)CGColor { - return self.color.CGColor; -} - -- (UIColor *)colorWithAlphaComponent:(CGFloat)alpha { - return [self.color colorWithAlphaComponent:alpha].UIColor; -} - -- (id)copyWithZone:(NSZone *)zone { - return [[self.color copyWithZone:zone] UIColor]; -} - -@end - -@implementation NSColor (UIColor) - -- (UIColor *)UIColor { - return [UIColor colorWithNSColor:self]; -} - -@end - -#endif diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.h deleted file mode 100755 index 0455c7f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// LOTAsset.h -// Pods -// -// Created by Brandon Withrow on 2/16/17. -// -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class LOTLayerGroup; -@class LOTLayer; -@class LOTAssetGroup; - -@interface LOTAsset : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withAssetBundle:(NSBundle *_Nonnull)bundle - withFramerate:(NSNumber *)framerate; - -@property (nonatomic, readonly, nullable) NSString *referenceID; -@property (nonatomic, readonly, nullable) NSNumber *assetWidth; -@property (nonatomic, readonly, nullable) NSNumber *assetHeight; - -@property (nonatomic, readonly, nullable) NSString *imageName; -@property (nonatomic, readonly, nullable) NSString *imageDirectory; - -@property (nonatomic, readonly, nullable) LOTLayerGroup *layerGroup; - -@property (nonatomic, readwrite) NSString *rootDirectory; -@property (nonatomic, readonly) NSBundle *assetBundle; -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.m deleted file mode 100755 index 23e69a3..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAsset.m +++ /dev/null @@ -1,59 +0,0 @@ -// -// LOTAsset.m -// Pods -// -// Created by Brandon Withrow on 2/16/17. -// -// - -#import "LOTAsset.h" -#import "LOTLayer.h" -#import "LOTLayerGroup.h" -#import "LOTAssetGroup.h" - -@implementation LOTAsset - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withAssetBundle:(NSBundle *_Nonnull)bundle - withFramerate:(NSNumber *)framerate { - self = [super init]; - if (self) { - _assetBundle = bundle; - [self _mapFromJSON:jsonDictionary - withAssetGroup:assetGroup - withFramerate:framerate]; - } - return self; -} - -- (void)_mapFromJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withFramerate:(NSNumber *)framerate { - _referenceID = [jsonDictionary[@"id"] copy]; - - if (jsonDictionary[@"w"]) { - _assetWidth = [jsonDictionary[@"w"] copy]; - } - - if (jsonDictionary[@"h"]) { - _assetHeight = [jsonDictionary[@"h"] copy]; - } - - if (jsonDictionary[@"u"]) { - _imageDirectory = [jsonDictionary[@"u"] copy]; - } - - if (jsonDictionary[@"p"]) { - _imageName = [jsonDictionary[@"p"] copy]; - } - - NSArray *layersJSON = jsonDictionary[@"layers"]; - if (layersJSON) { - _layerGroup = [[LOTLayerGroup alloc] initWithLayerJSON:layersJSON - withAssetGroup:assetGroup - withFramerate:framerate]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.h deleted file mode 100755 index dcae55a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// LOTAssetGroup.h -// Pods -// -// Created by Brandon Withrow on 2/17/17. -// -// - -#import -#import - -@class LOTAsset; -@class LOTLayerGroup; -@interface LOTAssetGroup : NSObject -@property (nonatomic, readwrite) NSString * _Nullable rootDirectory; -@property (nonatomic, readonly, nullable) NSBundle *assetBundle; - -- (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray - withAssetBundle:(NSBundle *_Nullable)bundle - withFramerate:(NSNumber * _Nonnull)framerate; - -- (void)buildAssetNamed:(NSString * _Nonnull)refID withFramerate:(NSNumber * _Nonnull)framerate; - -- (void)finalizeInitializationWithFramerate:(NSNumber * _Nonnull)framerate; - -- (LOTAsset * _Nullable)assetModelForID:(NSString * _Nonnull)assetID; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.m deleted file mode 100755 index 4f9bb1a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTAssetGroup.m +++ /dev/null @@ -1,70 +0,0 @@ -// -// LOTAssetGroup.m -// Pods -// -// Created by Brandon Withrow on 2/17/17. -// -// - -#import "LOTAssetGroup.h" -#import "LOTAsset.h" - -@implementation LOTAssetGroup { - NSMutableDictionary *_assetMap; - NSDictionary *_assetJSONMap; -} - -- (instancetype _Nonnull)initWithJSON:(NSArray * _Nonnull)jsonArray - withAssetBundle:(NSBundle * _Nullable)bundle - withFramerate:(NSNumber * _Nonnull)framerate { - self = [super init]; - if (self) { - _assetBundle = bundle; - _assetMap = [NSMutableDictionary dictionary]; - NSMutableDictionary *assetJSONMap = [NSMutableDictionary dictionary]; - for (NSDictionary *assetDictionary in jsonArray) { - NSString *referenceID = assetDictionary[@"id"]; - if (referenceID) { - assetJSONMap[referenceID] = assetDictionary; - } - } - _assetJSONMap = assetJSONMap; - } - return self; -} - -- (void)buildAssetNamed:(NSString *)refID - withFramerate:(NSNumber * _Nonnull)framerate { - - if ([self assetModelForID:refID]) { - return; - } - - NSDictionary *assetDictionary = _assetJSONMap[refID]; - if (assetDictionary) { - LOTAsset *asset = [[LOTAsset alloc] initWithJSON:assetDictionary - withAssetGroup:self - withAssetBundle:_assetBundle - withFramerate:framerate]; - _assetMap[refID] = asset; - } -} - -- (void)finalizeInitializationWithFramerate:(NSNumber * _Nonnull)framerate { - for (NSString *refID in _assetJSONMap.allKeys) { - [self buildAssetNamed:refID withFramerate:framerate]; - } - _assetJSONMap = nil; -} - -- (LOTAsset *)assetModelForID:(NSString *)assetID { - return _assetMap[assetID]; -} - -- (void)setRootDirectory:(NSString *)rootDirectory { - _rootDirectory = rootDirectory; - [_assetMap enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, LOTAsset * _Nonnull obj, BOOL * _Nonnull stop) { - obj.rootDirectory = rootDirectory; - }]; -} -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.h deleted file mode 100755 index aedb84b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.h +++ /dev/null @@ -1,76 +0,0 @@ -// -// LOTLayer.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTPlatformCompat.h" -#import "LOTKeyframe.h" - -@class LOTShapeGroup; -@class LOTMask; -@class LOTAsset; -@class LOTAssetGroup; - -typedef enum : NSInteger { - LOTLayerTypePrecomp, - LOTLayerTypeSolid, - LOTLayerTypeImage, - LOTLayerTypeNull, - LOTLayerTypeShape, - LOTLayerTypeUnknown -} LOTLayerType; - -typedef enum : NSInteger { - LOTMatteTypeNone, - LOTMatteTypeAdd, - LOTMatteTypeInvert, - LOTMatteTypeUnknown -} LOTMatteType; - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTLayer : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withFramerate:(NSNumber *)framerate; - -@property (nonatomic, readonly) NSString *layerName; -@property (nonatomic, readonly, nullable) NSString *referenceID; -@property (nonatomic, readonly) NSNumber *layerID; -@property (nonatomic, readonly) LOTLayerType layerType; -@property (nonatomic, readonly, nullable) NSNumber *parentID; -@property (nonatomic, readonly) NSNumber *startFrame; -@property (nonatomic, readonly) NSNumber *inFrame; -@property (nonatomic, readonly) NSNumber *outFrame; -@property (nonatomic, readonly) NSNumber *timeStretch; -@property (nonatomic, readonly) CGRect layerBounds; - -@property (nonatomic, readonly, nullable) NSArray *shapes; -@property (nonatomic, readonly, nullable) NSArray *masks; - -@property (nonatomic, readonly, nullable) NSNumber *layerWidth; -@property (nonatomic, readonly, nullable) NSNumber *layerHeight; -@property (nonatomic, readonly, nullable) UIColor *solidColor; -@property (nonatomic, readonly, nullable) LOTAsset *imageAsset; - -@property (nonatomic, readonly) LOTKeyframeGroup *opacity; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *timeRemapping; -@property (nonatomic, readonly) LOTKeyframeGroup *rotation; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *position; - -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *positionX; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *positionY; - -@property (nonatomic, readonly) LOTKeyframeGroup *anchor; -@property (nonatomic, readonly) LOTKeyframeGroup *scale; - -@property (nonatomic, readonly) LOTMatteType matteType; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.m deleted file mode 100755 index 4b12f34..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayer.m +++ /dev/null @@ -1,183 +0,0 @@ -// -// LOTLayer.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTLayer.h" -#import "LOTAsset.h" -#import "LOTAssetGroup.h" -#import "LOTShapeGroup.h" -#import "LOTComposition.h" -#import "LOTHelpers.h" -#import "LOTMask.h" -#import "LOTHelpers.h" - -@implementation LOTLayer - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup *)assetGroup - withFramerate:(NSNumber *)framerate { - self = [super init]; - if (self) { - [self _mapFromJSON:jsonDictionary - withAssetGroup:assetGroup - withFramerate:framerate]; - } - return self; -} - -- (void)_mapFromJSON:(NSDictionary *)jsonDictionary - withAssetGroup:(LOTAssetGroup *)assetGroup - withFramerate:(NSNumber *)framerate { - - _layerName = [jsonDictionary[@"nm"] copy]; - _layerID = [jsonDictionary[@"ind"] copy]; - - NSNumber *layerType = jsonDictionary[@"ty"]; - _layerType = layerType.integerValue; - - if (jsonDictionary[@"refId"]) { - _referenceID = [jsonDictionary[@"refId"] copy]; - } - - _parentID = [jsonDictionary[@"parent"] copy]; - - if (jsonDictionary[@"st"]) { - _startFrame = [jsonDictionary[@"st"] copy]; - } - _inFrame = [jsonDictionary[@"ip"] copy]; - _outFrame = [jsonDictionary[@"op"] copy]; - - if (jsonDictionary[@"sr"]) { - _timeStretch = [jsonDictionary[@"sr"] copy]; - } else { - _timeStretch = @1; - } - - if (_layerType == LOTLayerTypePrecomp) { - _layerHeight = [jsonDictionary[@"h"] copy]; - _layerWidth = [jsonDictionary[@"w"] copy]; - [assetGroup buildAssetNamed:_referenceID withFramerate:framerate]; - } else if (_layerType == LOTLayerTypeImage) { - [assetGroup buildAssetNamed:_referenceID withFramerate:framerate]; - _imageAsset = [assetGroup assetModelForID:_referenceID]; - _layerWidth = [_imageAsset.assetWidth copy]; - _layerHeight = [_imageAsset.assetHeight copy]; - } else if (_layerType == LOTLayerTypeSolid) { - _layerWidth = jsonDictionary[@"sw"]; - _layerHeight = jsonDictionary[@"sh"]; - NSString *solidColor = jsonDictionary[@"sc"]; - _solidColor = [UIColor LOT_colorWithHexString:solidColor]; - } - - _layerBounds = CGRectMake(0, 0, _layerWidth.floatValue, _layerHeight.floatValue); - - NSDictionary *ks = jsonDictionary[@"ks"]; - - NSDictionary *opacity = ks[@"o"]; - if (opacity) { - _opacity = [[LOTKeyframeGroup alloc] initWithData:opacity]; - [_opacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - NSDictionary *timeRemap = jsonDictionary[@"tm"]; - if (timeRemap) { - _timeRemapping = [[LOTKeyframeGroup alloc] initWithData:timeRemap]; - [_timeRemapping remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return inValue * framerate.doubleValue; - }]; - } - - NSDictionary *rotation = ks[@"r"]; - if (rotation == nil) { - rotation = ks[@"rz"]; - } - if (rotation) { - _rotation = [[LOTKeyframeGroup alloc] initWithData:rotation]; - [_rotation remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_DegreesToRadians(inValue); - }]; - } - - NSDictionary *position = ks[@"p"]; - if ([position[@"s"] boolValue]) { - // Separate dimensions - _positionX = [[LOTKeyframeGroup alloc] initWithData:position[@"x"]]; - _positionY = [[LOTKeyframeGroup alloc] initWithData:position[@"y"]]; - } else { - _position = [[LOTKeyframeGroup alloc] initWithData:position ]; - } - - NSDictionary *anchor = ks[@"a"]; - if (anchor) { - _anchor = [[LOTKeyframeGroup alloc] initWithData:anchor]; - } - - NSDictionary *scale = ks[@"s"]; - if (scale) { - _scale = [[LOTKeyframeGroup alloc] initWithData:scale]; - [_scale remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, -100, 100, -1, 1); - }]; - } - - _matteType = [jsonDictionary[@"tt"] integerValue]; - - - NSMutableArray *masks = [NSMutableArray array]; - for (NSDictionary *maskJSON in jsonDictionary[@"masksProperties"]) { - LOTMask *mask = [[LOTMask alloc] initWithJSON:maskJSON]; - [masks addObject:mask]; - } - _masks = masks.count ? masks : nil; - - NSMutableArray *shapes = [NSMutableArray array]; - for (NSDictionary *shapeJSON in jsonDictionary[@"shapes"]) { - id shapeItem = [LOTShapeGroup shapeItemWithJSON:shapeJSON]; - if (shapeItem) { - [shapes addObject:shapeItem]; - } - } - _shapes = shapes; - - NSArray *effects = jsonDictionary[@"ef"]; - if (effects.count > 0) { - - NSDictionary *effectNames = @{ @0: @"slider", - @1: @"angle", - @2: @"color", - @3: @"point", - @4: @"checkbox", - @5: @"group", - @6: @"noValue", - @7: @"dropDown", - @9: @"customValue", - @10: @"layerIndex", - @20: @"tint", - @21: @"fill" }; - - for (NSDictionary *effect in effects) { - NSNumber *typeNumber = effect[@"ty"]; - NSString *name = effect[@"nm"]; - NSString *internalName = effect[@"mn"]; - NSString *typeString = effectNames[typeNumber]; - if (typeString) { - NSLog(@"%s: Warning: %@ effect not supported: %@ / %@", __PRETTY_FUNCTION__, typeString, internalName, name); - } - } - } -} - -- (NSString *)description { - NSMutableString *text = [[super description] mutableCopy]; - [text appendFormat:@" %@ id: %d pid: %d frames: %d-%d", _layerName, (int)_layerID.integerValue, (int)_parentID.integerValue, - (int)_inFrame.integerValue, (int)_outFrame.integerValue]; - return text; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.h deleted file mode 100755 index f6952b5..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// LOTLayerGroup.h -// Pods -// -// Created by Brandon Withrow on 2/16/17. -// -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class LOTLayer; -@class LOTAssetGroup; - -@interface LOTLayerGroup : NSObject - -- (instancetype)initWithLayerJSON:(NSArray *)layersJSON - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withFramerate:(NSNumber *)framerate; - -@property (nonatomic, readonly) NSArray *layers; - -- (LOTLayer *)layerModelForID:(NSNumber *)layerID; -- (LOTLayer *)layerForReferenceID:(NSString *)referenceID; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.m deleted file mode 100755 index 1d12d01..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTLayerGroup.m +++ /dev/null @@ -1,60 +0,0 @@ -// -// LOTLayerGroup.m -// Pods -// -// Created by Brandon Withrow on 2/16/17. -// -// - -#import "LOTLayerGroup.h" -#import "LOTLayer.h" -#import "LOTAssetGroup.h" - -@implementation LOTLayerGroup { - NSDictionary *_modelMap; - NSDictionary *_referenceIDMap; -} - -- (instancetype)initWithLayerJSON:(NSArray *)layersJSON - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withFramerate:(NSNumber *)framerate { - self = [super init]; - if (self) { - [self _mapFromJSON:layersJSON withAssetGroup:assetGroup withFramerate:framerate]; - } - return self; -} - -- (void)_mapFromJSON:(NSArray *)layersJSON - withAssetGroup:(LOTAssetGroup * _Nullable)assetGroup - withFramerate:(NSNumber *)framerate { - - NSMutableArray *layers = [NSMutableArray array]; - NSMutableDictionary *modelMap = [NSMutableDictionary dictionary]; - NSMutableDictionary *referenceMap = [NSMutableDictionary dictionary]; - - for (NSDictionary *layerJSON in layersJSON) { - LOTLayer *layer = [[LOTLayer alloc] initWithJSON:layerJSON - withAssetGroup:assetGroup - withFramerate:framerate]; - [layers addObject:layer]; - modelMap[layer.layerID] = layer; - if (layer.referenceID) { - referenceMap[layer.referenceID] = layer; - } - } - - _referenceIDMap = referenceMap; - _modelMap = modelMap; - _layers = layers; -} - -- (LOTLayer *)layerModelForID:(NSNumber *)layerID { - return _modelMap[layerID]; -} - -- (LOTLayer *)layerForReferenceID:(NSString *)referenceID { - return _referenceIDMap[referenceID]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.h deleted file mode 100755 index d60ff43..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// LOTMask.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -typedef enum : NSUInteger { - LOTMaskModeAdd, - LOTMaskModeSubtract, - LOTMaskModeIntersect, - LOTMaskModeUnknown -} LOTMaskMode; - -@interface LOTMask : NSObject - -- (instancetype _Nonnull)initWithJSON:(NSDictionary * _Nonnull)jsonDictionary; - -@property (nonatomic, readonly) BOOL closed; -@property (nonatomic, readonly) BOOL inverted; -@property (nonatomic, readonly) LOTMaskMode maskMode; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *maskPath; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *opacity; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *expansion; -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.m deleted file mode 100755 index b67476f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTMask.m +++ /dev/null @@ -1,59 +0,0 @@ -// -// LOTMask.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTMask.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTMask - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary { - self = [super init]; - if (self) { - [self _mapFromJSON:jsonDictionary]; - } - return self; -} - -- (void)_mapFromJSON:(NSDictionary *)jsonDictionary { - NSNumber *closed = jsonDictionary[@"cl"]; - _closed = closed.boolValue; - - NSNumber *inverted = jsonDictionary[@"inv"]; - _inverted = inverted.boolValue; - - NSString *mode = jsonDictionary[@"mode"]; - if ([mode isEqualToString:@"a"]) { - _maskMode = LOTMaskModeAdd; - } else if ([mode isEqualToString:@"s"]) { - _maskMode = LOTMaskModeSubtract; - } else if ([mode isEqualToString:@"i"]) { - _maskMode = LOTMaskModeIntersect; - } else { - _maskMode = LOTMaskModeUnknown; - } - - NSDictionary *maskshape = jsonDictionary[@"pt"]; - if (maskshape) { - _maskPath = [[LOTKeyframeGroup alloc] initWithData:maskshape]; - } - - NSDictionary *opacity = jsonDictionary[@"o"]; - if (opacity) { - _opacity = [[LOTKeyframeGroup alloc] initWithData:opacity]; - [_opacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - NSDictionary *expansion = jsonDictionary[@"x"]; - if (expansion) { - _expansion = [[LOTKeyframeGroup alloc] initWithData:expansion]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTModels.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTModels.h deleted file mode 100755 index 43bd5d6..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTModels.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// LOTModels.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#ifndef LOTModels_h -#define LOTModels_h - -#import "LOTKeyframe.h" -#import "LOTComposition.h" -#import "LOTLayer.h" -#import "LOTMask.h" -#import "LOTShapeCircle.h" -#import "LOTShapeFill.h" -#import "LOTShapeGroup.h" -#import "LOTShapePath.h" -#import "LOTShapeRectangle.h" -#import "LOTShapeStroke.h" -#import "LOTShapeTransform.h" -#import "LOTShapeTrimPath.h" -#import "LOTLayerGroup.h" -#import "LOTAsset.h" -#import "LOTShapeGradientFill.h" - -#endif /* LOTModels_h */ diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.h deleted file mode 100755 index 9cb5c9a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// LOTShapeCircle.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTShapeCircle : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) LOTKeyframeGroup *position; -@property (nonatomic, readonly) LOTKeyframeGroup *size; -@property (nonatomic, readonly) BOOL reversed; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.m deleted file mode 100755 index 806789f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeCircle.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// LOTShapeCircle.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeCircle.h" - -@implementation LOTShapeCircle - -- (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 *position = jsonDictionary[@"p"]; - if (position) { - _position = [[LOTKeyframeGroup alloc] initWithData:position]; - } - - NSDictionary *size= jsonDictionary[@"s"]; - if (size) { - _size = [[LOTKeyframeGroup alloc] initWithData:size]; - } - NSNumber *reversed = jsonDictionary[@"d"]; - _reversed = (reversed.integerValue == 3); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.h deleted file mode 100755 index a676707..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// LOTShapeFill.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTShapeFill : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) BOOL fillEnabled; -@property (nonatomic, readonly) LOTKeyframeGroup *color; -@property (nonatomic, readonly) LOTKeyframeGroup *opacity; -@property (nonatomic, readonly) BOOL evenOddFillRule; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.m deleted file mode 100755 index 386b318..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeFill.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// 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 diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.h deleted file mode 100755 index 3be49c3..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// LOTShapeGradientFill.h -// Lottie -// -// Created by brandon_withrow on 7/26/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -NS_ASSUME_NONNULL_BEGIN - -typedef enum : NSUInteger { - LOTGradientTypeLinear, - LOTGradientTypeRadial -} LOTGradientType; - -@interface LOTShapeGradientFill : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) NSNumber *numberOfColors; -@property (nonatomic, readonly) LOTKeyframeGroup *startPoint; -@property (nonatomic, readonly) LOTKeyframeGroup *endPoint; -@property (nonatomic, readonly) LOTKeyframeGroup *gradient; -@property (nonatomic, readonly) LOTKeyframeGroup *opacity; -@property (nonatomic, readonly) BOOL evenOddFillRule; -@property (nonatomic, readonly) LOTGradientType type; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.m deleted file mode 100755 index f4eeb13..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGradientFill.m +++ /dev/null @@ -1,67 +0,0 @@ -// -// LOTShapeGradientFill.m -// Lottie -// -// Created by brandon_withrow on 7/26/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTShapeGradientFill.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTShapeGradientFill - -- (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]; - } - - NSNumber *type = jsonDictionary[@"t"]; - - if (type.integerValue != 1) { - _type = LOTGradientTypeRadial; - } else { - _type = LOTGradientTypeLinear; - } - - NSDictionary *start = jsonDictionary[@"s"]; - if (start) { - _startPoint = [[LOTKeyframeGroup alloc] initWithData:start]; - } - - NSDictionary *end = jsonDictionary[@"e"]; - if (end) { - _endPoint = [[LOTKeyframeGroup alloc] initWithData:end]; - } - - NSDictionary *gradient = jsonDictionary[@"g"]; - if (gradient) { - NSDictionary *unwrappedGradient = gradient[@"k"]; - _numberOfColors = gradient[@"p"]; - _gradient = [[LOTKeyframeGroup alloc] initWithData:unwrappedGradient]; - } - - 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; - } -} -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.h deleted file mode 100755 index 4d65553..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// LOTShape.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import - -@interface LOTShapeGroup : NSObject - -- (instancetype _Nonnull)initWithJSON:(NSDictionary *_Nonnull)jsonDictionary; - -@property (nonatomic, readonly, nonnull) NSString *keyname; -@property (nonatomic, readonly, nonnull) NSArray *items; - -+ (id _Nullable)shapeItemWithJSON:(NSDictionary * _Nonnull)itemJSON; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.m deleted file mode 100755 index ef445d0..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeGroup.m +++ /dev/null @@ -1,102 +0,0 @@ -// -// LOTShape.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeGroup.h" -#import "LOTShapeFill.h" -#import "LOTShapePath.h" -#import "LOTShapeCircle.h" -#import "LOTShapeStroke.h" -#import "LOTShapeTransform.h" -#import "LOTShapeRectangle.h" -#import "LOTShapeTrimPath.h" -#import "LOTShapeGradientFill.h" -#import "LOTShapeStar.h" -#import "LOTShapeRepeater.h" - -@implementation LOTShapeGroup - -- (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]; - } - - NSArray *itemsJSON = jsonDictionary[@"it"]; - NSMutableArray *items = [NSMutableArray array]; - for (NSDictionary *itemJSON in itemsJSON) { - id newItem = [LOTShapeGroup shapeItemWithJSON:itemJSON]; - if (newItem) { - [items addObject:newItem]; - } - } - _items = items; -} - -+ (id)shapeItemWithJSON:(NSDictionary *)itemJSON { - NSString *type = itemJSON[@"ty"]; - if ([type isEqualToString:@"gr"]) { - LOTShapeGroup *group = [[LOTShapeGroup alloc] initWithJSON:itemJSON]; - return group; - } else if ([type isEqualToString:@"st"]) { - LOTShapeStroke *stroke = [[LOTShapeStroke alloc] initWithJSON:itemJSON]; - return stroke; - } else if ([type isEqualToString:@"fl"]) { - LOTShapeFill *fill = [[LOTShapeFill alloc] initWithJSON:itemJSON]; - return fill; - } else if ([type isEqualToString:@"tr"]) { - LOTShapeTransform *transform = [[LOTShapeTransform alloc] initWithJSON:itemJSON]; - return transform; - } else if ([type isEqualToString:@"sh"]) { - LOTShapePath *path = [[LOTShapePath alloc] initWithJSON:itemJSON]; - return path; - } else if ([type isEqualToString:@"el"]) { - LOTShapeCircle *circle = [[LOTShapeCircle alloc] initWithJSON:itemJSON]; - return circle; - } else if ([type isEqualToString:@"rc"]) { - LOTShapeRectangle *rectangle = [[LOTShapeRectangle alloc] initWithJSON:itemJSON]; - return rectangle; - } else if ([type isEqualToString:@"tm"]) { - LOTShapeTrimPath *trim = [[LOTShapeTrimPath alloc] initWithJSON:itemJSON]; - return trim; - } else if ([type isEqualToString:@"gs"]) { - NSLog(@"%s: Warning: gradient strokes are not supported", __PRETTY_FUNCTION__); - } else if ([type isEqualToString:@"gf"]) { - LOTShapeGradientFill *gradientFill = [[LOTShapeGradientFill alloc] initWithJSON:itemJSON]; - return gradientFill; - } else if ([type isEqualToString:@"sr"]) { - LOTShapeStar *star = [[LOTShapeStar alloc] initWithJSON:itemJSON]; - return star; - } else if ([type isEqualToString:@"mm"]) { - NSString *name = itemJSON[@"nm"]; - NSLog(@"%s: Warning: merge shape is not supported. name: %@", __PRETTY_FUNCTION__, name); - } else if ([type isEqualToString:@"rp"]) { - LOTShapeRepeater *repeater = [[LOTShapeRepeater alloc] initWithJSON:itemJSON]; - return repeater; - } else { - NSString *name = itemJSON[@"nm"]; - NSLog(@"%s: Unsupported shape: %@ name: %@", __PRETTY_FUNCTION__, type, name); - } - - return nil; -} - -- (NSString *)description { - NSMutableString *text = [[super description] mutableCopy]; - [text appendFormat:@" items: %@", self.items]; - return text; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.h deleted file mode 100755 index c27e3dc..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// LOTShapePath.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -@interface LOTShapePath : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) BOOL closed; -@property (nonatomic, readonly) NSNumber *index; -@property (nonatomic, readonly) LOTKeyframeGroup *shapePath; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.m deleted file mode 100755 index b41be6a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapePath.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// LOTShapePath.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapePath.h" - -@implementation LOTShapePath - -- (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]; - } - - _index = jsonDictionary[@"ind"]; - _closed = [jsonDictionary[@"closed"] boolValue]; - NSDictionary *shape = jsonDictionary[@"ks"]; - if (shape) { - _shapePath = [[LOTKeyframeGroup alloc] initWithData:shape]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.h deleted file mode 100755 index 3845b7d..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LOTShapeRectangle.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -@interface LOTShapeRectangle : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) LOTKeyframeGroup *position; -@property (nonatomic, readonly) LOTKeyframeGroup *size; -@property (nonatomic, readonly) LOTKeyframeGroup *cornerRadius; -@property (nonatomic, readonly) BOOL reversed; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.m deleted file mode 100755 index ce05e06..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRectangle.m +++ /dev/null @@ -1,45 +0,0 @@ -// -// LOTShapeRectangle.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeRectangle.h" - -@implementation LOTShapeRectangle - -- (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 *position = jsonDictionary[@"p"]; - if (position) { - _position = [[LOTKeyframeGroup alloc] initWithData:position]; - } - - NSDictionary *cornerRadius = jsonDictionary[@"r"]; - if (cornerRadius) { - _cornerRadius = [[LOTKeyframeGroup alloc] initWithData:cornerRadius]; - } - - NSDictionary *size = jsonDictionary[@"s"]; - if (size) { - _size = [[LOTKeyframeGroup alloc] initWithData:size]; - } - NSNumber *reversed = jsonDictionary[@"d"]; - _reversed = (reversed.integerValue == 3); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.h deleted file mode 100755 index b557c5c..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// LOTShapeRepeater.h -// Lottie -// -// Created by brandon_withrow on 7/28/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTShapeRepeater : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *copies; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *offset; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *anchorPoint; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *scale; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *position; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *rotation; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *startOpacity; -@property (nonatomic, readonly, nullable) LOTKeyframeGroup *endOpacity; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.m deleted file mode 100755 index 467e5e8..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeRepeater.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// LOTShapeRepeater.m -// Lottie -// -// Created by brandon_withrow on 7/28/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTShapeRepeater.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTShapeRepeater - -- (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 *copies = jsonDictionary[@"c"]; - if (copies) { - _copies = [[LOTKeyframeGroup alloc] initWithData:copies]; - } - - NSDictionary *offset = jsonDictionary[@"o"]; - if (offset) { - _offset = [[LOTKeyframeGroup alloc] initWithData:offset]; - } - - NSDictionary *transform = jsonDictionary[@"tr"]; - - NSDictionary *rotation = transform[@"r"]; - if (rotation) { - _rotation = [[LOTKeyframeGroup alloc] initWithData:rotation]; - [_rotation remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_DegreesToRadians(inValue); - }]; - } - - NSDictionary *startOpacity = transform[@"so"]; - if (startOpacity) { - _startOpacity = [[LOTKeyframeGroup alloc] initWithData:startOpacity]; - [_startOpacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - NSDictionary *endOpacity = transform[@"eo"]; - if (endOpacity) { - _endOpacity = [[LOTKeyframeGroup alloc] initWithData:endOpacity]; - [_endOpacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - NSDictionary *anchorPoint = transform[@"a"]; - if (anchorPoint) { - _anchorPoint = [[LOTKeyframeGroup alloc] initWithData:anchorPoint]; - } - - NSDictionary *position = transform[@"p"]; - if (position) { - _position = [[LOTKeyframeGroup alloc] initWithData:position]; - } - - NSDictionary *scale = transform[@"s"]; - if (scale) { - _scale = [[LOTKeyframeGroup alloc] initWithData:scale]; - [_scale remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, -100, 100, -1, 1); - }]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.h deleted file mode 100755 index 5bbba0f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// LOTShapeStar.h -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -typedef enum : NSUInteger { - LOTPolystarShapeNone, - LOTPolystarShapeStar, - LOTPolystarShapePolygon -} LOTPolystarShape; - -@interface LOTShapeStar : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) LOTKeyframeGroup *outerRadius; -@property (nonatomic, readonly) LOTKeyframeGroup *outerRoundness; - -@property (nonatomic, readonly) LOTKeyframeGroup *innerRadius; -@property (nonatomic, readonly) LOTKeyframeGroup *innerRoundness; - -@property (nonatomic, readonly) LOTKeyframeGroup *position; -@property (nonatomic, readonly) LOTKeyframeGroup *numberOfPoints; -@property (nonatomic, readonly) LOTKeyframeGroup *rotation; - -@property (nonatomic, readonly) LOTPolystarShape type; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.m deleted file mode 100755 index db589e7..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStar.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// LOTShapeStar.m -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTShapeStar.h" - -@implementation LOTShapeStar - -- (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 *outerRadius = jsonDictionary[@"or"]; - if (outerRadius) { - _outerRadius = [[LOTKeyframeGroup alloc] initWithData:outerRadius]; - } - - NSDictionary *outerRoundness = jsonDictionary[@"os"]; - if (outerRoundness) { - _outerRoundness = [[LOTKeyframeGroup alloc] initWithData:outerRoundness]; - } - - NSDictionary *innerRadius = jsonDictionary[@"ir"]; - if (innerRadius) { - _innerRadius = [[LOTKeyframeGroup alloc] initWithData:innerRadius]; - } - - NSDictionary *innerRoundness = jsonDictionary[@"is"]; - if (innerRoundness) { - _innerRoundness = [[LOTKeyframeGroup alloc] initWithData:innerRoundness]; - } - - NSDictionary *position = jsonDictionary[@"p"]; - if (position) { - _position = [[LOTKeyframeGroup alloc] initWithData:position]; - } - - NSDictionary *numberOfPoints = jsonDictionary[@"pt"]; - if (numberOfPoints) { - _numberOfPoints = [[LOTKeyframeGroup alloc] initWithData:numberOfPoints]; - } - - NSDictionary *rotation = jsonDictionary[@"r"]; - if (rotation) { - _rotation = [[LOTKeyframeGroup alloc] initWithData:rotation]; - } - - NSNumber *type = jsonDictionary[@"sy"]; - _type = type.integerValue; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.h deleted file mode 100755 index 2d1ae6a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// LOTShapeStroke.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -typedef enum : NSUInteger { - LOTLineCapTypeButt, - LOTLineCapTypeRound, - LOTLineCapTypeUnknown -} LOTLineCapType; - -typedef enum : NSUInteger { - LOTLineJoinTypeMiter, - LOTLineJoinTypeRound, - LOTLineJoinTypeBevel -} LOTLineJoinType; - -@interface LOTShapeStroke : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) BOOL fillEnabled; -@property (nonatomic, readonly) LOTKeyframeGroup *color; -@property (nonatomic, readonly) LOTKeyframeGroup *opacity; -@property (nonatomic, readonly) LOTKeyframeGroup *width; -@property (nonatomic, readonly) LOTKeyframeGroup *dashOffset; -@property (nonatomic, readonly) LOTLineCapType capType; -@property (nonatomic, readonly) LOTLineJoinType joinType; - -@property (nonatomic, readonly) NSArray *lineDashPattern; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.m deleted file mode 100755 index 27ff544..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeStroke.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// LOTShapeStroke.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeStroke.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTShapeStroke - -- (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 *width = jsonDictionary[@"w"]; - if (width) { - _width = [[LOTKeyframeGroup alloc] initWithData:width]; - } - - NSDictionary *opacity = jsonDictionary[@"o"]; - if (opacity) { - _opacity = [[LOTKeyframeGroup alloc] initWithData:opacity]; - [_opacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - _capType = [jsonDictionary[@"lc"] integerValue] - 1; - _joinType = [jsonDictionary[@"lj"] integerValue] - 1; - - NSNumber *fillEnabled = jsonDictionary[@"fillEnabled"]; - _fillEnabled = fillEnabled.boolValue; - - NSDictionary *dashOffset = nil; - NSArray *dashes = jsonDictionary[@"d"]; - if (dashes) { - NSMutableArray *dashPattern = [NSMutableArray array]; - for (NSDictionary *dash in dashes) { - if ([dash[@"n"] isEqualToString:@"o"]) { - dashOffset = dash[@"v"]; - continue; - } - // TODO DASH PATTERNS - NSDictionary *value = dash[@"v"]; - LOTKeyframeGroup *keyframeGroup = [[LOTKeyframeGroup alloc] initWithData:value]; - [dashPattern addObject:keyframeGroup]; - } - _lineDashPattern = dashPattern; - } - if (dashOffset) { - _dashOffset = [[LOTKeyframeGroup alloc] initWithData:dashOffset]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.h deleted file mode 100755 index 8bde1ad..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// LOTShapeTransform.h -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import -#import -#import -#import "LOTKeyframe.h" - -@interface LOTShapeTransform : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) LOTKeyframeGroup *position; -@property (nonatomic, readonly) LOTKeyframeGroup *anchor; -@property (nonatomic, readonly) LOTKeyframeGroup *scale; -@property (nonatomic, readonly) LOTKeyframeGroup *rotation; -@property (nonatomic, readonly) LOTKeyframeGroup *opacity; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.m deleted file mode 100755 index 561d9de..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTransform.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// LOTShapeTransform.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/15/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeTransform.h" -#import "LOTHelpers.h" - -@implementation LOTShapeTransform - -- (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 *position = jsonDictionary[@"p"]; - if (position) { - _position = [[LOTKeyframeGroup alloc] initWithData:position]; - } - - NSDictionary *anchor = jsonDictionary[@"a"]; - if (anchor) { - _anchor = [[LOTKeyframeGroup alloc] initWithData:anchor]; - } - - NSDictionary *scale = jsonDictionary[@"s"]; - if (scale) { - _scale = [[LOTKeyframeGroup alloc] initWithData:scale]; - [_scale remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, -100, 100, -1, 1); - }]; - } - - NSDictionary *rotation = jsonDictionary[@"r"]; - if (rotation) { - _rotation = [[LOTKeyframeGroup alloc] initWithData:rotation]; - [_rotation remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_DegreesToRadians(inValue); - }]; - } - - NSDictionary *opacity = jsonDictionary[@"o"]; - if (opacity) { - _opacity = [[LOTKeyframeGroup alloc] initWithData:opacity]; - [_opacity remapKeyframesWithBlock:^CGFloat(CGFloat inValue) { - return LOT_RemapValue(inValue, 0, 100, 0, 1); - }]; - } - - NSString *name = jsonDictionary[@"nm"]; - - NSDictionary *skew = jsonDictionary[@"sk"]; - BOOL hasSkew = (skew && [skew[@"k"] isEqual:@0] == NO); - NSDictionary *skewAxis = jsonDictionary[@"sa"]; - BOOL hasSkewAxis = (skewAxis && [skewAxis[@"k"] isEqual:@0] == NO); - - if (hasSkew || hasSkewAxis) { - NSLog(@"%s: Warning: skew is not supported: %@", __PRETTY_FUNCTION__, name); - } -} - -- (NSString *)description { - return [NSString stringWithFormat:@"LOTShapeTransform \"Position: %@ Anchor: %@ Scale: %@ Rotation: %@ Opacity: %@\"", _position.description, _anchor.description, _scale.description, _rotation.description, _opacity.description]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.h b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.h deleted file mode 100755 index b124890..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// LOTShapeTrimPath.h -// LottieAnimator -// -// Created by brandon_withrow on 7/26/16. -// Copyright © 2016 Brandon Withrow. All rights reserved. -// - -#import -#import "LOTKeyframe.h" - -@interface LOTShapeTrimPath : NSObject - -- (instancetype)initWithJSON:(NSDictionary *)jsonDictionary; - -@property (nonatomic, readonly) NSString *keyname; -@property (nonatomic, readonly) LOTKeyframeGroup *start; -@property (nonatomic, readonly) LOTKeyframeGroup *end; -@property (nonatomic, readonly) LOTKeyframeGroup *offset; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.m b/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.m deleted file mode 100755 index 8bef724..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Models/LOTShapeTrimPath.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// LOTShapeTrimPath.m -// LottieAnimator -// -// Created by brandon_withrow on 7/26/16. -// Copyright © 2016 Brandon Withrow. All rights reserved. -// - -#import "LOTShapeTrimPath.h" - -@implementation LOTShapeTrimPath - -- (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 *start = jsonDictionary[@"s"]; - if (start) { - _start = [[LOTKeyframeGroup alloc] initWithData:start]; - } - - NSDictionary *end = jsonDictionary[@"e"]; - if (end) { - _end = [[LOTKeyframeGroup alloc] initWithData:end]; - } - - NSDictionary *offset = jsonDictionary[@"o"]; - if (offset) { - _offset = [[LOTKeyframeGroup alloc] initWithData:offset]; - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedControl.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedControl.m deleted file mode 100755 index 7d5efbf..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedControl.m +++ /dev/null @@ -1,140 +0,0 @@ -// -// LOTAnimatedControl.m -// Lottie -// -// Created by brandon_withrow on 8/25/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatedControl.h" -#import "LOTAnimationView_Internal.h" - -@implementation LOTAnimatedControl { - UIControlState _priorState; - NSMutableDictionary *_layerMap; -} - -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - [self _commonInit]; - } - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - [self _commonInit]; - } - return self; -} - -- (void)_commonInit { - _animationView = [[LOTAnimationView alloc] init]; - _animationView.contentMode = UIViewContentModeScaleAspectFit; - _animationView.userInteractionEnabled = NO; - [self addSubview:_animationView]; - _layerMap = [NSMutableDictionary dictionary]; -} - -- (LOTComposition *)animationComp { - return _animationView.sceneModel; -} - -- (void)setAnimationComp:(LOTComposition *)animationComp { - [_animationView setSceneModel:animationComp]; - [self checkStateChangedAndUpdate:YES]; -} - -- (void)setLayerName:(NSString * _Nonnull)layerName forState:(UIControlState)state { - _layerMap[@(state)] = layerName; - [self checkStateChangedAndUpdate:YES]; -} - -#pragma mark - Setter Overrides - -- (void)setEnabled:(BOOL)enabled { - _priorState = self.state; - [super setEnabled:enabled]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)setSelected:(BOOL)selected { - _priorState = self.state; - [super setSelected:selected]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)setHighlighted:(BOOL)highlighted { - _priorState = self.state; - [super setHighlighted:highlighted]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - _priorState = self.state; - [super touchesBegan:touches withEvent:event]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - _priorState = self.state; - [super touchesMoved:touches withEvent:event]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - _priorState = self.state; - [super touchesEnded:touches withEvent:event]; - [self checkStateChangedAndUpdate:NO]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - _priorState = self.state; - [super touchesCancelled:touches withEvent:event]; - [self checkStateChangedAndUpdate:NO]; -} - -- (CGSize)intrinsicContentSize { - return _animationView.intrinsicContentSize; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - _animationView.frame = self.bounds; -} - -- (UIAccessibilityTraits)accessibilityTraits { - return UIAccessibilityTraitButton; -} - -- (BOOL)isAccessibilityElement -{ - return YES; -} - -#pragma mark - Private interface implementation - -- (void)checkStateChangedAndUpdate:(BOOL)forceUpdate { - if (self.state == _priorState && !forceUpdate) { - return; - } - _priorState = self.state; - - NSString *name = _layerMap[@(self.state)]; - if (!name) { - return; - } - CALayer *layer = [_animationView layerForKey:name]; - if (!layer) { - return; - } - - for (CALayer *child in [_animationView compositionLayers]) { - child.hidden = YES; - } - layer.hidden = NO; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedSwitch.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedSwitch.m deleted file mode 100755 index b6e3b23..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimatedSwitch.m +++ /dev/null @@ -1,199 +0,0 @@ -// -// LOTAnimatedSwitch.m -// Lottie -// -// Created by brandon_withrow on 8/25/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatedSwitch.h" -#import "LOTAnimationView.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTAnimatedSwitch { - CGFloat _onStartProgress; - CGFloat _onEndProgress; - CGFloat _offStartProgress; - CGFloat _offEndProgress; - CGPoint _touchTrackingStart; - BOOL _on; - BOOL _suppressToggle; - BOOL _toggleToState; -} - -/// Convenience method to initialize a control from the Main Bundle by name -+ (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName { - return [self switchNamed:toggleName inBundle:[NSBundle mainBundle]]; -} - -/// Convenience method to initialize a control from the specified bundle by name -+ (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName inBundle:(NSBundle * _Nonnull)bundle { - LOTComposition *composition = [LOTComposition animationNamed:toggleName inBundle:bundle]; - LOTAnimatedSwitch *animatedControl = [[self alloc] initWithFrame:CGRectZero]; - if (composition) { - [animatedControl setAnimationComp:composition]; - animatedControl.bounds = composition.compBounds; - } - return animatedControl; -} - -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - self.accessibilityHint = NSLocalizedString(@"Double tap to toggle setting.", @"Double tap to toggle setting."); - _onStartProgress = 0; - _onEndProgress = 1; - _offStartProgress = 1; - _offEndProgress = 0; - _on = NO; - [self addTarget:self action:@selector(_toggle) forControlEvents:UIControlEventTouchUpInside]; - } - return self; -} - -- (void)setAnimationComp:(LOTComposition *)animationComp { - [super setAnimationComp:animationComp]; - [self setOn:_on animated:NO]; -} - -#pragma mark - External Methods - -- (void)setProgressRangeForOnState:(CGFloat)fromProgress toProgress:(CGFloat)toProgress { - _onStartProgress = fromProgress; - _onEndProgress = toProgress; - [self setOn:_on animated:NO]; -} - -- (void)setProgressRangeForOffState:(CGFloat)fromProgress toProgress:(CGFloat)toProgress { - _offStartProgress = fromProgress; - _offEndProgress = toProgress; - [self setOn:_on animated:NO]; -} - -- (void)setOn:(BOOL)on { - [self setOn:on animated:NO]; -} - -- (void)setOn:(BOOL)on animated:(BOOL)animated { - _on = on; - - CGFloat startProgress = on ? _onStartProgress : _offStartProgress; - CGFloat endProgress = on ? _onEndProgress : _offEndProgress; - CGFloat finalProgress = endProgress; - if (self.animationView.animationProgress < MIN(startProgress, endProgress) || - self.animationView.animationProgress > MAX(startProgress, endProgress)) { - if (self.animationView.animationProgress != (!_on ? _onEndProgress : _offEndProgress)) { - // Current progress is in the wrong timeline. Switch. - endProgress = on ? _offStartProgress : _onStartProgress; - startProgress = on ? _offEndProgress : _onEndProgress; - } - } - - if (finalProgress == self.animationView.animationProgress) { - return; - } - - if (animated) { - [self.animationView pause]; - [self.animationView playFromProgress:startProgress toProgress:endProgress withCompletion:^(BOOL animationFinished) { - if (animationFinished) { - self.animationView.animationProgress = finalProgress; - } - }]; - } else { - self.animationView.animationProgress = endProgress; - } -} - -- (NSString *)accessibilityValue { - return self.isOn ? NSLocalizedString(@"On", @"On") : NSLocalizedString(@"Off", @"Off"); -} - -#pragma mark - Internal Methods - -- (void)_toggle { - if (!_suppressToggle) { - [self _toggleAndSendActions]; - } -} - -- (void)_toggleAndSendActions { - if (self.isEnabled) { - #ifndef TARGET_OS_TV - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) { - UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight]; - [generator impactOccurred]; - } - #endif - [self setOn:!_on animated:YES]; - [self sendActionsForControlEvents:UIControlEventValueChanged]; - } -} - -- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { - [super beginTrackingWithTouch:touch withEvent:event]; - _suppressToggle = NO; - _touchTrackingStart = [touch locationInView:self]; - return YES; -} - -- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { - BOOL superContinue = [super continueTrackingWithTouch:touch withEvent:event]; - if (!_interactiveGesture) { - return superContinue; - } - CGPoint location = [touch locationInView:self]; - CGFloat diff = location.x - _touchTrackingStart.x; - if (LOT_PointDistanceFromPoint(_touchTrackingStart, location) > self.bounds.size.width * 0.25) { - // The touch has moved enough to register as its own gesture. Suppress the touch up toggle. - _suppressToggle = YES; - } -#ifdef __IPHONE_11_0 - // Xcode 9+ - if (@available(iOS 9.0, *)) { -#else - // Xcode 8- - if ([UIView respondsToSelector:@selector(userInterfaceLayoutDirectionForSemanticContentAttribute:)]) { -#endif - if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft) { - diff = diff * -1; - } - } - if (_on) { - diff = diff * -1; - if (diff <= 0) { - self.animationView.animationProgress = _onEndProgress; - _toggleToState = YES; - } else { - diff = MAX(MIN(self.bounds.size.width, diff), 0); - self.animationView.animationProgress = LOT_RemapValue(diff, 0, self.bounds.size.width, _offStartProgress, _offEndProgress); - _toggleToState = (diff / self.bounds.size.width) > 0.5 ? NO : YES; - } - } else { - if (diff <= 0) { - self.animationView.animationProgress = _offEndProgress; - _toggleToState = NO; - } else { - diff = MAX(MIN(self.bounds.size.width, diff), 0); - self.animationView.animationProgress = LOT_RemapValue(diff, 0, self.bounds.size.width, _onStartProgress, _onEndProgress); - _toggleToState = (diff / self.bounds.size.width) > 0.5 ? YES : NO; - } - } - return YES; -} - -- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { - [super endTrackingWithTouch:touch withEvent:event]; - if (!_interactiveGesture) { - return; - } - if (_suppressToggle) { - if (_toggleToState != _on) { - [self _toggleAndSendActions]; - } else { - [self setOn:_toggleToState animated:YES]; - } - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationCache.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationCache.m deleted file mode 100755 index 2d8a460..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationCache.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// LOTAnimationCache.m -// Lottie -// -// Created by Brandon Withrow on 1/9/17. -// Copyright © 2017 Brandon Withrow. All rights reserved. -// - -#import "LOTAnimationCache.h" - -const NSInteger kLOTCacheSize = 50; - -@implementation LOTAnimationCache { - NSMutableDictionary *animationsCache_; - NSMutableArray *lruOrderArray_; -} - -+ (instancetype)sharedCache { - static LOTAnimationCache *sharedCache = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedCache = [[self alloc] init]; - }); - return sharedCache; -} - -- (instancetype)init { - self = [super init]; - if (self) { - animationsCache_ = [[NSMutableDictionary alloc] init]; - lruOrderArray_ = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)addAnimation:(LOTComposition *)animation forKey:(NSString *)key { - if (lruOrderArray_.count >= kLOTCacheSize) { - NSString *oldKey = lruOrderArray_[0]; - [animationsCache_ removeObjectForKey:oldKey]; - [lruOrderArray_ removeObject:oldKey]; - } - [lruOrderArray_ removeObject:key]; - [lruOrderArray_ addObject:key]; - [animationsCache_ setObject:animation forKey:key]; -} - -- (LOTComposition *)animationForKey:(NSString *)key { - if (!key) { - return nil; - } - LOTComposition *animation = [animationsCache_ objectForKey:key]; - [lruOrderArray_ removeObject:key]; - [lruOrderArray_ addObject:key]; - return animation; -} - -- (void)clearCache { - [animationsCache_ removeAllObjects]; - [lruOrderArray_ removeAllObjects]; -} - -- (void)removeAnimationForKey:(NSString *)key { - [lruOrderArray_ removeObject:key]; - [animationsCache_ removeObjectForKey:key]; -} - -- (void)disableCaching { - [self clearCache]; - animationsCache_ = nil; - lruOrderArray_ = nil; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationTransitionController.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationTransitionController.m deleted file mode 100755 index b9586c4..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationTransitionController.m +++ /dev/null @@ -1,127 +0,0 @@ -// -// LOTAnimationTransitionController.m -// Lottie -// -// Created by Brandon Withrow on 1/18/17. -// Copyright © 2017 Brandon Withrow. All rights reserved. -// - -#import "LOTAnimationTransitionController.h" -#import "LOTAnimationView.h" - -@implementation LOTAnimationTransitionController { - LOTAnimationView *tranistionAnimationView_; - NSString *fromLayerName_; - NSString *toLayerName_; - NSBundle *inBundle_; - BOOL _applyTransform; -} - -- (nonnull instancetype)initWithAnimationNamed:(nonnull NSString *)animation - fromLayerNamed:(nullable NSString *)fromLayer - toLayerNamed:(nullable NSString *)toLayer - applyAnimationTransform:(BOOL)applyAnimationTransform { - - return [self initWithAnimationNamed:animation - fromLayerNamed:fromLayer - toLayerNamed:toLayer - applyAnimationTransform:applyAnimationTransform - inBundle:[NSBundle mainBundle]]; -} - -- (instancetype)initWithAnimationNamed:(NSString *)animation - fromLayerNamed:(NSString *)fromLayer - toLayerNamed:(NSString *)toLayer - applyAnimationTransform:(BOOL)applyAnimationTransform - inBundle:(NSBundle *)bundle { - self = [super init]; - if (self) { - tranistionAnimationView_ = [LOTAnimationView animationNamed:animation inBundle:bundle]; - fromLayerName_ = fromLayer; - toLayerName_ = toLayer; - _applyTransform = applyAnimationTransform; - } - return self; -} - -- (NSTimeInterval)transitionDuration:(id)transitionContext { - return tranistionAnimationView_.animationDuration; -} - -- (void)animateTransition:(id)transitionContext { - UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; - UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; - UIView *containerView = transitionContext.containerView; - - UIView *toSnapshot = [toVC.view resizableSnapshotViewFromRect:containerView.bounds - afterScreenUpdates:YES - withCapInsets:UIEdgeInsetsZero]; - toSnapshot.frame = containerView.bounds; - - UIView *fromSnapshot = [fromVC.view resizableSnapshotViewFromRect:containerView.bounds - afterScreenUpdates:NO - withCapInsets:UIEdgeInsetsZero]; - fromSnapshot.frame = containerView.bounds; - - tranistionAnimationView_.frame = containerView.bounds; - tranistionAnimationView_.contentMode = UIViewContentModeScaleAspectFill; - [containerView addSubview:tranistionAnimationView_]; - - BOOL crossFadeViews = NO; - - if (toLayerName_.length) { - LOTKeypath *toKeypath = [LOTKeypath keypathWithString:toLayerName_]; - CGRect convertedBounds = [tranistionAnimationView_ convertRect:containerView.bounds toKeypathLayer:toKeypath]; - toSnapshot.frame = convertedBounds; - if (_applyTransform) { - [tranistionAnimationView_ addSubview:toSnapshot toKeypathLayer:toKeypath]; - } else { - [tranistionAnimationView_ maskSubview:toSnapshot toKeypathLayer:toKeypath]; - } - } else { - [containerView addSubview:toSnapshot]; - [containerView sendSubviewToBack:toSnapshot]; - toSnapshot.alpha = 0; - crossFadeViews = YES; - } - - if (fromLayerName_.length) { - LOTKeypath *fromKeypath = [LOTKeypath keypathWithString:fromLayerName_]; - CGRect convertedBounds = [tranistionAnimationView_ convertRect:containerView.bounds fromKeypathLayer:fromKeypath]; - fromSnapshot.frame = convertedBounds; - if (_applyTransform) { - [tranistionAnimationView_ addSubview:fromSnapshot toKeypathLayer:fromKeypath]; - } else { - [tranistionAnimationView_ maskSubview:fromSnapshot toKeypathLayer:fromKeypath]; - } - } else { - [containerView addSubview:fromSnapshot]; - [containerView sendSubviewToBack:fromSnapshot]; - } - - [containerView addSubview:toVC.view]; - toVC.view.hidden = YES; - - if (crossFadeViews) { - CGFloat duration = tranistionAnimationView_.animationDuration * 0.25; - CGFloat delay = (tranistionAnimationView_.animationDuration - duration) / 2.f; - - [UIView animateWithDuration:duration - delay:delay - options:(UIViewAnimationOptionCurveEaseInOut) - animations:^{ - toSnapshot.alpha = 1; - } completion:^(BOOL finished) { - - }]; - } - - [tranistionAnimationView_ playWithCompletion:^(BOOL animationFinished) { - toVC.view.hidden = false; - [tranistionAnimationView_ removeFromSuperview]; - [transitionContext completeTransition:animationFinished]; - }]; -} - -@end - diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView.m deleted file mode 100755 index 77e1a1d..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView.m +++ /dev/null @@ -1,756 +0,0 @@ -// -// LOTAnimationView -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTAnimationView.h" -#import "LOTPlatformCompat.h" -#import "LOTModels.h" -#import "LOTHelpers.h" -#import "LOTAnimationView_Internal.h" -#import "LOTAnimationCache.h" -#import "LOTCompositionContainer.h" - -static NSString * const kCompContainerAnimationKey = @"play"; - -@implementation LOTAnimationView { - LOTCompositionContainer *_compContainer; - NSNumber *_playRangeStartFrame; - NSNumber *_playRangeEndFrame; - CGFloat _playRangeStartProgress; - CGFloat _playRangeEndProgress; - NSBundle *_bundle; - CGFloat _animationProgress; - // Properties for tracking automatic restoration of animation. - BOOL _shouldRestoreStateWhenAttachedToWindow; - LOTAnimationCompletionBlock _completionBlockToRestoreWhenAttachedToWindow; -} - -# pragma mark - Convenience Initializers - -+ (nonnull instancetype)animationNamed:(nonnull NSString *)animationName { - return [self animationNamed:animationName inBundle:[NSBundle mainBundle]]; -} - -+ (nonnull instancetype)animationNamed:(nonnull NSString *)animationName inBundle:(nonnull NSBundle *)bundle { - LOTComposition *comp = [LOTComposition animationNamed:animationName inBundle:bundle]; - return [[self alloc] initWithModel:comp inBundle:bundle]; -} - -+ (nonnull instancetype)animationFromJSON:(nonnull NSDictionary *)animationJSON { - return [self animationFromJSON:animationJSON inBundle:[NSBundle mainBundle]]; -} - -+ (nonnull instancetype)animationFromJSON:(nullable NSDictionary *)animationJSON inBundle:(nullable NSBundle *)bundle { - LOTComposition *comp = [LOTComposition animationFromJSON:animationJSON inBundle:bundle]; - return [[self alloc] initWithModel:comp inBundle:bundle]; -} - -+ (nonnull instancetype)animationWithFilePath:(nonnull NSString *)filePath { - LOTComposition *comp = [LOTComposition animationWithFilePath:filePath]; - return [[self alloc] initWithModel:comp inBundle:[NSBundle mainBundle]]; -} - -# pragma mark - Initializers - -- (instancetype)initWithContentsOfURL:(NSURL *)url { - self = [super initWithFrame:CGRectZero]; - if (self) { - [self _commonInit]; - LOTComposition *laScene = [[LOTAnimationCache sharedCache] animationForKey:url.absoluteString]; - if (laScene) { - laScene.cacheKey = url.absoluteString; - [self _initializeAnimationContainer]; - [self _setupWithSceneModel:laScene]; - } else { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { - NSData *animationData = [NSData dataWithContentsOfURL:url]; - if (!animationData) { - return; - } - NSError *error; - NSDictionary *animationJSON = [NSJSONSerialization JSONObjectWithData:animationData - options:0 error:&error]; - if (error || !animationJSON) { - return; - } - - LOTComposition *laScene = [[LOTComposition alloc] initWithJSON:animationJSON withAssetBundle:[NSBundle mainBundle]]; - dispatch_async(dispatch_get_main_queue(), ^(void) { - [[LOTAnimationCache sharedCache] addAnimation:laScene forKey:url.absoluteString]; - laScene.cacheKey = url.absoluteString; - [self _initializeAnimationContainer]; - [self _setupWithSceneModel:laScene]; - }); - }); - } - } - return self; -} - -- (instancetype)initWithModel:(LOTComposition *)model inBundle:(NSBundle *)bundle { - self = [super initWithFrame:model.compBounds]; - if (self) { - _bundle = bundle; - [self _commonInit]; - [self _initializeAnimationContainer]; - [self _setupWithSceneModel:model]; - } - return self; -} - -- (instancetype)init { - self = [super init]; - if (self) { - [self _commonInit]; - } - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)coder { - self = [super initWithCoder:coder]; - if (self) { - [self _commonInit]; - } - return self; -} - -# pragma mark - Internal Methods - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -- (void)_initializeAnimationContainer { - self.clipsToBounds = YES; -} - -#else - -- (void)_initializeAnimationContainer { - self.wantsLayer = YES; -} - -#endif - -- (void)_commonInit { - _animationSpeed = 1; - _animationProgress = 0; - _loopAnimation = NO; - _autoReverseAnimation = NO; - _playRangeEndFrame = nil; - _playRangeStartFrame = nil; - _playRangeEndProgress = 0; - _playRangeStartProgress = 0; -} - -- (void)_setupWithSceneModel:(LOTComposition *)model { - if (_sceneModel) { - [self _removeCurrentAnimationIfNecessary]; - [self _callCompletionIfNecessary:NO]; - [_compContainer removeFromSuperlayer]; - _compContainer = nil; - _sceneModel = nil; - [self _commonInit]; - } - - _sceneModel = model; - _compContainer = [[LOTCompositionContainer alloc] initWithModel:nil inLayerGroup:nil withLayerGroup:_sceneModel.layerGroup withAssestGroup:_sceneModel.assetGroup]; - [self.layer addSublayer:_compContainer]; - [self _restoreState]; - [self setNeedsLayout]; -} - -- (void)_restoreState { - if (_isAnimationPlaying) { - _isAnimationPlaying = NO; - if (_playRangeStartFrame && _playRangeEndFrame) { - [self playFromFrame:_playRangeStartFrame toFrame:_playRangeEndFrame withCompletion:self.completionBlock]; - } else if (_playRangeEndProgress != _playRangeStartProgress) { - [self playFromProgress:_playRangeStartProgress toProgress:_playRangeEndProgress withCompletion:self.completionBlock]; - } else { - [self playWithCompletion:self.completionBlock]; - } - } else { - self.animationProgress = _animationProgress; - } -} - -- (void)_removeCurrentAnimationIfNecessary { - _isAnimationPlaying = NO; - [_compContainer removeAllAnimations]; -} - -- (CGFloat)_progressForFrame:(NSNumber *)frame { - if (!_sceneModel) { - return 0; - } - return ((frame.floatValue - _sceneModel.startFrame.floatValue) / (_sceneModel.endFrame.floatValue - _sceneModel.startFrame.floatValue)); -} - -- (NSNumber *)_frameForProgress:(CGFloat)progress { - if (!_sceneModel) { - return @0; - } - return @(((_sceneModel.endFrame.floatValue - _sceneModel.startFrame.floatValue) * progress) + _sceneModel.startFrame.floatValue); -} - -- (BOOL)_isSpeedNegative { - // If the animation speed is negative, then we're moving backwards. - return _animationSpeed >= 0; -} - -# pragma mark - Completion Block - -- (void)_callCompletionIfNecessary:(BOOL)complete { - if (self.completionBlock) { - LOTAnimationCompletionBlock completion = self.completionBlock; - self.completionBlock = nil; - completion(complete); - } -} - -# pragma mark - External Methods - -- (void)setAnimationNamed:(nonnull NSString *)animationName { - LOTComposition *comp = [LOTComposition animationNamed:animationName]; - - [self _initializeAnimationContainer]; - [self _setupWithSceneModel:comp]; -} - -# pragma mark - External Methods - Model - -- (void)setSceneModel:(LOTComposition *)sceneModel { - [self _setupWithSceneModel:sceneModel]; -} - -# pragma mark - External Methods - Play Control - -- (void)play { - if (!_sceneModel) { - _isAnimationPlaying = YES; - return; - } - [self playFromFrame:_sceneModel.startFrame toFrame:_sceneModel.endFrame withCompletion:nil]; -} - -- (void)playWithCompletion:(LOTAnimationCompletionBlock)completion { - if (!_sceneModel) { - _isAnimationPlaying = YES; - self.completionBlock = completion; - return; - } - [self playFromFrame:_sceneModel.startFrame toFrame:_sceneModel.endFrame withCompletion:completion]; -} - -- (void)playToProgress:(CGFloat)progress withCompletion:(nullable LOTAnimationCompletionBlock)completion { - [self playFromProgress:0 toProgress:progress withCompletion:completion]; -} - -- (void)playFromProgress:(CGFloat)fromStartProgress - toProgress:(CGFloat)toEndProgress - withCompletion:(nullable LOTAnimationCompletionBlock)completion { - if (!_sceneModel) { - _isAnimationPlaying = YES; - self.completionBlock = completion; - _playRangeStartProgress = fromStartProgress; - _playRangeEndProgress = toEndProgress; - return; - } - [self playFromFrame:[self _frameForProgress:fromStartProgress] - toFrame:[self _frameForProgress:toEndProgress] - withCompletion:completion]; -} - -- (void)playToFrame:(nonnull NSNumber *)toFrame - withCompletion:(nullable LOTAnimationCompletionBlock)completion { - [self playFromFrame:_sceneModel.startFrame toFrame:toFrame withCompletion:completion]; -} - -- (void)playFromFrame:(nonnull NSNumber *)fromStartFrame - toFrame:(nonnull NSNumber *)toEndFrame - withCompletion:(nullable LOTAnimationCompletionBlock)completion { - if (_isAnimationPlaying) { - return; - } - _playRangeStartFrame = fromStartFrame; - _playRangeEndFrame = toEndFrame; - if (completion) { - self.completionBlock = completion; - } - if (!_sceneModel) { - _isAnimationPlaying = YES; - return; - } - - BOOL playingForward = ((_animationSpeed > 0) && (toEndFrame.floatValue > fromStartFrame.floatValue)) - || ((_animationSpeed < 0) && (fromStartFrame.floatValue > toEndFrame.floatValue)); - - CGFloat leftFrameValue = MIN(fromStartFrame.floatValue, toEndFrame.floatValue); - CGFloat rightFrameValue = MAX(fromStartFrame.floatValue, toEndFrame.floatValue); - - NSNumber *currentFrame = [self _frameForProgress:_animationProgress]; - - currentFrame = @(MAX(MIN(currentFrame.floatValue, rightFrameValue), leftFrameValue)); - - if (currentFrame.floatValue == rightFrameValue && playingForward) { - currentFrame = @(leftFrameValue); - } else if (currentFrame.floatValue == leftFrameValue && !playingForward) { - currentFrame = @(rightFrameValue); - } - _animationProgress = [self _progressForFrame:currentFrame]; - - CGFloat currentProgress = _animationProgress * (_sceneModel.endFrame.floatValue - _sceneModel.startFrame.floatValue); - CGFloat skipProgress; - if (playingForward) { - skipProgress = currentProgress - leftFrameValue; - } else { - skipProgress = rightFrameValue - currentProgress; - } - NSTimeInterval offset = MAX(0, skipProgress) / _sceneModel.framerate.floatValue; - if (!self.window) { - _shouldRestoreStateWhenAttachedToWindow = YES; - _completionBlockToRestoreWhenAttachedToWindow = self.completionBlock; - self.completionBlock = nil; - } else { - NSTimeInterval duration = (ABS(toEndFrame.floatValue - fromStartFrame.floatValue) / _sceneModel.framerate.floatValue); - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"currentFrame"]; - animation.speed = _animationSpeed; - animation.fromValue = fromStartFrame; - animation.toValue = toEndFrame; - animation.duration = duration; - animation.fillMode = kCAFillModeBoth; - animation.repeatCount = _loopAnimation ? HUGE_VALF : 1; - animation.autoreverses = _autoReverseAnimation; - animation.delegate = self; - animation.removedOnCompletion = NO; - if (offset != 0) { - animation.beginTime = CACurrentMediaTime() - (offset * 1 / _animationSpeed); - } - [_compContainer addAnimation:animation forKey:kCompContainerAnimationKey]; - } - _isAnimationPlaying = YES; -} - -#pragma mark - Other Time Controls - -- (void)stop { - _isAnimationPlaying = NO; - if (_sceneModel) { - [self setProgressWithFrame:_sceneModel.startFrame callCompletionIfNecessary:YES]; - } -} - -- (void)pause { - if (!_sceneModel || - !_isAnimationPlaying) { - _isAnimationPlaying = NO; - return; - } - NSNumber *frame = [_compContainer.presentationLayer.currentFrame copy]; - [self setProgressWithFrame:frame callCompletionIfNecessary:YES]; -} - -- (void)setAnimationProgress:(CGFloat)animationProgress { - if (!_sceneModel) { - _animationProgress = animationProgress; - return; - } - [self setProgressWithFrame:[self _frameForProgress:animationProgress] callCompletionIfNecessary:YES]; -} - -- (void)setProgressWithFrame:(nonnull NSNumber *)currentFrame { - [self setProgressWithFrame:currentFrame callCompletionIfNecessary:YES]; -} - -- (void)setProgressWithFrame:(nonnull NSNumber *)currentFrame callCompletionIfNecessary:(BOOL)callCompletion { - [self _removeCurrentAnimationIfNecessary]; - - if (_shouldRestoreStateWhenAttachedToWindow) { - _shouldRestoreStateWhenAttachedToWindow = NO; - - self.completionBlock = _completionBlockToRestoreWhenAttachedToWindow; - _completionBlockToRestoreWhenAttachedToWindow = nil; - } - - _animationProgress = [self _progressForFrame:currentFrame]; - - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - _compContainer.currentFrame = currentFrame; - [_compContainer setNeedsDisplay]; - [CATransaction commit]; - if (callCompletion) { - [self _callCompletionIfNecessary:NO]; - } -} - -- (void)setLoopAnimation:(BOOL)loopAnimation { - _loopAnimation = loopAnimation; - if (_isAnimationPlaying && _sceneModel) { - NSNumber *frame = [_compContainer.presentationLayer.currentFrame copy]; - [self setProgressWithFrame:frame callCompletionIfNecessary:NO]; - [self playFromFrame:_playRangeStartFrame toFrame:_playRangeEndFrame withCompletion:self.completionBlock]; - } -} - -- (void)setAnimationSpeed:(CGFloat)animationSpeed { - _animationSpeed = animationSpeed; - if (_isAnimationPlaying && _sceneModel) { - NSNumber *frame = [_compContainer.presentationLayer.currentFrame copy]; - [self setProgressWithFrame:frame callCompletionIfNecessary:NO]; - [self playFromFrame:_playRangeStartFrame toFrame:_playRangeEndFrame withCompletion:self.completionBlock]; - } -} - -- (void)forceDrawingUpdate { - [self _layoutAndForceUpdate]; -} - -# pragma mark - External Methods - Cache - -- (void)setCacheEnable:(BOOL)cacheEnable { - _cacheEnable = cacheEnable; - if (!self.sceneModel.cacheKey) { - return; - } - if (cacheEnable) { - [[LOTAnimationCache sharedCache] addAnimation:_sceneModel forKey:self.sceneModel.cacheKey]; - } else { - [[LOTAnimationCache sharedCache] removeAnimationForKey:self.sceneModel.cacheKey]; - } -} - -# pragma mark - External Methods - Interactive Controls - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath { - [_compContainer setValueDelegate:delegate forKeypath:keypath]; - [self _layoutAndForceUpdate]; -} - -- (nullable NSArray *)keysForKeyPath:(nonnull LOTKeypath *)keypath { - return [_compContainer keysForKeyPath:keypath]; -} - -- (CGPoint)convertPoint:(CGPoint)point - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - return [_compContainer convertPoint:point toKeypathLayer:keypath withParentLayer:self.layer]; -} - -- (CGRect)convertRect:(CGRect)rect - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - return [_compContainer convertRect:rect toKeypathLayer:keypath withParentLayer:self.layer]; -} - -- (CGPoint)convertPoint:(CGPoint)point - fromKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - return [_compContainer convertPoint:point fromKeypathLayer:keypath withParentLayer:self.layer]; -} - -- (CGRect)convertRect:(CGRect)rect - fromKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - return [_compContainer convertRect:rect fromKeypathLayer:keypath withParentLayer:self.layer]; -} - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -- (void)addSubview:(nonnull LOTView *)view - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - CGRect viewRect = view.frame; - LOTView *wrapperView = [[LOTView alloc] initWithFrame:viewRect]; - view.frame = view.bounds; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [wrapperView addSubview:view]; - [self addSubview:wrapperView]; - [_compContainer addSublayer:wrapperView.layer toKeypathLayer:keypath]; -} - -- (void)maskSubview:(nonnull LOTView *)view - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layoutAndForceUpdate]; - CGRect viewRect = view.frame; - LOTView *wrapperView = [[LOTView alloc] initWithFrame:viewRect]; - view.frame = view.bounds; - view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [wrapperView addSubview:view]; - [self addSubview:wrapperView]; - [_compContainer maskSublayer:wrapperView.layer toKeypathLayer:keypath]; -} - - -#else - -- (void)addSubview:(nonnull LOTView *)view - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layout]; - CGRect viewRect = view.frame; - LOTView *wrapperView = [[LOTView alloc] initWithFrame:viewRect]; - view.frame = view.bounds; - view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - [wrapperView addSubview:view]; - [self addSubview:wrapperView]; - [_compContainer addSublayer:wrapperView.layer toKeypathLayer:keypath]; -} - -- (void)maskSubview:(nonnull LOTView *)view - toKeypathLayer:(nonnull LOTKeypath *)keypath { - [self _layout]; - CGRect viewRect = view.frame; - LOTView *wrapperView = [[LOTView alloc] initWithFrame:viewRect]; - view.frame = view.bounds; - view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - [wrapperView addSubview:view]; - [self addSubview:wrapperView]; - [_compContainer maskSublayer:wrapperView.layer toKeypathLayer:keypath]; -} - -#endif - -# pragma mark - Semi-Private Methods - -- (CALayer * _Nullable)layerForKey:(NSString * _Nonnull)keyname { - return _compContainer.childMap[keyname]; -} - -- (NSArray * _Nonnull)compositionLayers { - return _compContainer.childLayers; -} - -# pragma mark - Getters and Setters - -- (CGFloat)animationDuration { - if (!_sceneModel) { - return 0; - } - CAAnimation *play = [_compContainer animationForKey:kCompContainerAnimationKey]; - if (play) { - return play.duration; - } - return (_sceneModel.endFrame.floatValue - _sceneModel.startFrame.floatValue) / _sceneModel.framerate.floatValue; -} - -- (CGFloat)animationProgress { - if (_isAnimationPlaying && - _compContainer.presentationLayer) { - CGFloat activeProgress = [self _progressForFrame:[(LOTCompositionContainer *)_compContainer.presentationLayer currentFrame]]; - return activeProgress; - } - return _animationProgress; -} - -# pragma mark - Overrides - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -#define LOTViewContentMode UIViewContentMode -#define LOTViewContentModeScaleToFill UIViewContentModeScaleToFill -#define LOTViewContentModeScaleAspectFit UIViewContentModeScaleAspectFit -#define LOTViewContentModeScaleAspectFill UIViewContentModeScaleAspectFill -#define LOTViewContentModeRedraw UIViewContentModeRedraw -#define LOTViewContentModeCenter UIViewContentModeCenter -#define LOTViewContentModeTop UIViewContentModeTop -#define LOTViewContentModeBottom UIViewContentModeBottom -#define LOTViewContentModeLeft UIViewContentModeLeft -#define LOTViewContentModeRight UIViewContentModeRight -#define LOTViewContentModeTopLeft UIViewContentModeTopLeft -#define LOTViewContentModeTopRight UIViewContentModeTopRight -#define LOTViewContentModeBottomLeft UIViewContentModeBottomLeft -#define LOTViewContentModeBottomRight UIViewContentModeBottomRight - -- (CGSize)intrinsicContentSize { - if (!_sceneModel) { - return CGSizeMake(UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric); - } - return _sceneModel.compBounds.size; -} - -- (void)didMoveToSuperview { - [super didMoveToSuperview]; - if (self.superview == nil) { - [self _callCompletionIfNecessary:NO]; - } -} - -- (void)willMoveToWindow:(UIWindow *)newWindow { - // When this view or its superview is leaving the screen, e.g. a modal is presented or another - // screen is pushed, this method will get called with newWindow value set to nil - indicating that - // this view will be detached from the visible window. - // When a view is detached, animations will stop - but will not automatically resumed when it's - // re-attached back to window, e.g. when the presented modal is dismissed or another screen is - // pop. - if (newWindow) { - // The view is being re-attached, resume animation if needed. - if (_shouldRestoreStateWhenAttachedToWindow) { - _shouldRestoreStateWhenAttachedToWindow = NO; - - _isAnimationPlaying = YES; - _completionBlock = _completionBlockToRestoreWhenAttachedToWindow; - _completionBlockToRestoreWhenAttachedToWindow = nil; - - [self performSelector:@selector(_restoreState) withObject:nil afterDelay:0]; - } - } else { - // The view is being detached, capture information that need to be restored later. - if (_isAnimationPlaying) { - [self pause]; - _shouldRestoreStateWhenAttachedToWindow = YES; - _completionBlockToRestoreWhenAttachedToWindow = _completionBlock; - _completionBlock = nil; - } - } -} - -- (void)setContentMode:(LOTViewContentMode)contentMode { - [super setContentMode:contentMode]; - [self setNeedsLayout]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [self _layout]; -} - -#else - -- (void)setCompletionBlock:(LOTAnimationCompletionBlock)completionBlock { - if (completionBlock) { - _completionBlock = ^(BOOL finished) { - dispatch_async(dispatch_get_main_queue(), ^{ completionBlock(finished); }); - }; - } - else { - _completionBlock = nil; - } -} - -- (void)setContentMode:(LOTViewContentMode)contentMode { - _contentMode = contentMode; - [self setNeedsLayout]; -} - -- (void)setNeedsLayout { - self.needsLayout = YES; -} - -- (BOOL)isFlipped { - return YES; -} - -- (BOOL)wantsUpdateLayer { - return YES; -} - -- (void)layout { - [super layout]; - [self _layout]; -} - -#endif - -- (void)_layoutAndForceUpdate { - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - [self _layout]; - [_compContainer displayWithFrame:_compContainer.currentFrame forceUpdate:YES]; - [CATransaction commit]; -} - -- (void)_layout { - CGPoint centerPoint = LOT_RectGetCenterPoint(self.bounds); - CATransform3D xform; - - if (self.contentMode == LOTViewContentModeScaleToFill) { - CGSize scaleSize = CGSizeMake(self.bounds.size.width / self.sceneModel.compBounds.size.width, - self.bounds.size.height / self.sceneModel.compBounds.size.height); - xform = CATransform3DMakeScale(scaleSize.width, scaleSize.height, 1); - } else if (self.contentMode == LOTViewContentModeScaleAspectFit) { - CGFloat compAspect = self.sceneModel.compBounds.size.width / self.sceneModel.compBounds.size.height; - CGFloat viewAspect = self.bounds.size.width / self.bounds.size.height; - BOOL scaleWidth = compAspect > viewAspect; - CGFloat dominantDimension = scaleWidth ? self.bounds.size.width : self.bounds.size.height; - CGFloat compDimension = scaleWidth ? self.sceneModel.compBounds.size.width : self.sceneModel.compBounds.size.height; - CGFloat scale = dominantDimension / compDimension; - xform = CATransform3DMakeScale(scale, scale, 1); - } else if (self.contentMode == LOTViewContentModeScaleAspectFill) { - CGFloat compAspect = self.sceneModel.compBounds.size.width / self.sceneModel.compBounds.size.height; - CGFloat viewAspect = self.bounds.size.width / self.bounds.size.height; - BOOL scaleWidth = compAspect < viewAspect; - CGFloat dominantDimension = scaleWidth ? self.bounds.size.width : self.bounds.size.height; - CGFloat compDimension = scaleWidth ? self.sceneModel.compBounds.size.width : self.sceneModel.compBounds.size.height; - CGFloat scale = dominantDimension / compDimension; - xform = CATransform3DMakeScale(scale, scale, 1); - } else { - xform = CATransform3DIdentity; - } - - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - _compContainer.transform = CATransform3DIdentity; - _compContainer.bounds = _sceneModel.compBounds; - _compContainer.viewportBounds = _sceneModel.compBounds; - _compContainer.transform = xform; - _compContainer.position = centerPoint; - [CATransaction commit]; -} - -# pragma mark - CAANimationDelegate - -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)complete { - if ([_compContainer animationForKey:kCompContainerAnimationKey] == anim && - [anim isKindOfClass:[CABasicAnimation class]]) { - CABasicAnimation *playAnimation = (CABasicAnimation *)anim; - NSNumber *frame = _compContainer.presentationLayer.currentFrame; - if (complete) { - // Set the final frame based on the animation to/from values. If playing forward, use the - // toValue otherwise we want to end on the fromValue. - frame = [self _isSpeedNegative] ? (NSNumber *)playAnimation.toValue : (NSNumber *)playAnimation.fromValue; - } - [self _removeCurrentAnimationIfNecessary]; - [self setProgressWithFrame:frame callCompletionIfNecessary:NO]; - [self _callCompletionIfNecessary:complete]; - } -} - -# pragma mark - DEPRECATED - -- (void)addSubview:(nonnull LOTView *)view - toLayerNamed:(nonnull NSString *)layer - applyTransform:(BOOL)applyTransform { - NSLog(@"%s: Function is DEPRECATED. Please use addSubview:forKeypathLayer:", __PRETTY_FUNCTION__); - LOTKeypath *keypath = [LOTKeypath keypathWithString:layer]; - if (applyTransform) { - [self addSubview:view toKeypathLayer:keypath]; - } else { - [self maskSubview:view toKeypathLayer:keypath]; - } -} - -- (CGRect)convertRect:(CGRect)rect - toLayerNamed:(NSString *_Nullable)layerName { - NSLog(@"%s: Function is DEPRECATED. Please use convertRect:forKeypathLayer:", __PRETTY_FUNCTION__); - LOTKeypath *keypath = [LOTKeypath keypathWithString:layerName]; - return [self convertRect:rect toKeypathLayer:keypath]; -} - -- (void)setValue:(nonnull id)value - forKeypath:(nonnull NSString *)keypath - atFrame:(nullable NSNumber *)frame { - NSLog(@"%s: Function is DEPRECATED and no longer functional. Please use setValueCallback:forKeypath:", __PRETTY_FUNCTION__); -} - -- (void)logHierarchyKeypaths { - NSArray *keypaths = [self keysForKeyPath:[LOTKeypath keypathWithString:@"**"]]; - for (NSString *keypath in keypaths) { - NSLog(@"%@", keypath); - } -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView_Internal.h b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView_Internal.h deleted file mode 100755 index b0cea80..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTAnimationView_Internal.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LOTAnimationView_Internal.h -// Lottie -// -// Created by Brandon Withrow on 12/7/16. -// Copyright © 2016 Brandon Withrow. All rights reserved. -// - -#import "LOTAnimationView.h" - -typedef enum : NSUInteger { - LOTConstraintTypeAlignToBounds, - LOTConstraintTypeAlignToLayer, - LOTConstraintTypeNone -} LOTConstraintType; - -@interface LOTAnimationView () - -- (CALayer * _Nullable)layerForKey:(NSString * _Nonnull)keyname; -- (NSArray * _Nonnull)compositionLayers; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTBlockCallback.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTBlockCallback.m deleted file mode 100755 index 0f168ac..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTBlockCallback.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// LOTBlockCallback.m -// Lottie -// -// Created by brandon_withrow on 12/15/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTBlockCallback.h" - -@implementation LOTColorBlockCallback - -+ (instancetype)withBlock:(LOTColorValueCallbackBlock)block { - LOTColorBlockCallback *colorCallback = [[self alloc] init]; - colorCallback.callback = block; - return colorCallback; -} - -- (CGColorRef)colorForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor currentColor:(CGColorRef)interpolatedColor { - return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startColor, endColor, interpolatedColor); -} - -@end - -@implementation LOTNumberBlockCallback - -+ (instancetype)withBlock:(LOTNumberValueCallbackBlock)block { - LOTNumberBlockCallback *numberCallback = [[self alloc] init]; - numberCallback.callback = block; - return numberCallback; -} - -- (CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue { - return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startValue, endValue, interpolatedValue); -} - -@end - -@implementation LOTPointBlockCallback - -+ (instancetype)withBlock:(LOTPointValueCallbackBlock)block { - LOTPointBlockCallback *callback = [[self alloc] init]; - callback.callback = block; - return callback; -} - -- (CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint { - return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startPoint, endPoint, interpolatedPoint); -} - -@end - -@implementation LOTSizeBlockCallback - -+ (instancetype)withBlock:(LOTSizeValueCallbackBlock)block { - LOTSizeBlockCallback *callback = [[self alloc] init]; - callback.callback = block; - return callback; -} - -- (CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize { - return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress, startSize, endSize, interpolatedSize); -} - -@end - -@implementation LOTPathBlockCallback - -+ (instancetype)withBlock:(LOTPathValueCallbackBlock)block { - LOTPathBlockCallback *callback = [[self alloc] init]; - callback.callback = block; - return callback; -} - -- (CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress { - return self.callback(currentFrame, startKeyframe, endKeyframe, interpolatedProgress); -} - -@end - diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTCacheProvider.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTCacheProvider.m deleted file mode 100755 index c0e1e83..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTCacheProvider.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// LOTCacheProvider.m -// Lottie -// -// Created by punmy on 2017/7/8. -// -// - -#import "LOTCacheProvider.h" - -@implementation LOTCacheProvider - -static id _imageCache; - -+ (id)imageCache { - return _imageCache; -} - -+ (void)setImageCache:(id)cache { - _imageCache = cache; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTComposition.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTComposition.m deleted file mode 100755 index f831e56..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTComposition.m +++ /dev/null @@ -1,133 +0,0 @@ -// -// LOTScene.m -// LottieAnimator -// -// Created by Brandon Withrow on 12/14/15. -// Copyright © 2015 Brandon Withrow. All rights reserved. -// - -#import "LOTComposition.h" -#import "LOTLayer.h" -#import "LOTAssetGroup.h" -#import "LOTLayerGroup.h" -#import "LOTAnimationCache.h" - -@implementation LOTComposition - -# pragma mark - Convenience Initializers - -+ (nullable instancetype)animationNamed:(nonnull NSString *)animationName { - return [self animationNamed:animationName inBundle:[NSBundle mainBundle]]; -} - -+ (nullable instancetype)animationNamed:(nonnull NSString *)animationName inBundle:(nonnull NSBundle *)bundle { - NSArray *components = [animationName componentsSeparatedByString:@"."]; - animationName = components.firstObject; - - LOTComposition *comp = [[LOTAnimationCache sharedCache] animationForKey:animationName]; - if (comp) { - return comp; - } - - NSError *error; - NSString *filePath = [bundle pathForResource:animationName ofType:@"json"]; - NSData *jsonData = [[NSData alloc] initWithContentsOfFile:filePath]; - NSDictionary *JSONObject = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData - options:0 error:&error] : nil; - if (JSONObject && !error) { - LOTComposition *laScene = [[self alloc] initWithJSON:JSONObject withAssetBundle:bundle]; - [[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName]; - laScene.cacheKey = animationName; - return laScene; - } - NSLog(@"%s: Animation Not Found", __PRETTY_FUNCTION__); - return nil; -} - -+ (nullable instancetype)animationWithFilePath:(nonnull NSString *)filePath { - NSString *animationName = filePath; - - LOTComposition *comp = [[LOTAnimationCache sharedCache] animationForKey:animationName]; - if (comp) { - return comp; - } - - NSError *error; - NSData *jsonData = [[NSData alloc] initWithContentsOfFile:filePath]; - NSDictionary *JSONObject = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData - options:0 error:&error] : nil; - if (JSONObject && !error) { - LOTComposition *laScene = [[self alloc] initWithJSON:JSONObject withAssetBundle:[NSBundle mainBundle]]; - laScene.rootDirectory = [filePath stringByDeletingLastPathComponent]; - [[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName]; - laScene.cacheKey = animationName; - return laScene; - } - - NSLog(@"%s: Animation Not Found", __PRETTY_FUNCTION__); - return nil; -} - -+ (nonnull instancetype)animationFromJSON:(nonnull NSDictionary *)animationJSON { - return [self animationFromJSON:animationJSON inBundle:[NSBundle mainBundle]]; -} - -+ (nonnull instancetype)animationFromJSON:(nullable NSDictionary *)animationJSON inBundle:(nullable NSBundle *)bundle { - return [[self alloc] initWithJSON:animationJSON withAssetBundle:bundle]; -} - -#pragma mark - Initializer - -- (instancetype _Nonnull)initWithJSON:(NSDictionary * _Nullable)jsonDictionary - withAssetBundle:(NSBundle * _Nullable)bundle { - self = [super init]; - if (self) { - if (jsonDictionary) { - [self _mapFromJSON:jsonDictionary withAssetBundle:bundle]; - } - } - return self; -} - -#pragma mark - Internal Methods - -- (void)_mapFromJSON:(NSDictionary *)jsonDictionary - withAssetBundle:(NSBundle *)bundle { - NSNumber *width = jsonDictionary[@"w"]; - NSNumber *height = jsonDictionary[@"h"]; - if (width && height) { - CGRect bounds = CGRectMake(0, 0, width.floatValue, height.floatValue); - _compBounds = bounds; - } - - _startFrame = [jsonDictionary[@"ip"] copy]; - _endFrame = [jsonDictionary[@"op"] copy]; - _framerate = [jsonDictionary[@"fr"] copy]; - - if (_startFrame && _endFrame && _framerate) { - NSInteger frameDuration = (_endFrame.integerValue - _startFrame.integerValue) - 1; - NSTimeInterval timeDuration = frameDuration / _framerate.floatValue; - _timeDuration = timeDuration; - } - - NSArray *assetArray = jsonDictionary[@"assets"]; - if (assetArray.count) { - _assetGroup = [[LOTAssetGroup alloc] initWithJSON:assetArray withAssetBundle:bundle withFramerate:_framerate]; - } - - NSArray *layersJSON = jsonDictionary[@"layers"]; - if (layersJSON) { - _layerGroup = [[LOTLayerGroup alloc] initWithLayerJSON:layersJSON - withAssetGroup:_assetGroup - withFramerate:_framerate]; - } - - [_assetGroup finalizeInitializationWithFramerate:_framerate]; -} - -- (void)setRootDirectory:(NSString *)rootDirectory { - _rootDirectory = rootDirectory; - self.assetGroup.rootDirectory = rootDirectory; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTInterpolatorCallback.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTInterpolatorCallback.m deleted file mode 100755 index 298e3a3..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTInterpolatorCallback.m +++ /dev/null @@ -1,56 +0,0 @@ -// -// LOTInterpolatorCallback.m -// Lottie -// -// Created by brandon_withrow on 1/5/18. -// Copyright © 2018 Airbnb. All rights reserved. -// - -#import "LOTInterpolatorCallback.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTFloatInterpolatorCallback - -+ (instancetype _Nonnull)withFromFloat:(CGFloat)fromFloat toFloat:(CGFloat)toFloat { - LOTFloatInterpolatorCallback *interpolator = [[self alloc] init]; - interpolator.fromFloat = fromFloat; - interpolator.toFloat = toFloat; - return interpolator; -} -- (CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue { - return LOT_RemapValue(self.currentProgress, 0, 1, self.fromFloat, self.toFloat); -} - -@end - -@implementation LOTPointInterpolatorCallback - -+ (instancetype _Nonnull)withFromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint { - LOTPointInterpolatorCallback *interpolator = [[self alloc] init]; - interpolator.fromPoint = fromPoint; - interpolator.toPoint = toPoint; - return interpolator; -} -- (CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint { - return LOT_PointInLine(self.fromPoint, self.toPoint, self.currentProgress); -} - -@end - -@implementation LOTSizeInterpolatorCallback - -+ (instancetype)withFromSize:(CGSize)fromSize toSize:(CGSize)toSize { - LOTSizeInterpolatorCallback *interpolator = [[self alloc] init]; - interpolator.fromSize = fromSize; - interpolator.toSize = toSize; - return interpolator; -} - -- (CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize { - CGPoint from = CGPointMake(self.fromSize.width, self.fromSize.height); - CGPoint to = CGPointMake(self.toSize.width, self.toSize.height); - CGPoint returnPoint = LOT_PointInLine(from, to, self.currentProgress); - return CGSizeMake(returnPoint.x, returnPoint.y); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTKeypath.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTKeypath.m deleted file mode 100755 index 100c293..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTKeypath.m +++ /dev/null @@ -1,140 +0,0 @@ -// -// LOTKeypath.m -// Lottie_iOS -// -// Created by brandon_withrow on 12/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTKeypath.h" - -NSString *const kLOTKeypathEnd = @"LOTENDKEYPATH"; - -@implementation LOTKeypath { - NSInteger _currentDepth; - NSMutableArray *_fuzzyDepthStack; - NSMutableArray *_currentStack; - NSArray *_keys; - NSMutableDictionary *_searchResults; -} - -+ (nonnull LOTKeypath *)keypathWithString:(nonnull NSString *)keypath { - return [[self alloc] initWithKeys:[keypath componentsSeparatedByString:@"."]]; -} - -+ (nonnull LOTKeypath *)keypathWithKeys:(nonnull NSString *)firstKey, ... { - NSMutableArray *keys = [NSMutableArray array]; - va_list args; - va_start(args, firstKey); - for (NSString *arg = firstKey; arg != nil; arg = va_arg(args, NSString*)) - { - [keys addObject:arg]; - } - va_end(args); - return [[self alloc] initWithKeys:keys]; -} - -- (instancetype)initWithKeys:(NSArray *)keys { - self = [super init]; - if (self) { - _keys = [NSArray arrayWithArray:keys]; - NSMutableString *absolutePath = [NSMutableString string]; - for (int i = 0; i < _keys.count; i++) { - if (i > 0) { - [absolutePath appendString:@"."]; - } - [absolutePath appendString:_keys[i]]; - } - _currentStack = [NSMutableArray array]; - _absoluteKeypath = absolutePath; - _currentDepth = 0; - _fuzzyDepthStack = [NSMutableArray array]; - _searchResults = [NSMutableDictionary dictionary]; - } - return self; -} - -- (BOOL)pushKey:(nonnull NSString *)key { - if (_currentDepth == _keys.count && - self.hasFuzzyWildcard == NO) { - return NO; - } - NSString *current = self.currentKey; - if (self.hasWildcard || - [current isEqualToString:key]) { - [_currentStack addObject:[key copy]]; - _currentDepth ++; - if (self.hasFuzzyWildcard) { - [_fuzzyDepthStack addObject:@(_currentDepth)]; - } - return YES; - } else if (self.hasFuzzyWildcard) { - [_currentStack addObject:[key copy]]; - return YES; - } - return NO; -} - -- (void)popKey { - if (_currentDepth == 0) { - return; - } - NSInteger stackCount = _currentStack.count; - [_currentStack removeLastObject]; - - if (self.hasFuzzyWildcard ) { - if (stackCount == _fuzzyDepthStack.lastObject.integerValue) { - [_fuzzyDepthStack removeLastObject]; - } else { - return; - } - } - _currentDepth --; -} - -- (void)popToRootKey { - _currentDepth = 0; - [_currentStack removeAllObjects]; - [_fuzzyDepthStack removeAllObjects]; -} - -- (NSString *)currentKey { - if (_currentDepth == _keys.count) { - return kLOTKeypathEnd; - } - return _keys[_currentDepth]; -} - -- (NSString *)currentKeyPath { - return [_currentStack componentsJoinedByString:@"."]; -} - -- (BOOL)hasWildcard { - if (_currentDepth == _keys.count) { - return NO; - } - return ([_keys[_currentDepth] isEqualToString:@"**"] || - [_keys[_currentDepth] isEqualToString:@"*"]); -} - -- (BOOL)hasFuzzyWildcard { - if (_currentDepth == 0 || - _currentDepth > _keys.count) { - return NO; - } - return [_keys[_currentDepth - 1] isEqualToString:@"**"]; -} - -- (BOOL)endOfKeypath { - return (_currentDepth == _keys.count); -} - -- (void)addSearchResultForCurrentPath:(id _Nonnull)result { - [_searchResults setObject:result forKey:self.currentKeyPath]; -} - -- (NSDictionary *)searchResults { - return _searchResults; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTValueCallback.m b/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTValueCallback.m deleted file mode 100755 index 0514748..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/Private/LOTValueCallback.m +++ /dev/null @@ -1,79 +0,0 @@ -// -// LOTValueCallback.m -// Lottie -// -// Created by brandon_withrow on 12/15/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueCallback.h" - -@implementation LOTColorValueCallback - -+ (instancetype _Nonnull)withCGColor:(CGColorRef _Nonnull)color { - LOTColorValueCallback *colorCallback = [[self alloc] init]; - colorCallback.colorValue = color; - return colorCallback; -} - -- (CGColorRef)colorForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor currentColor:(CGColorRef)interpolatedColor { - return self.colorValue; -} - -@end - -@implementation LOTNumberValueCallback - -+ (instancetype _Nonnull)withFloatValue:(CGFloat)numberValue { - LOTNumberValueCallback *numberCallback = [[self alloc] init]; - numberCallback.numberValue = numberValue; - return numberCallback; -} - -- (CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue { - return self.numberValue; -} - -@end - -@implementation LOTPointValueCallback - -+ (instancetype _Nonnull)withPointValue:(CGPoint)pointValue { - LOTPointValueCallback *callback = [[self alloc] init]; - callback.pointValue = pointValue; - return callback; -} - -- (CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint { - return self.pointValue; -} - -@end - -@implementation LOTSizeValueCallback - -+ (instancetype _Nonnull)withPointValue:(CGSize)sizeValue { - LOTSizeValueCallback *callback = [[self alloc] init]; - callback.sizeValue = sizeValue; - return callback; -} - -- (CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize { - return self.sizeValue; -} - -@end - -@implementation LOTPathValueCallback - -+ (instancetype _Nonnull)withCGPath:(CGPathRef _Nonnull)path { - LOTPathValueCallback *callback = [[self alloc] init]; - callback.pathValue = path; - return callback; -} - -- (CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress { - return self.pathValue; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.h deleted file mode 100755 index 5abafc0..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTCircleAnimator.h -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatorNode.h" -#import "LOTShapeCircle.h" - -@interface LOTCircleAnimator : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeCircle:(LOTShapeCircle *_Nonnull)shapeCircle; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.m deleted file mode 100755 index 374839b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTCircleAnimator.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// LOTCircleAnimator.m -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTCircleAnimator.h" -#import "LOTPointInterpolator.h" - -const CGFloat kLOTEllipseControlPointPercentage = 0.55228; - -@implementation LOTCircleAnimator { - LOTPointInterpolator *_centerInterpolator; - LOTPointInterpolator *_sizeInterpolator; - BOOL _reversed; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeCircle:(LOTShapeCircle *_Nonnull)shapeCircle { - self = [super initWithInputNode:inputNode keyName:shapeCircle.keyname]; - if (self) { - _centerInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeCircle.position.keyframes]; - _sizeInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeCircle.size.keyframes]; - _reversed = shapeCircle.reversed; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Size" : _sizeInterpolator, - @"Position" : _centerInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return [_centerInterpolator hasUpdateForFrame:frame] || [_sizeInterpolator hasUpdateForFrame:frame]; -} - -- (void)performLocalUpdate { - // Unfortunately we HAVE to manually build out the ellipse. - // Every Apple method constructs from the 3 o-clock position - // After effects contrsucts from the Noon position. - // After effects does clockwise, but also has a flag for reversed. - CGPoint center = [_centerInterpolator pointValueForFrame:self.currentFrame]; - CGPoint size = [_sizeInterpolator pointValueForFrame:self.currentFrame]; - - CGFloat halfWidth = size.x / 2; - CGFloat halfHeight = size.y / 2; - - if (_reversed) { - halfWidth = halfWidth * -1; - } - - CGPoint circleQ1 = CGPointMake(center.x, center.y - halfHeight); - CGPoint circleQ2 = CGPointMake(center.x + halfWidth, center.y); - CGPoint circleQ3 = CGPointMake(center.x, center.y + halfHeight); - CGPoint circleQ4 = CGPointMake(center.x - halfWidth, center.y); - - CGFloat cpW = halfWidth * kLOTEllipseControlPointPercentage; - CGFloat cpH = halfHeight * kLOTEllipseControlPointPercentage; - - LOTBezierPath *path = [[LOTBezierPath alloc] init]; - path.cacheLengths = self.pathShouldCacheLengths; - [path LOT_moveToPoint:circleQ1]; - [path LOT_addCurveToPoint:circleQ2 controlPoint1:CGPointMake(circleQ1.x + cpW, circleQ1.y) controlPoint2:CGPointMake(circleQ2.x, circleQ2.y - cpH)]; - - [path LOT_addCurveToPoint:circleQ3 controlPoint1:CGPointMake(circleQ2.x, circleQ2.y + cpH) controlPoint2:CGPointMake(circleQ3.x + cpW, circleQ3.y)]; - - [path LOT_addCurveToPoint:circleQ4 controlPoint1:CGPointMake(circleQ3.x - cpW, circleQ3.y) controlPoint2:CGPointMake(circleQ4.x, circleQ4.y + cpH)]; - - [path LOT_addCurveToPoint:circleQ1 controlPoint1:CGPointMake(circleQ4.x, circleQ4.y - cpH) controlPoint2:CGPointMake(circleQ1.x - cpW, circleQ1.y)]; - - self.localPath = path; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.h deleted file mode 100755 index 2479130..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTPathAnimator.h -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import "LOTAnimatorNode.h" -#import "LOTShapePath.h" - -@interface LOTPathAnimator : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapePath:(LOTShapePath *_Nonnull)shapePath; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.m deleted file mode 100755 index 2c0662a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPathAnimator.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// LOTPathAnimator.m -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import "LOTPathAnimator.h" -#import "LOTPathInterpolator.h" - -@implementation LOTPathAnimator { - LOTShapePath *_pathConent; - LOTPathInterpolator *_interpolator; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapePath:(LOTShapePath *_Nonnull)shapePath { - self = [super initWithInputNode:inputNode keyName:shapePath.keyname]; - if (self) { - _pathConent = shapePath; - _interpolator = [[LOTPathInterpolator alloc] initWithKeyframes:_pathConent.shapePath.keyframes]; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Path" : _interpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return [_interpolator hasUpdateForFrame:frame]; -} - -- (void)performLocalUpdate { - self.localPath = [_interpolator pathForFrame:self.currentFrame cacheLengths:self.pathShouldCacheLengths]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.h deleted file mode 100755 index 2822998..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTPolygonAnimator.h -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatorNode.h" -#import "LOTShapeStar.h" - -@interface LOTPolygonAnimator : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapePolygon:(LOTShapeStar *_Nonnull)shapeStar; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.m deleted file mode 100755 index 99310f0..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolygonAnimator.m +++ /dev/null @@ -1,110 +0,0 @@ -// -// LOTPolygonAnimator.m -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPolygonAnimator.h" -#import "LOTKeyframe.h" -#import "LOTPointInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "LOTBezierPath.h" -#import "CGGeometry+LOTAdditions.h" - -const CGFloat kPOLYGON_MAGIC_NUMBER = .25f; - -@implementation LOTPolygonAnimator { - LOTNumberInterpolator *_outerRadiusInterpolator; - LOTNumberInterpolator *_outerRoundnessInterpolator; - LOTPointInterpolator *_positionInterpolator; - LOTNumberInterpolator *_pointsInterpolator; - LOTNumberInterpolator *_rotationInterpolator; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapePolygon:(LOTShapeStar *_Nonnull)shapeStar { - self = [super initWithInputNode:inputNode keyName:shapeStar.keyname]; - if (self) { - _outerRadiusInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.outerRadius.keyframes]; - _outerRoundnessInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.outerRoundness.keyframes]; - _pointsInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.numberOfPoints.keyframes]; - _rotationInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.rotation.keyframes]; - _positionInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeStar.position.keyframes]; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Points" : _pointsInterpolator, - @"Position" : _positionInterpolator, - @"Rotation" : _rotationInterpolator, - @"Outer Radius" : _outerRadiusInterpolator, - @"Outer Roundness" : _outerRoundnessInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return ([_outerRadiusInterpolator hasUpdateForFrame:frame] || - [_outerRoundnessInterpolator hasUpdateForFrame:frame] || - [_pointsInterpolator hasUpdateForFrame:frame] || - [_rotationInterpolator hasUpdateForFrame:frame] || - [_positionInterpolator hasUpdateForFrame:frame]); -} - -- (void)performLocalUpdate { - CGFloat outerRadius = [_outerRadiusInterpolator floatValueForFrame:self.currentFrame]; - CGFloat outerRoundness = [_outerRoundnessInterpolator floatValueForFrame:self.currentFrame] / 100.f; - CGFloat points = [_pointsInterpolator floatValueForFrame:self.currentFrame]; - CGFloat rotation = [_rotationInterpolator floatValueForFrame:self.currentFrame]; - CGPoint position = [_positionInterpolator pointValueForFrame:self.currentFrame]; - - LOTBezierPath *path = [[LOTBezierPath alloc] init]; - path.cacheLengths = self.pathShouldCacheLengths; - CGFloat currentAngle = LOT_DegreesToRadians(rotation - 90); - CGFloat anglePerPoint = (CGFloat)((2 * M_PI) / points); - - CGFloat x; - CGFloat y; - CGFloat previousX; - CGFloat previousY; - x = (CGFloat) (outerRadius * cosf(currentAngle)); - y = (CGFloat) (outerRadius * sinf(currentAngle)); - [path LOT_moveToPoint:CGPointMake(x, y)]; - currentAngle += anglePerPoint; - - double numPoints = ceil(points); - for (int i = 0; i < numPoints; i++) { - previousX = x; - previousY = y; - x = (CGFloat) (outerRadius * cosf(currentAngle)); - y = (CGFloat) (outerRadius * sinf(currentAngle)); - - if (outerRoundness != 0) { - CGFloat cp1Theta = (CGFloat) (atan2(previousY, previousX) - M_PI / 2.f); - CGFloat cp1Dx = (CGFloat) cosf(cp1Theta); - CGFloat cp1Dy = (CGFloat) sinf(cp1Theta); - - CGFloat cp2Theta = (CGFloat) (atan2(y, x) - M_PI / 2.f); - CGFloat cp2Dx = (CGFloat) cosf(cp2Theta); - CGFloat cp2Dy = (CGFloat) sinf(cp2Theta); - - CGFloat cp1x = outerRadius * outerRoundness * kPOLYGON_MAGIC_NUMBER * cp1Dx; - CGFloat cp1y = outerRadius * outerRoundness * kPOLYGON_MAGIC_NUMBER * cp1Dy; - CGFloat cp2x = outerRadius * outerRoundness * kPOLYGON_MAGIC_NUMBER * cp2Dx; - CGFloat cp2y = outerRadius * outerRoundness * kPOLYGON_MAGIC_NUMBER * cp2Dy; - [path LOT_addCurveToPoint:CGPointMake(x, y) - controlPoint1:CGPointMake(previousX - cp1x, previousY - cp1y) - controlPoint2:CGPointMake(x + cp2x, y + cp2y)]; - } else { - [path LOT_addLineToPoint:CGPointMake(x, y)]; - } - - currentAngle += anglePerPoint; - } - [path LOT_closePath]; - [path LOT_applyTransform:CGAffineTransformMakeTranslation(position.x, position.y)]; - self.localPath = path; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.h deleted file mode 100755 index 17334eb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTPolystarAnimator.h -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatorNode.h" -#import "LOTShapeStar.h" - -@interface LOTPolystarAnimator : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeStar:(LOTShapeStar *_Nonnull)shapeStar; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.m deleted file mode 100755 index c624a60..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTPolystarAnimator.m +++ /dev/null @@ -1,156 +0,0 @@ -// -// LOTPolystarAnimator.m -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPolystarAnimator.h" -#import "LOTPointInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "LOTBezierPath.h" -#import "CGGeometry+LOTAdditions.h" - -const CGFloat kPOLYSTAR_MAGIC_NUMBER = .47829f; - -@implementation LOTPolystarAnimator { - LOTNumberInterpolator *_outerRadiusInterpolator; - LOTNumberInterpolator *_innerRadiusInterpolator; - LOTNumberInterpolator *_outerRoundnessInterpolator; - LOTNumberInterpolator *_innerRoundnessInterpolator; - LOTPointInterpolator *_positionInterpolator; - LOTNumberInterpolator *_pointsInterpolator; - LOTNumberInterpolator *_rotationInterpolator; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeStar:(LOTShapeStar *_Nonnull)shapeStar { - self = [super initWithInputNode:inputNode keyName:shapeStar.keyname]; - if (self) { - _outerRadiusInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.outerRadius.keyframes]; - _innerRadiusInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.innerRadius.keyframes]; - _outerRoundnessInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.outerRoundness.keyframes]; - _innerRoundnessInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.innerRoundness.keyframes]; - _pointsInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.numberOfPoints.keyframes]; - _rotationInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeStar.rotation.keyframes]; - _positionInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeStar.position.keyframes]; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Points" : _pointsInterpolator, - @"Position" : _positionInterpolator, - @"Rotation" : _rotationInterpolator, - @"Inner Radius" : _innerRadiusInterpolator, - @"Outer Radius" : _outerRadiusInterpolator, - @"Inner Roundness" : _innerRoundnessInterpolator, - @"Outer Roundness" : _outerRoundnessInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return ([_outerRadiusInterpolator hasUpdateForFrame:frame] || - [_innerRadiusInterpolator hasUpdateForFrame:frame] || - [_outerRoundnessInterpolator hasUpdateForFrame:frame] || - [_innerRoundnessInterpolator hasUpdateForFrame:frame] || - [_pointsInterpolator hasUpdateForFrame:frame] || - [_rotationInterpolator hasUpdateForFrame:frame] || - [_positionInterpolator hasUpdateForFrame:frame]); -} - -- (void)performLocalUpdate { - CGFloat outerRadius = [_outerRadiusInterpolator floatValueForFrame:self.currentFrame]; - CGFloat innerRadius = [_innerRadiusInterpolator floatValueForFrame:self.currentFrame]; - CGFloat outerRoundness = [_outerRoundnessInterpolator floatValueForFrame:self.currentFrame] / 100.f; - CGFloat innerRoundness = [_innerRoundnessInterpolator floatValueForFrame:self.currentFrame] / 100.f; - CGFloat points = [_pointsInterpolator floatValueForFrame:self.currentFrame]; - CGFloat rotation = [_rotationInterpolator floatValueForFrame:self.currentFrame]; - CGPoint position = [_positionInterpolator pointValueForFrame:self.currentFrame]; - LOTBezierPath *path = [[LOTBezierPath alloc] init]; - path.cacheLengths = self.pathShouldCacheLengths; - CGFloat currentAngle = LOT_DegreesToRadians(rotation - 90); - CGFloat anglePerPoint = (CGFloat)((2 * M_PI) / points); - CGFloat halfAnglePerPoint = anglePerPoint / 2.0f; - CGFloat partialPointAmount = points - floor(points); - if (partialPointAmount != 0) { - currentAngle += halfAnglePerPoint * (1.f - partialPointAmount); - } - - CGFloat x; - CGFloat y; - CGFloat previousX; - CGFloat previousY; - CGFloat partialPointRadius = 0; - if (partialPointAmount != 0) { - partialPointRadius = innerRadius + partialPointAmount * (outerRadius - innerRadius); - x = (CGFloat) (partialPointRadius * cosf(currentAngle)); - y = (CGFloat) (partialPointRadius * sinf(currentAngle)); - [path LOT_moveToPoint:CGPointMake(x, y)]; - currentAngle += anglePerPoint * partialPointAmount / 2.f; - } else { - x = (float) (outerRadius * cosf(currentAngle)); - y = (float) (outerRadius * sinf(currentAngle)); - [path LOT_moveToPoint:CGPointMake(x, y)]; - currentAngle += halfAnglePerPoint; - } - - // True means the line will go to outer radius. False means inner radius. - BOOL longSegment = false; - CGFloat numPoints = ceil(points) * 2; - for (int i = 0; i < numPoints; i++) { - CGFloat radius = longSegment ? outerRadius : innerRadius; - CGFloat dTheta = halfAnglePerPoint; - if (partialPointRadius != 0 && i == numPoints - 2) { - dTheta = anglePerPoint * partialPointAmount / 2.f; - } - if (partialPointRadius != 0 && i == numPoints - 1) { - radius = partialPointRadius; - } - previousX = x; - previousY = y; - x = (CGFloat) (radius * cosf(currentAngle)); - y = (CGFloat) (radius * sinf(currentAngle)); - - if (innerRoundness == 0 && outerRoundness == 0) { - [path LOT_addLineToPoint:CGPointMake(x, y)]; - } else { - CGFloat cp1Theta = (CGFloat) (atan2f(previousY, previousX) - M_PI / 2.f); - CGFloat cp1Dx = (CGFloat) cosf(cp1Theta); - CGFloat cp1Dy = (CGFloat) sinf(cp1Theta); - - CGFloat cp2Theta = (CGFloat) (atan2f(y, x) - M_PI / 2.f); - CGFloat cp2Dx = (CGFloat) cosf(cp2Theta); - CGFloat cp2Dy = (CGFloat) sinf(cp2Theta); - - CGFloat cp1Roundedness = longSegment ? innerRoundness : outerRoundness; - CGFloat cp2Roundedness = longSegment ? outerRoundness : innerRoundness; - CGFloat cp1Radius = longSegment ? innerRadius : outerRadius; - CGFloat cp2Radius = longSegment ? outerRadius : innerRadius; - - CGFloat cp1x = cp1Radius * cp1Roundedness * kPOLYSTAR_MAGIC_NUMBER * cp1Dx; - CGFloat cp1y = cp1Radius * cp1Roundedness * kPOLYSTAR_MAGIC_NUMBER * cp1Dy; - CGFloat cp2x = cp2Radius * cp2Roundedness * kPOLYSTAR_MAGIC_NUMBER * cp2Dx; - CGFloat cp2y = cp2Radius * cp2Roundedness * kPOLYSTAR_MAGIC_NUMBER * cp2Dy; - if (partialPointAmount != 0) { - if (i == 0) { - cp1x *= partialPointAmount; - cp1y *= partialPointAmount; - } else if (i == numPoints - 1) { - cp2x *= partialPointAmount; - cp2y *= partialPointAmount; - } - } - [path LOT_addCurveToPoint:CGPointMake(x, y) - controlPoint1:CGPointMake(previousX - cp1x, previousY - cp1y) - controlPoint2:CGPointMake(x + cp2x, y + cp2y)]; - } - currentAngle += dTheta; - longSegment = !longSegment; - } - [path LOT_closePath]; - [path LOT_applyTransform:CGAffineTransformMakeTranslation(position.x, position.y)]; - self.localPath = path; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.h deleted file mode 100755 index 8bc5ddb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// LOTRoundedRectAnimator.h -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatorNode.h" -#import "LOTShapeRectangle.h" - -@interface LOTRoundedRectAnimator : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeRectangle:(LOTShapeRectangle *_Nonnull)shapeRectangle; - - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.m deleted file mode 100755 index 30209d9..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/AnimatorNodes/LOTRoundedRectAnimator.m +++ /dev/null @@ -1,147 +0,0 @@ -// -// LOTRoundedRectAnimator.m -// Lottie -// -// Created by brandon_withrow on 7/19/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRoundedRectAnimator.h" -#import "LOTPointInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTRoundedRectAnimator { - LOTPointInterpolator *_centerInterpolator; - LOTPointInterpolator *_sizeInterpolator; - LOTNumberInterpolator *_cornerRadiusInterpolator; - BOOL _reversed; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeRectangle:(LOTShapeRectangle *_Nonnull)shapeRectangle { - self = [super initWithInputNode:inputNode keyName:shapeRectangle.keyname]; - if (self) { - _centerInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeRectangle.position.keyframes]; - _sizeInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:shapeRectangle.size.keyframes]; - _cornerRadiusInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:shapeRectangle.cornerRadius.keyframes]; - _reversed = shapeRectangle.reversed; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Size" : _sizeInterpolator, - @"Position" : _centerInterpolator, - @"Roundness" : _cornerRadiusInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return [_centerInterpolator hasUpdateForFrame:frame] || [_sizeInterpolator hasUpdateForFrame:frame] || [_cornerRadiusInterpolator hasUpdateForFrame:frame]; -} - -- (void)addCorner:(CGPoint)cornerPoint withRadius:(CGFloat)radius toPath:(LOTBezierPath *)path clockwise:(BOOL)clockwise { - CGPoint currentPoint = path.currentPoint; - - CGFloat ellipseControlPointPercentage = 0.55228; - - if (cornerPoint.y == currentPoint.y) { - // Moving east/west - if (cornerPoint.x < currentPoint.x) { - // Moving west - CGPoint corner = CGPointMake(cornerPoint.x + radius, currentPoint.y); - [path LOT_addLineToPoint:corner]; - if (radius) { - CGPoint curvePoint = clockwise ? CGPointMake(cornerPoint.x, cornerPoint.y - radius) : CGPointMake(cornerPoint.x, cornerPoint.y + radius); - CGPoint cp1 = CGPointMake(corner.x - (radius * ellipseControlPointPercentage), corner.y); - CGPoint cp2 = (clockwise ? - CGPointMake(curvePoint.x, curvePoint.y + (radius * ellipseControlPointPercentage)) : - CGPointMake(curvePoint.x, curvePoint.y - (radius * ellipseControlPointPercentage))); - [path LOT_addCurveToPoint:curvePoint controlPoint1:cp1 controlPoint2:cp2]; - } - } else { - // Moving east - CGPoint corner = CGPointMake(cornerPoint.x - radius, currentPoint.y); - [path LOT_addLineToPoint:corner]; - if (radius) { - CGPoint curvePoint = clockwise ? CGPointMake(cornerPoint.x, cornerPoint.y + radius) : CGPointMake(cornerPoint.x, cornerPoint.y - radius); - CGPoint cp1 = CGPointMake(corner.x + (radius * ellipseControlPointPercentage), corner.y); - CGPoint cp2 = (clockwise ? - CGPointMake(curvePoint.x, curvePoint.y - (radius * ellipseControlPointPercentage)) : - CGPointMake(curvePoint.x, curvePoint.y + (radius * ellipseControlPointPercentage))); - [path LOT_addCurveToPoint:curvePoint controlPoint1:cp1 controlPoint2:cp2]; - } - } - } else { - // Moving North/South - if (cornerPoint.y < currentPoint.y) { - // Moving North - CGPoint corner = CGPointMake(currentPoint.x, cornerPoint.y + radius); - [path LOT_addLineToPoint:corner]; - if (radius) { - CGPoint curvePoint = clockwise ? CGPointMake(cornerPoint.x + radius, cornerPoint.y) : CGPointMake(cornerPoint.x - radius, cornerPoint.y); - CGPoint cp1 = CGPointMake(corner.x, corner.y - (radius * ellipseControlPointPercentage)); - CGPoint cp2 = (clockwise ? - CGPointMake(curvePoint.x - (radius * ellipseControlPointPercentage), curvePoint.y) : - CGPointMake(curvePoint.x + (radius * ellipseControlPointPercentage), curvePoint.y)); - [path LOT_addCurveToPoint:curvePoint controlPoint1:cp1 controlPoint2:cp2]; - } - - } else { - // moving south - CGPoint corner = CGPointMake(currentPoint.x, cornerPoint.y - radius); - [path LOT_addLineToPoint:corner]; - if (radius) { - CGPoint curvePoint = clockwise ? CGPointMake(cornerPoint.x - radius, cornerPoint.y) : CGPointMake(cornerPoint.x + radius, cornerPoint.y); - CGPoint cp1 = CGPointMake(corner.x, corner.y + (radius * ellipseControlPointPercentage)); - CGPoint cp2 = (clockwise ? - CGPointMake(curvePoint.x + (radius * ellipseControlPointPercentage), curvePoint.y) : - CGPointMake(curvePoint.x - (radius * ellipseControlPointPercentage), curvePoint.y)); - [path LOT_addCurveToPoint:curvePoint controlPoint1:cp1 controlPoint2:cp2]; - } - } - } -} - -- (void)performLocalUpdate { - CGFloat cornerRadius = [_cornerRadiusInterpolator floatValueForFrame:self.currentFrame]; - CGPoint size = [_sizeInterpolator pointValueForFrame:self.currentFrame]; - CGPoint position = [_centerInterpolator pointValueForFrame:self.currentFrame]; - - CGFloat halfWidth = size.x / 2; - CGFloat halfHeight = size.y / 2; - - CGRect rectFrame = CGRectMake(position.x - halfWidth, position.y - halfHeight, size.x, size.y); - - CGPoint topLeft = CGPointMake(CGRectGetMinX(rectFrame), CGRectGetMinY(rectFrame)); - CGPoint topRight = CGPointMake(CGRectGetMaxX(rectFrame), CGRectGetMinY(rectFrame)); - CGPoint bottomLeft = CGPointMake(CGRectGetMinX(rectFrame), CGRectGetMaxY(rectFrame)); - CGPoint bottomRight = CGPointMake(CGRectGetMaxX(rectFrame), CGRectGetMaxY(rectFrame)); - // UIBezierPath Draws rects from the top left corner, After Effects draws them from the top right. - // Switching to manual drawing. - - CGFloat radius = MIN(MIN(halfWidth, halfHeight), cornerRadius); - BOOL clockWise = !_reversed; - - LOTBezierPath *path1 = [[LOTBezierPath alloc] init]; - path1.cacheLengths = self.pathShouldCacheLengths; - CGPoint startPoint = (clockWise ? - CGPointMake(topRight.x, topRight.y + radius) : - CGPointMake(topRight.x - radius, topRight.y)); - [path1 LOT_moveToPoint:startPoint]; - if (clockWise) { - [self addCorner:bottomRight withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:bottomLeft withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:topLeft withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:topRight withRadius:radius toPath:path1 clockwise:clockWise]; - } else { - [self addCorner:topLeft withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:bottomLeft withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:bottomRight withRadius:radius toPath:path1 clockwise:clockWise]; - [self addCorner:topRight withRadius:radius toPath:path1 clockwise:clockWise]; - } - [path1 LOT_closePath]; - self.localPath = path1; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.h deleted file mode 100755 index a0d57df..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// LOTArrayInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueInterpolator.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTArrayInterpolator : LOTValueInterpolator - -- (NSArray *)numberArrayForFrame:(NSNumber *)frame; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.m deleted file mode 100755 index a1ab152..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTArrayInterpolator.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// LOTArrayInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTArrayInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTArrayInterpolator - -- (NSArray *)numberArrayForFrame:(NSNumber *)frame { - CGFloat progress = [self progressForFrame:frame]; - if (progress == 0) { - return self.leadingKeyframe.arrayValue; - } - if (progress == 1) { - return self.trailingKeyframe.arrayValue; - } - NSMutableArray *returnArray = [NSMutableArray array]; - for (int i = 0; i < self.leadingKeyframe.arrayValue.count; i ++) { - CGFloat from = [(NSNumber *)self.leadingKeyframe.arrayValue[i] floatValue]; - CGFloat to = [(NSNumber *)self.trailingKeyframe.arrayValue[i] floatValue]; - CGFloat value = LOT_RemapValue(progress, 0, 1, from, to); - [returnArray addObject:@(value)]; - } - return returnArray; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.h deleted file mode 100755 index 5d6009f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// LOTColorInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueInterpolator.h" -#import "LOTPlatformCompat.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTColorInterpolator : LOTValueInterpolator - -- (CGColorRef)colorForFrame:(NSNumber *)frame; - -@property (nonatomic, weak, nullable) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.m deleted file mode 100755 index ae10f8a..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTColorInterpolator.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// LOTColorInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTColorInterpolator.h" -#import "LOTPlatformCompat.h" -#import "UIColor+Expanded.h" - -@implementation LOTColorInterpolator - -- (CGColorRef)colorForFrame:(NSNumber *)frame { - CGFloat progress = [self progressForFrame:frame]; - UIColor *returnColor; - - if (progress == 0) { - returnColor = self.leadingKeyframe.colorValue; - } else if (progress == 1) { - returnColor = self.trailingKeyframe.colorValue; - } else { - returnColor = [UIColor LOT_colorByLerpingFromColor:self.leadingKeyframe.colorValue toColor:self.trailingKeyframe.colorValue amount:progress]; - } - if (self.hasDelegateOverride) { - return [self.delegate colorForFrame:frame.floatValue - startKeyframe:self.leadingKeyframe.keyframeTime.floatValue - endKeyframe:self.trailingKeyframe.keyframeTime.floatValue - interpolatedProgress:progress - startColor:self.leadingKeyframe.colorValue.CGColor - endColor:self.trailingKeyframe.colorValue.CGColor - currentColor:returnColor.CGColor]; - } - - return returnColor.CGColor; -} - -- (void)setValueDelegate:(id)delegate { - NSAssert(([delegate conformsToProtocol:@protocol(LOTColorValueDelegate)]), @"Color Interpolator set with incorrect callback type. Expected LOTColorValueDelegate"); - self.delegate = (id)delegate; -} - -- (BOOL)hasDelegateOverride { - return self.delegate != nil; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.h deleted file mode 100755 index fe179a3..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LOTNumberInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/11/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTValueInterpolator.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN -@interface LOTNumberInterpolator : LOTValueInterpolator - -- (CGFloat)floatValueForFrame:(NSNumber *)frame; - -@property (nonatomic, weak, nullable) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.m deleted file mode 100755 index fb560b6..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTNumberInterpolator.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// LOTNumberInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/11/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTNumberInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTNumberInterpolator - -- (CGFloat)floatValueForFrame:(NSNumber *)frame { - CGFloat progress = [self progressForFrame:frame]; - CGFloat returnValue; - if (progress == 0) { - returnValue = self.leadingKeyframe.floatValue; - } else if (progress == 1) { - returnValue = self.trailingKeyframe.floatValue; - } else { - returnValue = LOT_RemapValue(progress, 0, 1, self.leadingKeyframe.floatValue, self.trailingKeyframe.floatValue); - } - if (self.hasDelegateOverride) { - return [self.delegate floatValueForFrame:frame.floatValue - startKeyframe:self.leadingKeyframe.keyframeTime.floatValue - endKeyframe:self.trailingKeyframe.keyframeTime.floatValue - interpolatedProgress:progress - startValue:self.leadingKeyframe.floatValue - endValue:self.trailingKeyframe.floatValue - currentValue:returnValue]; - } - - return returnValue; -} - -- (BOOL)hasDelegateOverride { - return self.delegate != nil; -} - -- (void)setValueDelegate:(id _Nonnull)delegate { - NSAssert(([delegate conformsToProtocol:@protocol(LOTNumberValueDelegate)]), @"Number Interpolator set with incorrect callback type. Expected LOTNumberValueDelegate"); - self.delegate = (id)delegate; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.h deleted file mode 100755 index 0b7ccdf..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// LOTPathInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueInterpolator.h" -#import "LOTPlatformCompat.h" -#import "LOTBezierPath.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTPathInterpolator : LOTValueInterpolator - -- (LOTBezierPath *)pathForFrame:(NSNumber *)frame cacheLengths:(BOOL)cacheLengths; - -@property (nonatomic, weak, nullable) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.m deleted file mode 100755 index 41ef5ff..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPathInterpolator.m +++ /dev/null @@ -1,81 +0,0 @@ -// -// LOTPathInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPathInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTPathInterpolator - -- (LOTBezierPath *)pathForFrame:(NSNumber *)frame cacheLengths:(BOOL)cacheLengths { - CGFloat progress = [self progressForFrame:frame]; - if (self.hasDelegateOverride) { - CGPathRef callBackPath = [self.delegate pathForFrame:frame.floatValue - startKeyframe:self.leadingKeyframe.keyframeTime.floatValue - endKeyframe:self.trailingKeyframe.keyframeTime.floatValue - interpolatedProgress:progress]; - return [LOTBezierPath pathWithCGPath:callBackPath]; - } - - LOTBezierPath *returnPath = [[LOTBezierPath alloc] init]; - returnPath.cacheLengths = cacheLengths; - LOTBezierData *leadingData = self.leadingKeyframe.pathData; - LOTBezierData *trailingData = self.trailingKeyframe.pathData; - NSInteger vertexCount = leadingData ? leadingData.count : trailingData.count; - BOOL closePath = leadingData ? leadingData.closed : trailingData.closed; - CGPoint cp1 = CGPointMake(0, 0); - CGPoint cp2, p1, cp3 = CGPointZero; - CGPoint startPoint = CGPointMake(0, 0); - CGPoint startInTangent = CGPointMake(0, 0); - for (int i = 0; i < vertexCount; i++) { - if (progress == 0) { - cp2 = [leadingData inTangentAtIndex:i]; - p1 = [leadingData vertexAtIndex:i]; - cp3 = [leadingData outTangentAtIndex:i]; - } else if (progress == 1) { - cp2 = [trailingData inTangentAtIndex:i]; - p1 = [trailingData vertexAtIndex:i]; - cp3 = [trailingData outTangentAtIndex:i]; - } else { - cp2 = LOT_PointInLine([leadingData inTangentAtIndex:i], - [trailingData inTangentAtIndex:i], - progress); - p1 = LOT_PointInLine([leadingData vertexAtIndex:i], - [trailingData vertexAtIndex:i], - progress); - cp3 = LOT_PointInLine([leadingData outTangentAtIndex:i], - [trailingData outTangentAtIndex:i], - progress); - } - if (i == 0) { - startPoint = p1; - startInTangent = cp2; - [returnPath LOT_moveToPoint:p1]; - } else { - [returnPath LOT_addCurveToPoint:p1 controlPoint1:cp1 controlPoint2:cp2]; - } - cp1 = cp3; - } - - if (closePath) { - [returnPath LOT_addCurveToPoint:startPoint controlPoint1:cp3 controlPoint2:startInTangent]; - [returnPath LOT_closePath]; - } - - return returnPath; -} - -- (void)setValueDelegate:(id)delegate { - NSAssert(([delegate conformsToProtocol:@protocol(LOTPathValueDelegate)]), @"Path Interpolator set with incorrect callback type. Expected LOTPathValueDelegate"); - self.delegate = (id)delegate; -} - -- (BOOL)hasDelegateOverride { - return self.delegate != nil; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.h deleted file mode 100755 index 1564321..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LOTPointInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/12/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueInterpolator.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTPointInterpolator : LOTValueInterpolator - -- (CGPoint)pointValueForFrame:(NSNumber *)frame; - -@property (nonatomic, weak, nullable) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.m deleted file mode 100755 index 66701b4..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTPointInterpolator.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// LOTPointInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/12/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPointInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTPointInterpolator - -- (CGPoint)pointValueForFrame:(NSNumber *)frame { - CGFloat progress = [self progressForFrame:frame]; - CGPoint returnPoint; - if (progress == 0) { - returnPoint = self.leadingKeyframe.pointValue; - } else if (progress == 1) { - returnPoint = self.trailingKeyframe.pointValue; - } else if (!CGPointEqualToPoint(self.leadingKeyframe.spatialOutTangent, CGPointZero) || - !CGPointEqualToPoint(self.trailingKeyframe.spatialInTangent, CGPointZero)) { - // Spatial Bezier path - CGPoint outTan = LOT_PointAddedToPoint(self.leadingKeyframe.pointValue, self.leadingKeyframe.spatialOutTangent); - CGPoint inTan = LOT_PointAddedToPoint(self.trailingKeyframe.pointValue, self.trailingKeyframe.spatialInTangent); - returnPoint = LOT_PointInCubicCurve(self.leadingKeyframe.pointValue, outTan, inTan, self.trailingKeyframe.pointValue, progress); - } else { - returnPoint = LOT_PointInLine(self.leadingKeyframe.pointValue, self.trailingKeyframe.pointValue, progress); - } - if (self.hasDelegateOverride) { - return [self.delegate pointForFrame:frame.floatValue - startKeyframe:self.leadingKeyframe.keyframeTime.floatValue - endKeyframe:self.trailingKeyframe.keyframeTime.floatValue - interpolatedProgress:progress - startPoint:self.leadingKeyframe.pointValue - endPoint:self.trailingKeyframe.pointValue - currentPoint:returnPoint]; - } - return returnPoint; -} - -- (BOOL)hasDelegateOverride { - return self.delegate != nil; -} - -- (void)setValueDelegate:(id)delegate { - NSAssert(([delegate conformsToProtocol:@protocol(LOTPointValueDelegate)]), @"Point Interpolator set with incorrect callback type. Expected LOTPointValueDelegate"); - self.delegate = (id)delegate; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.h deleted file mode 100755 index a8b4e1f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// LOTSizeInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTValueInterpolator.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTSizeInterpolator : LOTValueInterpolator - -- (CGSize)sizeValueForFrame:(NSNumber *)frame; - -@property (nonatomic, weak, nullable) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.m deleted file mode 100755 index 4c06e64..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTSizeInterpolator.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// LOTSizeInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/13/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTPlatformCompat.h" -#import "LOTSizeInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@implementation LOTSizeInterpolator - -- (CGSize)sizeValueForFrame:(NSNumber *)frame { - CGFloat progress = [self progressForFrame:frame]; - CGSize returnSize; - if (progress == 0) { - returnSize = self.leadingKeyframe.sizeValue; - }else if (progress == 1) { - returnSize = self.trailingKeyframe.sizeValue; - } else { - returnSize = CGSizeMake(LOT_RemapValue(progress, 0, 1, self.leadingKeyframe.sizeValue.width, self.trailingKeyframe.sizeValue.width), - LOT_RemapValue(progress, 0, 1, self.leadingKeyframe.sizeValue.height, self.trailingKeyframe.sizeValue.height)); - } - if (self.hasDelegateOverride) { - return [self.delegate sizeForFrame:frame.floatValue - startKeyframe:self.leadingKeyframe.keyframeTime.floatValue - endKeyframe:self.trailingKeyframe.keyframeTime.floatValue - interpolatedProgress:progress startSize:self.leadingKeyframe.sizeValue - endSize:self.trailingKeyframe.sizeValue - currentSize:returnSize]; - } - return returnSize; -} - -- (BOOL)hasDelegateOverride { - return self.delegate != nil; -} - -- (void)setValueDelegate:(id)delegate { - NSAssert(([delegate conformsToProtocol:@protocol(LOTSizeValueDelegate)]), @"Size Interpolator set with incorrect callback type. Expected LOTSizeValueDelegate"); - self.delegate = (id)delegate; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.h deleted file mode 100755 index 251e375..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// LOTTransformInterpolator.h -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import -#import "LOTNumberInterpolator.h" -#import "LOTPointInterpolator.h" -#import "LOTSizeInterpolator.h" -#import "LOTKeyframe.h" -#import "LOTLayer.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTTransformInterpolator : NSObject - -+ (instancetype)transformForLayer:(LOTLayer *)layer; - -- (instancetype)initWithPosition:(NSArray *)position - rotation:(NSArray *)rotation - anchor:(NSArray *)anchor - scale:(NSArray *)scale; - -- (instancetype)initWithPositionX:(NSArray *)positionX - positionY:(NSArray *)positionY - rotation:(NSArray *)rotation - anchor:(NSArray *)anchor - scale:(NSArray *)scale; - -@property (nonatomic, strong) LOTTransformInterpolator * inputNode; - -@property (nonatomic, readonly) LOTPointInterpolator *positionInterpolator; -@property (nonatomic, readonly) LOTPointInterpolator *anchorInterpolator; -@property (nonatomic, readonly) LOTSizeInterpolator *scaleInterpolator; -@property (nonatomic, readonly) LOTNumberInterpolator *rotationInterpolator; -@property (nonatomic, readonly) LOTNumberInterpolator *positionXInterpolator; -@property (nonatomic, readonly) LOTNumberInterpolator *positionYInterpolator; -@property (nonatomic, strong, nullable) NSString *parentKeyName; - -- (CATransform3D)transformForFrame:(NSNumber *)frame; -- (BOOL)hasUpdateForFrame:(NSNumber *)frame; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.m deleted file mode 100755 index 50b142b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTTransformInterpolator.m +++ /dev/null @@ -1,127 +0,0 @@ -// -// LOTTransformInterpolator.m -// Lottie -// -// Created by brandon_withrow on 7/18/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTTransformInterpolator.h" - -// TODO BW Perf update, Cache transform - -@implementation LOTTransformInterpolator { - LOTPointInterpolator *_positionInterpolator; - LOTPointInterpolator *_anchorInterpolator; - LOTSizeInterpolator *_scaleInterpolator; - LOTNumberInterpolator *_rotationInterpolator; - LOTNumberInterpolator *_positionXInterpolator; - LOTNumberInterpolator *_positionYInterpolator; -} - -+ (instancetype)transformForLayer:(LOTLayer *)layer { - LOTTransformInterpolator *interpolator = nil; - if (layer.position) { - interpolator = [[LOTTransformInterpolator alloc] initWithPosition:layer.position.keyframes - rotation:layer.rotation.keyframes - anchor:layer.anchor.keyframes - scale:layer.scale.keyframes]; - } else { - interpolator = [[LOTTransformInterpolator alloc] initWithPositionX:layer.positionX.keyframes - positionY:layer.positionY.keyframes - rotation:layer.rotation.keyframes - anchor:layer.anchor.keyframes - scale:layer.scale.keyframes]; - } - interpolator.parentKeyName = [layer.layerName copy]; - return interpolator; -} - -- (instancetype)initWithPosition:(NSArray *)position - rotation:(NSArray *)rotation - anchor:(NSArray *)anchor - scale:(NSArray *)scale { - self = [super init]; - if (self) { - [self initializeWithPositionX:nil positionY:nil position:position rotation:rotation anchor:anchor scale:scale]; - } - return self; -} - -- (instancetype)initWithPositionX:(NSArray *)positionX - positionY:(NSArray *)positionY - rotation:(NSArray *)rotation - anchor:(NSArray *)anchor - scale:(NSArray *)scale { - self = [super init]; - if (self) { - [self initializeWithPositionX:positionX positionY:positionY position:nil rotation:rotation anchor:anchor scale:scale]; - } - return self; -} - - -- (void)initializeWithPositionX:(NSArray *)positionX - positionY:(NSArray *)positionY - position:(NSArray *)position - rotation:(NSArray *)rotation - anchor:(NSArray *)anchor - scale:(NSArray *)scale { - - if (position) { - _positionInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:position]; - } - if (positionY) { - _positionYInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:positionY]; - } - if (positionX) { - _positionXInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:positionX]; - } - _anchorInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:anchor]; - _scaleInterpolator = [[LOTSizeInterpolator alloc] initWithKeyframes:scale]; - _rotationInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:rotation]; -} - -- (BOOL)hasUpdateForFrame:(NSNumber *)frame { - BOOL inputUpdate = _inputNode ? [_inputNode hasUpdateForFrame:frame] : NO; - if (inputUpdate) { - return inputUpdate; - } - if (_positionInterpolator) { - return ([_positionInterpolator hasUpdateForFrame:frame] || - [_anchorInterpolator hasUpdateForFrame:frame] || - [_scaleInterpolator hasUpdateForFrame:frame] || - [_rotationInterpolator hasUpdateForFrame:frame]); - } - return ([_positionXInterpolator hasUpdateForFrame:frame] || - [_positionYInterpolator hasUpdateForFrame:frame] || - [_anchorInterpolator hasUpdateForFrame:frame] || - [_scaleInterpolator hasUpdateForFrame:frame] || - [_rotationInterpolator hasUpdateForFrame:frame]); -} - -- (CATransform3D)transformForFrame:(NSNumber *)frame { - CATransform3D baseXform = CATransform3DIdentity; - if (_inputNode) { - baseXform = [_inputNode transformForFrame:frame]; - } - CGPoint position = CGPointZero; - if (_positionInterpolator) { - position = [_positionInterpolator pointValueForFrame:frame]; - } - if (_positionXInterpolator && - _positionYInterpolator) { - position.x = [_positionXInterpolator floatValueForFrame:frame]; - position.y = [_positionYInterpolator floatValueForFrame:frame]; - } - CGPoint anchor = [_anchorInterpolator pointValueForFrame:frame]; - CGSize scale = [_scaleInterpolator sizeValueForFrame:frame]; - CGFloat rotation = [_rotationInterpolator floatValueForFrame:frame]; - CATransform3D translateXform = CATransform3DTranslate(baseXform, position.x, position.y, 0); - CATransform3D rotateXform = CATransform3DRotate(translateXform, rotation, 0, 0, 1); - CATransform3D scaleXform = CATransform3DScale(rotateXform, scale.width, scale.height, 1); - CATransform3D anchorXform = CATransform3DTranslate(scaleXform, -1 * anchor.x, -1 * anchor.y, 0); - return anchorXform; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.h deleted file mode 100755 index 775dcd8..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// LOTValueInterpolator.h -// Pods -// -// Created by brandon_withrow on 7/10/17. -// -// - -#import -#import "LOTKeyframe.h" -#import "LOTValueDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface LOTValueInterpolator : NSObject - -- (instancetype)initWithKeyframes:(NSArray *)keyframes; - -@property (nonatomic, weak, nullable) LOTKeyframe *leadingKeyframe; -@property (nonatomic, weak, nullable) LOTKeyframe *trailingKeyframe; -@property (nonatomic, readonly) BOOL hasDelegateOverride; - -- (void)setValueDelegate:(id _Nonnull)delegate; - -- (BOOL)hasUpdateForFrame:(NSNumber *)frame; -- (CGFloat)progressForFrame:(NSNumber *)frame; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.m deleted file mode 100755 index 840f61b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/InterpolatorNodes/LOTValueInterpolator.m +++ /dev/null @@ -1,167 +0,0 @@ -// -// LOTValueInterpolator.m -// Pods -// -// Created by brandon_withrow on 7/10/17. -// -// - -#import "LOTValueInterpolator.h" -#import "CGGeometry+LOTAdditions.h" - -@interface LOTValueInterpolator () - -@property (nonatomic, strong) NSArray *keyframes; - -@end - -@implementation LOTValueInterpolator - -- (instancetype)initWithKeyframes:(NSArray *)keyframes { - self = [super init]; - if (self) { - _keyframes = keyframes; - } - return self; -} - -- (BOOL)hasUpdateForFrame:(NSNumber *)frame { - if (self.hasDelegateOverride) { - return YES; - } - /* - Cases we dont update keyframe - if time is in span and leading keyframe is hold - if trailing keyframe is nil and time is after leading - if leading keyframe is nil and time is before trailing - */ - if (self.leadingKeyframe && - self.trailingKeyframe == nil && - self.leadingKeyframe.keyframeTime.floatValue < frame.floatValue) { - // Frame is after bounds of keyframes. Clip - return NO; - } - if (self.trailingKeyframe && - self.leadingKeyframe == nil && - self.trailingKeyframe.keyframeTime.floatValue > frame.floatValue) { - // Frame is before keyframes bounds. Clip. - return NO; - } - if (self.leadingKeyframe && self.trailingKeyframe && - self.leadingKeyframe.isHold && - self.leadingKeyframe.keyframeTime.floatValue < frame.floatValue && - self.trailingKeyframe.keyframeTime.floatValue > frame.floatValue) { - // Frame is in span and current span is a hold keyframe - return NO; - } - - return YES; -} - -- (void)updateKeyframeSpanForFrame:(NSNumber *)frame { - if (self.leadingKeyframe == nil && - self.trailingKeyframe == nil) { - // Set Initial Keyframes - LOTKeyframe *first = _keyframes.firstObject; - if (first.keyframeTime.floatValue > 0) { - self.trailingKeyframe = first; - } else { - self.leadingKeyframe = first; - if (_keyframes.count > 1) { - self.trailingKeyframe = _keyframes[1]; - } - } - } - if (self.trailingKeyframe && frame.floatValue >= self.trailingKeyframe.keyframeTime.floatValue) { - // Frame is after current span, can move forward - NSInteger index = [_keyframes indexOfObject:self.trailingKeyframe]; - BOOL keyframeFound = NO; - - LOTKeyframe *testLeading = self.trailingKeyframe; - LOTKeyframe *testTrailing = nil; - - while (keyframeFound == NO) { - index ++; - if (index < _keyframes.count) { - testTrailing = _keyframes[index]; - if (frame.floatValue < testTrailing.keyframeTime.floatValue) { - // This is the span. - keyframeFound = YES; - } else { - testLeading = testTrailing; - } - } else { - // Leading is Last object - testTrailing = nil; - keyframeFound = YES; - } - } - self.leadingKeyframe = testLeading; - self.trailingKeyframe = testTrailing; - } else if (self.leadingKeyframe && frame.floatValue < self.leadingKeyframe.keyframeTime.floatValue) { - // Frame is before current span, can move back a span - NSInteger index = [_keyframes indexOfObject:self.leadingKeyframe]; - BOOL keyframeFound = NO; - - LOTKeyframe *testLeading = nil; - LOTKeyframe *testTrailing = self.leadingKeyframe; - - while (keyframeFound == NO) { - index --; - if (index >= 0) { - testLeading = _keyframes[index]; - if (frame.floatValue >= testLeading.keyframeTime.floatValue) { - // This is the span. - keyframeFound = YES; - } else { - testTrailing = testLeading; - } - } else { - // Trailing is first object - testLeading = nil; - keyframeFound = YES; - } - } - self.leadingKeyframe = testLeading; - self.trailingKeyframe = testTrailing; - } -} - -- (CGFloat)progressForFrame:(NSNumber *)frame { - [self updateKeyframeSpanForFrame:frame]; - // At this point frame definitely exists between leading and trailing keyframes - if (self.leadingKeyframe.keyframeTime == frame) { - // Frame is leading keyframe - return 0; - } - if (self.trailingKeyframe == nil) { - // Frame is after end of keyframe timeline - return 0; - } - if (self.leadingKeyframe.isHold) { - // Hold Keyframe - return 0; - } - if (self.leadingKeyframe == nil) { - // Frame is before start of keyframe timeline - return 1; - } - - CGFloat progession = LOT_RemapValue(frame.floatValue, self.leadingKeyframe.keyframeTime.floatValue, self.trailingKeyframe.keyframeTime.floatValue, 0, 1); - - if ((self.leadingKeyframe.outTangent.x != self.leadingKeyframe.outTangent.y || - self.trailingKeyframe.inTangent.x != self.trailingKeyframe.inTangent.y) && - (!LOT_CGPointIsZero(self.leadingKeyframe.outTangent) && - !LOT_CGPointIsZero(self.trailingKeyframe.inTangent))) { - // Bezeir Time Curve - progession = LOT_CubicBezeirInterpolate(CGPointMake(0, 0), self.leadingKeyframe.outTangent, self.trailingKeyframe.inTangent, CGPointMake(1, 1), progession); - } - - return progession; -} - -- (void)setValueDelegate:(id _Nonnull)delegate { - NSAssert((NO), @"Interpolator does not support value callbacks"); -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.h deleted file mode 100755 index 1567e1f..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// LOTAnimatorNode.h -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import -#import "LOTPlatformCompat.h" -#import "LOTBezierPath.h" -#import "LOTKeypath.h" -#import "LOTValueDelegate.h" - -extern NSInteger indentation_level; -@interface LOTAnimatorNode : NSObject - -/// Initializes the node with and optional intput node and keyname. -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - keyName:(NSString *_Nullable)keyname; - -/// A dictionary of the value interpolators this node controls -@property (nonatomic, readonly, strong) NSDictionary * _Nullable valueInterpolators; - -/// The keyname of the node. Used for dynamically setting keyframe data. -@property (nonatomic, readonly, strong) NSString * _Nullable keyname; - -/// The current time in frames -@property (nonatomic, readonly, strong) NSNumber * _Nullable currentFrame; -/// The upstream animator node -@property (nonatomic, readonly, strong) LOTAnimatorNode * _Nullable inputNode; - -/// This nodes path in local object space -@property (nonatomic, strong) LOTBezierPath * _Nonnull localPath; -/// The sum of all paths in the tree including this node -@property (nonatomic, strong) LOTBezierPath * _Nonnull outputPath; - -/// Returns true if this node needs to update its contents for the given frame. To be overwritten by subclasses. -- (BOOL)needsUpdateForFrame:(NSNumber *_Nonnull)frame; - -/// Sets the current frame and performs any updates. Returns true if any updates were performed, locally or upstream. -- (BOOL)updateWithFrame:(NSNumber *_Nonnull)frame; -- (BOOL)updateWithFrame:(NSNumber *_Nonnull)frame - withModifierBlock:(void (^_Nullable)(LOTAnimatorNode * _Nonnull inputNode))modifier - forceLocalUpdate:(BOOL)forceUpdate; - -- (void)forceSetCurrentFrame:(NSNumber *_Nonnull)frame; - -@property (nonatomic, assign) BOOL pathShouldCacheLengths; -/// Update the local content for the frame. -- (void)performLocalUpdate; - -/// Rebuild all outputs for the node. This is called after upstream updates have been performed. -- (void)rebuildOutputs; - -- (void)logString:(NSString *_Nonnull)string; - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath; - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.m deleted file mode 100755 index e13d6b9..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTAnimatorNode.m +++ /dev/null @@ -1,131 +0,0 @@ -// -// LOTAnimatorNode.m -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import "LOTAnimatorNode.h" -#import "LOTHelpers.h" -#import "LOTValueInterpolator.h" - -NSInteger indentation_level = 0; - -@implementation LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - keyName:(NSString *_Nullable)keyname { - self = [super init]; - if (self) { - _keyname = keyname; - _inputNode = inputNode; - } - return self; -} - -/// To be overwritten by subclass. Defaults to YES -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return YES; -} - -/// The node checks if local update or if upstream update required. If upstream update outputs are rebuilt. If local update local update is performed. Returns no if no action -- (BOOL)updateWithFrame:(NSNumber *_Nonnull)frame { - return [self updateWithFrame:frame withModifierBlock:NULL forceLocalUpdate:NO]; -} - -- (BOOL)updateWithFrame:(NSNumber *_Nonnull)frame - withModifierBlock:(void (^_Nullable)(LOTAnimatorNode * _Nonnull inputNode))modifier - forceLocalUpdate:(BOOL)forceUpdate { - if ([_currentFrame isEqual:frame] && !forceUpdate) { - return NO; - } - if (ENABLE_DEBUG_LOGGING) [self logString:[NSString stringWithFormat:@"%lu %@ Checking for update", (unsigned long)self.hash, self.keyname]]; - BOOL localUpdate = [self needsUpdateForFrame:frame] || forceUpdate; - if (localUpdate && ENABLE_DEBUG_LOGGING) { - [self logString:[NSString stringWithFormat:@"%lu %@ Performing update", (unsigned long)self.hash, self.keyname]]; - } - BOOL inputUpdated = [_inputNode updateWithFrame:frame - withModifierBlock:modifier - forceLocalUpdate:forceUpdate]; - _currentFrame = frame; - if (localUpdate) { - [self performLocalUpdate]; - if (modifier) { - modifier(self); - } - } - - if (inputUpdated || localUpdate) { - [self rebuildOutputs]; - } - return (inputUpdated || localUpdate); -} - -- (void)forceSetCurrentFrame:(NSNumber *_Nonnull)frame { - _currentFrame = frame; -} - -- (void)logString:(NSString *)string { - NSMutableString *logString = [NSMutableString string]; - [logString appendString:@"|"]; - for (int i = 0; i < indentation_level; i ++) { - [logString appendString:@" "]; - } - [logString appendString:string]; - NSLog(@"%@ %@", NSStringFromClass([self class]), logString); -} - -// TOBO BW Perf, make updates perform only when necessarry. Currently everything in a node is updated -/// Performs any local content update and updates self.localPath -- (void)performLocalUpdate { - self.localPath = [[LOTBezierPath alloc] init]; -} - -/// Rebuilts outputs by adding localPath to inputNodes output path. -- (void)rebuildOutputs { - if (self.inputNode) { - self.outputPath = [self.inputNode.outputPath copy]; - [self.outputPath LOT_appendPath:self.localPath]; - } else { - self.outputPath = self.localPath; - } -} - -- (void)setPathShouldCacheLengths:(BOOL)pathShouldCacheLengths { - _pathShouldCacheLengths = pathShouldCacheLengths; - self.inputNode.pathShouldCacheLengths = pathShouldCacheLengths; -} - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath { - [self.inputNode searchNodesForKeypath:keypath]; - if ([keypath pushKey:self.keyname]) { - // Matches self. Check interpolators - if (keypath.endOfKeypath) { - // Add self - [keypath addSearchResultForCurrentPath:self]; - } else if (self.valueInterpolators[keypath.currentKey] != nil) { - [keypath pushKey:keypath.currentKey]; - // We have a match! - [keypath addSearchResultForCurrentPath:self]; - [keypath popKey]; - } - [keypath popKey]; - } -} - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath { - if ([keypath pushKey:self.keyname]) { - // Matches self. Check interpolators - LOTValueInterpolator *interpolator = self.valueInterpolators[keypath.currentKey]; - if (interpolator) { - // We have a match! - [interpolator setValueDelegate:delegate]; - } - [keypath popKey]; - } - [self.inputNode setValueDelegate:delegate forKeypath:keypath]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.h deleted file mode 100755 index c1af45e..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTRenderNode.h -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import "LOTAnimatorNode.h" - -@interface LOTRenderNode : LOTAnimatorNode - -@property (nonatomic, readonly, strong) CAShapeLayer * _Nonnull outputLayer; - -- (NSDictionary * _Nonnull)actionsForRenderLayer; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.m deleted file mode 100755 index b4651bf..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/LOTRenderNode.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// LOTRenderNode.m -// Pods -// -// Created by brandon_withrow on 6/27/17. -// -// - -#import "LOTRenderNode.h" - -@implementation LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - keyName:(NSString * _Nullable)keyname { - self = [super initWithInputNode:inputNode keyName:keyname]; - if (self) { - _outputLayer = [CAShapeLayer new]; - _outputLayer.actions = [self actionsForRenderLayer]; - } - return self; -} - -/// Layer Properties that need to disable implicit animations -- (NSDictionary * _Nonnull)actionsForRenderLayer { - return @{@"path": [NSNull null]}; -} - -/// Local interpolatores have changed. Update layer specific properties. -- (void)performLocalUpdate { - -} - -/// The path for rendering has changed. Do any rendering required. -- (void)rebuildOutputs { - -} - -- (LOTBezierPath *)localPath { - return self.inputNode.localPath; -} - -/// Forwards its input node's output path forwards downstream -- (LOTBezierPath *)outputPath { - return self.inputNode.outputPath; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.h deleted file mode 100755 index f4260cb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTTrimPathNode.h -// Lottie -// -// Created by brandon_withrow on 7/21/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTAnimatorNode.h" -#import "LOTShapeTrimPath.h" - -@interface LOTTrimPathNode : LOTAnimatorNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - trimPath:(LOTShapeTrimPath *_Nonnull)trimPath; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.m deleted file mode 100755 index 2bfbd70..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/ManipulatorNodes/LOTTrimPathNode.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// LOTTrimPathNode.m -// Lottie -// -// Created by brandon_withrow on 7/21/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTTrimPathNode.h" -#import "LOTNumberInterpolator.h" -#import "LOTPathAnimator.h" -#import "LOTCircleAnimator.h" -#import "LOTRoundedRectAnimator.h" -#import "LOTRenderGroup.h" - -@implementation LOTTrimPathNode { - LOTNumberInterpolator *_startInterpolator; - LOTNumberInterpolator *_endInterpolator; - LOTNumberInterpolator *_offsetInterpolator; - - CGFloat _startT; - CGFloat _endT; - CGFloat _offsetT; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - trimPath:(LOTShapeTrimPath *_Nonnull)trimPath { - self = [super initWithInputNode:inputNode keyName:trimPath.keyname]; - if (self) { - inputNode.pathShouldCacheLengths = YES; - _startInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:trimPath.start.keyframes]; - _endInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:trimPath.end.keyframes]; - _offsetInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:trimPath.offset.keyframes]; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Start" : _startInterpolator, - @"End" : _endInterpolator, - @"Offset" : _offsetInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return ([_startInterpolator hasUpdateForFrame:frame] || - [_endInterpolator hasUpdateForFrame:frame] || - [_offsetInterpolator hasUpdateForFrame:frame]); -} - -- (BOOL)updateWithFrame:(NSNumber *)frame - withModifierBlock:(void (^ _Nullable)(LOTAnimatorNode * _Nonnull))modifier - forceLocalUpdate:(BOOL)forceUpdate { - BOOL localUpdate = [self needsUpdateForFrame:frame]; - [self forceSetCurrentFrame:frame]; - if (localUpdate) { - [self performLocalUpdate]; - } - if (self.inputNode == nil) { - return localUpdate; - } - - BOOL inputUpdated = [self.inputNode updateWithFrame:frame withModifierBlock:^(LOTAnimatorNode * _Nonnull inputNode) { - if ([inputNode isKindOfClass:[LOTPathAnimator class]] || - [inputNode isKindOfClass:[LOTCircleAnimator class]] || - [inputNode isKindOfClass:[LOTRoundedRectAnimator class]]) { - [inputNode.localPath trimPathFromT:_startT toT:_endT offset:_offsetT]; - } - if (modifier) { - modifier(inputNode); - } - - } forceLocalUpdate:(localUpdate || forceUpdate)]; - - return inputUpdated; -} - -- (void)performLocalUpdate { - _startT = [_startInterpolator floatValueForFrame:self.currentFrame] / 100; - _endT = [_endInterpolator floatValueForFrame:self.currentFrame] / 100; - _offsetT = [_offsetInterpolator floatValueForFrame:self.currentFrame] / 360; -} - -- (void)rebuildOutputs { - // Skip this step. -} - -- (LOTBezierPath *)localPath { - return self.inputNode.localPath; -} - -/// Forwards its input node's output path forwards downstream -- (LOTBezierPath *)outputPath { - return self.inputNode.outputPath; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.h deleted file mode 100755 index 7cbfecb..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTFillRenderer.h -// Lottie -// -// Created by brandon_withrow on 6/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderNode.h" -#import "LOTShapeFill.h" - -@interface LOTFillRenderer : LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeFill:(LOTShapeFill *_Nonnull)fill; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.m deleted file mode 100755 index 31aeddf..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTFillRenderer.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// LOTFillRenderer.m -// Lottie -// -// Created by brandon_withrow on 6/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTFillRenderer.h" -#import "LOTColorInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "LOTHelpers.h" - -@implementation LOTFillRenderer { - LOTColorInterpolator *colorInterpolator_; - LOTNumberInterpolator *opacityInterpolator_; - BOOL _evenOddFillRule; - CALayer *centerPoint_DEBUG; -} - -- (instancetype)initWithInputNode:(LOTAnimatorNode *)inputNode - shapeFill:(LOTShapeFill *)fill { - self = [super initWithInputNode:inputNode keyName:fill.keyname]; - if (self) { - colorInterpolator_ = [[LOTColorInterpolator alloc] initWithKeyframes:fill.color.keyframes]; - opacityInterpolator_ = [[LOTNumberInterpolator alloc] initWithKeyframes:fill.opacity.keyframes]; - centerPoint_DEBUG = [CALayer layer]; - centerPoint_DEBUG.bounds = CGRectMake(0, 0, 20, 20); - if (ENABLE_DEBUG_SHAPES) { - [self.outputLayer addSublayer:centerPoint_DEBUG]; - } - _evenOddFillRule = fill.evenOddFillRule; - - self.outputLayer.fillRule = _evenOddFillRule ? @"even-odd" : @"non-zero"; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Color" : colorInterpolator_, - @"Opacity" : opacityInterpolator_}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return [colorInterpolator_ hasUpdateForFrame:frame] || [opacityInterpolator_ hasUpdateForFrame:frame]; -} - -- (void)performLocalUpdate { - centerPoint_DEBUG.backgroundColor = [colorInterpolator_ colorForFrame:self.currentFrame]; - centerPoint_DEBUG.borderColor = [UIColor lightGrayColor].CGColor; - centerPoint_DEBUG.borderWidth = 2.f; - self.outputLayer.fillColor = [colorInterpolator_ colorForFrame:self.currentFrame]; - self.outputLayer.opacity = [opacityInterpolator_ floatValueForFrame:self.currentFrame]; -} - -- (void)rebuildOutputs { - self.outputLayer.path = self.inputNode.outputPath.CGPath; -} - -- (NSDictionary *)actionsForRenderLayer { - return @{@"backgroundColor": [NSNull null], - @"fillColor": [NSNull null], - @"opacity" : [NSNull null]}; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.h deleted file mode 100755 index 3ff1496..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTGradientFillRender.h -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderNode.h" -#import "LOTShapeGradientFill.h" - -@interface LOTGradientFillRender : LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeGradientFill:(LOTShapeGradientFill *_Nonnull)fill; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.m deleted file mode 100755 index 86909cc..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.m +++ /dev/null @@ -1,156 +0,0 @@ -// -// LOTGradientFillRender.m -// Lottie -// -// Created by brandon_withrow on 7/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTGradientFillRender.h" -#import "LOTArrayInterpolator.h" -#import "LOTPointInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "CGGeometry+LOTAdditions.h" -#import "LOTHelpers.h" -#import "LOTRadialGradientLayer.h" - -@implementation LOTGradientFillRender { - BOOL _evenOddFillRule; - CALayer *centerPoint_DEBUG; - - CAShapeLayer *_maskShape; - LOTRadialGradientLayer *_gradientOpacityLayer; - LOTRadialGradientLayer *_gradientLayer; - NSInteger _numberOfPositions; - - CGPoint _startPoint; - CGPoint _endPoint; - - LOTArrayInterpolator *_gradientInterpolator; - LOTPointInterpolator *_startPointInterpolator; - LOTPointInterpolator *_endPointInterpolator; - LOTNumberInterpolator *_opacityInterpolator; -} - -- (instancetype)initWithInputNode:(LOTAnimatorNode *)inputNode - shapeGradientFill:(LOTShapeGradientFill *)fill { - self = [super initWithInputNode:inputNode keyName:fill.keyname]; - if (self) { - _gradientInterpolator = [[LOTArrayInterpolator alloc] initWithKeyframes:fill.gradient.keyframes]; - _startPointInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:fill.startPoint.keyframes]; - _endPointInterpolator = [[LOTPointInterpolator alloc] initWithKeyframes:fill.endPoint.keyframes]; - _opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:fill.opacity.keyframes]; - _numberOfPositions = fill.numberOfColors.integerValue; - - _evenOddFillRule = fill.evenOddFillRule; - CALayer *wrapperLayer = [CALayer new]; - _maskShape = [CAShapeLayer new]; - _maskShape.fillRule = _evenOddFillRule ? @"even-odd" : @"non-zero"; - _maskShape.fillColor = [UIColor whiteColor].CGColor; - _maskShape.actions = @{@"path": [NSNull null]}; - - _gradientOpacityLayer = [LOTRadialGradientLayer new]; - _gradientOpacityLayer.isRadial = (fill.type == LOTGradientTypeRadial); - _gradientOpacityLayer.actions = @{@"startPoint" : [NSNull null], - @"endPoint" : [NSNull null], - @"opacity" : [NSNull null], - @"locations" : [NSNull null], - @"colors" : [NSNull null], - @"bounds" : [NSNull null], - @"anchorPoint" : [NSNull null], - @"isRadial" : [NSNull null]}; - _gradientOpacityLayer.mask = _maskShape; - [wrapperLayer addSublayer:_gradientOpacityLayer]; - - _gradientLayer = [LOTRadialGradientLayer new]; - _gradientLayer.isRadial = (fill.type == LOTGradientTypeRadial); - _gradientLayer.mask = wrapperLayer; - _gradientLayer.actions = [_gradientOpacityLayer.actions copy]; - [self.outputLayer addSublayer:_gradientLayer]; - - centerPoint_DEBUG = [CALayer layer]; - centerPoint_DEBUG.bounds = CGRectMake(0, 0, 20, 20); - if (ENABLE_DEBUG_SHAPES) { - [self.outputLayer addSublayer:centerPoint_DEBUG]; - } - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Start Point" : _startPointInterpolator, - @"End Point" : _endPointInterpolator, - @"Opacity" : _opacityInterpolator}; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return ([_gradientInterpolator hasUpdateForFrame:frame] || - [_startPointInterpolator hasUpdateForFrame:frame] || - [_endPointInterpolator hasUpdateForFrame:frame] || - [_opacityInterpolator hasUpdateForFrame:frame]); -} - -- (void)performLocalUpdate { - centerPoint_DEBUG.backgroundColor = [UIColor magentaColor].CGColor; - centerPoint_DEBUG.borderColor = [UIColor lightGrayColor].CGColor; - centerPoint_DEBUG.borderWidth = 2.f; - _startPoint = [_startPointInterpolator pointValueForFrame:self.currentFrame]; - _endPoint = [_endPointInterpolator pointValueForFrame:self.currentFrame]; - self.outputLayer.opacity = [_opacityInterpolator floatValueForFrame:self.currentFrame]; - NSArray *numberArray = [_gradientInterpolator numberArrayForFrame:self.currentFrame]; - NSMutableArray *colorArray = [NSMutableArray array]; - NSMutableArray *locationsArray = [NSMutableArray array]; - - NSMutableArray *opacityArray = [NSMutableArray array]; - NSMutableArray *opacitylocationsArray = [NSMutableArray array]; - for (int i = 0; i < _numberOfPositions; i++) { - int ix = i * 4; - NSNumber *location = numberArray[ix]; - NSNumber *r = numberArray[(ix + 1)]; - NSNumber *g = numberArray[(ix + 2)]; - NSNumber *b = numberArray[(ix + 3)]; - [locationsArray addObject:location]; - UIColor *color = [UIColor colorWithRed:r.floatValue green:g.floatValue blue:b.floatValue alpha:1]; - [colorArray addObject:(id)(color.CGColor)]; - } - for (NSInteger i = (_numberOfPositions * 4); i < numberArray.count; i = i + 2) { - NSNumber *opacityLocation = numberArray[i]; - [opacitylocationsArray addObject:opacityLocation]; - NSNumber *opacity = numberArray[i + 1]; - UIColor *opacityColor = [UIColor colorWithWhite:1 alpha:opacity.floatValue]; - [opacityArray addObject:(id)(opacityColor.CGColor)]; - } - if (opacityArray.count == 0) { - _gradientOpacityLayer.backgroundColor = [UIColor whiteColor].CGColor; - } else { - _gradientOpacityLayer.startPoint = _startPoint; - _gradientOpacityLayer.endPoint = _endPoint; - _gradientOpacityLayer.locations = opacitylocationsArray; - _gradientOpacityLayer.colors = opacityArray; - } - _gradientLayer.startPoint = _startPoint; - _gradientLayer.endPoint = _endPoint; - _gradientLayer.locations = locationsArray; - _gradientLayer.colors = colorArray; -} - -- (void)rebuildOutputs { - CGRect frame = [self.inputNode.outputPath bounds]; - CGPoint modifiedAnchor = CGPointMake(-frame.origin.x / frame.size.width, - -frame.origin.y / frame.size.height); - _maskShape.path = self.inputNode.outputPath.CGPath; - _gradientOpacityLayer.bounds = frame; - _gradientOpacityLayer.anchorPoint = modifiedAnchor; - - _gradientLayer.bounds = frame; - _gradientLayer.anchorPoint = modifiedAnchor; - -} - -- (NSDictionary *)actionsForRenderLayer { - return @{@"backgroundColor": [NSNull null], - @"fillColor": [NSNull null], - @"opacity" : [NSNull null]}; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.h deleted file mode 100755 index 8cc9b89..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// LOTRenderGroup.h -// Lottie -// -// Created by brandon_withrow on 6/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderNode.h" - -@interface LOTRenderGroup : LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode * _Nullable)inputNode - contents:(NSArray * _Nonnull)contents - keyname:(NSString * _Nullable)keyname; - -@property (nonatomic, strong, readonly) CALayer * _Nonnull containerLayer; - -@end - - diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.m deleted file mode 100755 index e1c78fd..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRenderGroup.m +++ /dev/null @@ -1,237 +0,0 @@ -// -// LOTRenderGroup.m -// Lottie -// -// Created by brandon_withrow on 6/27/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderGroup.h" -#import "LOTModels.h" -#import "LOTPathAnimator.h" -#import "LOTFillRenderer.h" -#import "LOTStrokeRenderer.h" -#import "LOTNumberInterpolator.h" -#import "LOTTransformInterpolator.h" -#import "LOTCircleAnimator.h" -#import "LOTRoundedRectAnimator.h" -#import "LOTTrimPathNode.h" -#import "LOTShapeStar.h" -#import "LOTPolygonAnimator.h" -#import "LOTPolystarAnimator.h" -#import "LOTShapeGradientFill.h" -#import "LOTGradientFillRender.h" -#import "LOTRepeaterRenderer.h" -#import "LOTShapeRepeater.h" - -@implementation LOTRenderGroup { - LOTAnimatorNode *_rootNode; - LOTBezierPath *_outputPath; - LOTBezierPath *_localPath; - BOOL _rootNodeHasUpdate; - LOTNumberInterpolator *_opacityInterpolator; - LOTTransformInterpolator *_transformInterolator; -} - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode * _Nullable)inputNode - contents:(NSArray * _Nonnull)contents - keyname:(NSString * _Nullable)keyname { - self = [super initWithInputNode:inputNode keyName:keyname]; - if (self) { - _containerLayer = [CALayer layer]; - _containerLayer.actions = @{@"transform": [NSNull null], - @"opacity": [NSNull null]}; - [self buildContents:contents]; - } - return self; -} - -- (NSDictionary *)valueInterpolators { - if (_opacityInterpolator && _transformInterolator) { - return @{@"Opacity" : _opacityInterpolator, - @"Position" : _transformInterolator.positionInterpolator, - @"Scale" : _transformInterolator.scaleInterpolator, - @"Rotation" : _transformInterolator.scaleInterpolator, - @"Anchor Point" : _transformInterolator.anchorInterpolator, - // Deprecated - @"Transform.Opacity" : _opacityInterpolator, - @"Transform.Position" : _transformInterolator.positionInterpolator, - @"Transform.Scale" : _transformInterolator.scaleInterpolator, - @"Transform.Rotation" : _transformInterolator.scaleInterpolator, - @"Transform.Anchor Point" : _transformInterolator.anchorInterpolator - }; - } - return nil; -} - -- (void)buildContents:(NSArray *)contents { - LOTAnimatorNode *previousNode = nil; - LOTShapeTransform *transform; - for (id item in contents) { - if ([item isKindOfClass:[LOTShapeFill class]]) { - LOTFillRenderer *fillRenderer = [[LOTFillRenderer alloc] initWithInputNode:previousNode - shapeFill:(LOTShapeFill *)item]; - [self.containerLayer insertSublayer:fillRenderer.outputLayer atIndex:0]; - previousNode = fillRenderer; - } else if ([item isKindOfClass:[LOTShapeStroke class]]) { - LOTStrokeRenderer *strokRenderer = [[LOTStrokeRenderer alloc] initWithInputNode:previousNode - shapeStroke:(LOTShapeStroke *)item]; - [self.containerLayer insertSublayer:strokRenderer.outputLayer atIndex:0]; - previousNode = strokRenderer; - } else if ([item isKindOfClass:[LOTShapePath class]]) { - LOTPathAnimator *pathAnimator = [[LOTPathAnimator alloc] initWithInputNode:previousNode - shapePath:(LOTShapePath *)item]; - previousNode = pathAnimator; - } else if ([item isKindOfClass:[LOTShapeRectangle class]]) { - LOTRoundedRectAnimator *rectAnimator = [[LOTRoundedRectAnimator alloc] initWithInputNode:previousNode - shapeRectangle:(LOTShapeRectangle *)item]; - previousNode = rectAnimator; - } else if ([item isKindOfClass:[LOTShapeCircle class]]) { - LOTCircleAnimator *circleAnimator = [[LOTCircleAnimator alloc] initWithInputNode:previousNode - shapeCircle:(LOTShapeCircle *)item]; - previousNode = circleAnimator; - } else if ([item isKindOfClass:[LOTShapeGroup class]]) { - LOTShapeGroup *shapeGroup = (LOTShapeGroup *)item; - LOTRenderGroup *renderGroup = [[LOTRenderGroup alloc] initWithInputNode:previousNode contents:shapeGroup.items keyname:shapeGroup.keyname]; - [self.containerLayer insertSublayer:renderGroup.containerLayer atIndex:0]; - previousNode = renderGroup; - } else if ([item isKindOfClass:[LOTShapeTransform class]]) { - transform = (LOTShapeTransform *)item; - } else if ([item isKindOfClass:[LOTShapeTrimPath class]]) { - LOTTrimPathNode *trim = [[LOTTrimPathNode alloc] initWithInputNode:previousNode trimPath:(LOTShapeTrimPath *)item]; - previousNode = trim; - } else if ([item isKindOfClass:[LOTShapeStar class]]) { - LOTShapeStar *star = (LOTShapeStar *)item; - if (star.type == LOTPolystarShapeStar) { - LOTPolystarAnimator *starAnimator = [[LOTPolystarAnimator alloc] initWithInputNode:previousNode shapeStar:star]; - previousNode = starAnimator; - } - if (star.type == LOTPolystarShapePolygon) { - LOTPolygonAnimator *polygonAnimator = [[LOTPolygonAnimator alloc] initWithInputNode:previousNode shapePolygon:star]; - previousNode = polygonAnimator; - } - } else if ([item isKindOfClass:[LOTShapeGradientFill class]]) { - LOTGradientFillRender *gradientFill = [[LOTGradientFillRender alloc] initWithInputNode:previousNode shapeGradientFill:(LOTShapeGradientFill *)item]; - previousNode = gradientFill; - [self.containerLayer insertSublayer:gradientFill.outputLayer atIndex:0]; - } else if ([item isKindOfClass:[LOTShapeRepeater class]]) { - LOTRepeaterRenderer *repeater = [[LOTRepeaterRenderer alloc] initWithInputNode:previousNode shapeRepeater:(LOTShapeRepeater *)item]; - previousNode = repeater; - [self.containerLayer insertSublayer:repeater.outputLayer atIndex:0]; - } - } - if (transform) { - _opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:transform.opacity.keyframes]; - _transformInterolator = [[LOTTransformInterpolator alloc] initWithPosition:transform.position.keyframes - rotation:transform.rotation.keyframes - anchor:transform.anchor.keyframes - scale:transform.scale.keyframes]; - } - _rootNode = previousNode; -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - return ([_opacityInterpolator hasUpdateForFrame:frame] || - [_transformInterolator hasUpdateForFrame:frame] || - _rootNodeHasUpdate); - -} - -- (BOOL)updateWithFrame:(NSNumber *)frame withModifierBlock:(void (^ _Nullable)(LOTAnimatorNode * _Nonnull))modifier forceLocalUpdate:(BOOL)forceUpdate { - indentation_level = indentation_level + 1; - _rootNodeHasUpdate = [_rootNode updateWithFrame:frame withModifierBlock:modifier forceLocalUpdate:forceUpdate]; - indentation_level = indentation_level - 1; - BOOL update = [super updateWithFrame:frame withModifierBlock:modifier forceLocalUpdate:forceUpdate]; - return update; -} - -- (void)performLocalUpdate { - if (_opacityInterpolator) { - self.containerLayer.opacity = [_opacityInterpolator floatValueForFrame:self.currentFrame]; - } - if (_transformInterolator) { - CATransform3D xform = [_transformInterolator transformForFrame:self.currentFrame]; - self.containerLayer.transform = xform; - - CGAffineTransform appliedXform = CATransform3DGetAffineTransform(xform); - _localPath = [_rootNode.outputPath copy]; - [_localPath LOT_applyTransform:appliedXform]; - } else { - _localPath = [_rootNode.outputPath copy]; - } -} - -- (void)rebuildOutputs { - if (self.inputNode) { - _outputPath = [self.inputNode.outputPath copy]; - [_outputPath LOT_appendPath:self.localPath]; - } else { - _outputPath = self.localPath; - } -} - -- (void)setPathShouldCacheLengths:(BOOL)pathShouldCacheLengths { - [super setPathShouldCacheLengths:pathShouldCacheLengths]; - _rootNode.pathShouldCacheLengths = pathShouldCacheLengths; -} - -- (LOTBezierPath *)localPath { - return _localPath; -} - -- (LOTBezierPath *)outputPath { - return _outputPath; -} - -- (void)searchNodesForKeypath:(LOTKeypath * _Nonnull)keypath { - [self.inputNode searchNodesForKeypath:keypath]; - if ([keypath pushKey:self.keyname]) { - // Matches self. Dig deeper. - // Check interpolators - - if ([keypath pushKey:@"Transform"]) { - // Matches a Transform interpolator! - if (self.valueInterpolators[keypath.currentKey] != nil) { - [keypath pushKey:keypath.currentKey]; - [keypath addSearchResultForCurrentPath:self]; - [keypath popKey]; - } - [keypath popKey]; - } - - if (keypath.endOfKeypath) { - // We have a match! - [keypath addSearchResultForCurrentPath:self]; - } - // Check child nodes - [_rootNode searchNodesForKeypath:keypath]; - [keypath popKey]; - } -} - -- (void)setValueDelegate:(id _Nonnull)delegate - forKeypath:(LOTKeypath * _Nonnull)keypath { - if ([keypath pushKey:self.keyname]) { - // Matches self. Dig deeper. - // Check interpolators - if ([keypath pushKey:@"Transform"]) { - // Matches a Transform interpolator! - LOTValueInterpolator *interpolator = self.valueInterpolators[keypath.currentKey]; - if (interpolator) { - // We have a match! - [interpolator setValueDelegate:delegate]; - } - [keypath popKey]; - } - - // Check child nodes - [_rootNode setValueDelegate:delegate forKeypath:keypath]; - - [keypath popKey]; - } - - // Check upstream - [self.inputNode setValueDelegate:delegate forKeypath:keypath]; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.h deleted file mode 100755 index acf1231..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// LOTRepeaterRenderer.h -// Lottie -// -// Created by brandon_withrow on 7/28/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderNode.h" -#import "LOTShapeRepeater.h" - -@interface LOTRepeaterRenderer : LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeRepeater:(LOTShapeRepeater *_Nonnull)repeater; - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.m deleted file mode 100755 index e20c232..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTRepeaterRenderer.m +++ /dev/null @@ -1,102 +0,0 @@ -// -// LOTRepeaterRenderer.m -// Lottie -// -// Created by brandon_withrow on 7/28/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRepeaterRenderer.h" -#import "LOTTransformInterpolator.h" -#import "LOTNumberInterpolator.h" -#import "LOTHelpers.h" - -@implementation LOTRepeaterRenderer { - LOTTransformInterpolator *_transformInterpolator; - LOTNumberInterpolator *_copiesInterpolator; - LOTNumberInterpolator *_offsetInterpolator; - LOTNumberInterpolator *_startOpacityInterpolator; - LOTNumberInterpolator *_endOpacityInterpolator; - - CALayer *_instanceLayer; - CAReplicatorLayer *_replicatorLayer; - CALayer *centerPoint_DEBUG; -} - -- (instancetype)initWithInputNode:(LOTAnimatorNode *)inputNode - shapeRepeater:(LOTShapeRepeater *)repeater { - self = [super initWithInputNode:inputNode keyName:repeater.keyname]; - if (self) { - _transformInterpolator = [[LOTTransformInterpolator alloc] initWithPosition:repeater.position.keyframes - rotation:repeater.rotation.keyframes - anchor:repeater.anchorPoint.keyframes - scale:repeater.scale.keyframes]; - _copiesInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:repeater.copies.keyframes]; - _offsetInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:repeater.offset.keyframes]; - _startOpacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:repeater.startOpacity.keyframes]; - _endOpacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:repeater.endOpacity.keyframes]; - - _instanceLayer = [CALayer layer]; - [self recursivelyAddChildLayers:inputNode]; - - _replicatorLayer = [CAReplicatorLayer layer]; - _replicatorLayer.actions = @{@"instanceCount" : [NSNull null], - @"instanceTransform" : [NSNull null], - @"instanceAlphaOffset" : [NSNull null]}; - [_replicatorLayer addSublayer:_instanceLayer]; - [self.outputLayer addSublayer:_replicatorLayer]; - - centerPoint_DEBUG = [CALayer layer]; - centerPoint_DEBUG.bounds = CGRectMake(0, 0, 20, 20); - if (ENABLE_DEBUG_SHAPES) { - [self.outputLayer addSublayer:centerPoint_DEBUG]; - } - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Copies" : _copiesInterpolator, - @"Offset" : _offsetInterpolator, - @"Transform.Anchor Point" : _transformInterpolator.anchorInterpolator, - @"Transform.Position" : _transformInterpolator.positionInterpolator, - @"Transform.Scale" : _transformInterpolator.scaleInterpolator, - @"Transform.Rotation" : _transformInterpolator.rotationInterpolator, - @"Transform.Start Opacity" : _startOpacityInterpolator, - @"Transform.End Opacity" : _endOpacityInterpolator}; -} - -- (void)recursivelyAddChildLayers:(LOTAnimatorNode *)node { - if ([node isKindOfClass:[LOTRenderNode class]]) { - [_instanceLayer addSublayer:[(LOTRenderNode *)node outputLayer]]; - } - if (![node isKindOfClass:[LOTRepeaterRenderer class]] && - node.inputNode) { - [self recursivelyAddChildLayers:node.inputNode]; - } -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - // TODO BW Add offset ability - return ([_transformInterpolator hasUpdateForFrame:frame] || - [_copiesInterpolator hasUpdateForFrame:frame] || - [_startOpacityInterpolator hasUpdateForFrame:frame] || - [_endOpacityInterpolator hasUpdateForFrame:frame]); -} - -- (void)performLocalUpdate { - centerPoint_DEBUG.backgroundColor = [UIColor greenColor].CGColor; - centerPoint_DEBUG.borderColor = [UIColor lightGrayColor].CGColor; - centerPoint_DEBUG.borderWidth = 2.f; - - CGFloat copies = ceilf([_copiesInterpolator floatValueForFrame:self.currentFrame]); - _replicatorLayer.instanceCount = (NSInteger)copies; - _replicatorLayer.instanceTransform = [_transformInterpolator transformForFrame:self.currentFrame]; - CGFloat startOpacity = [_startOpacityInterpolator floatValueForFrame:self.currentFrame]; - CGFloat endOpacity = [_endOpacityInterpolator floatValueForFrame:self.currentFrame]; - CGFloat opacityStep = (endOpacity - startOpacity) / copies; - _instanceLayer.opacity = startOpacity; - _replicatorLayer.instanceAlphaOffset = opacityStep; -} - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.h b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.h deleted file mode 100755 index b7c6a80..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// LOTStrokeRenderer.h -// Lottie -// -// Created by brandon_withrow on 7/17/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTRenderNode.h" -#import "LOTShapeStroke.h" - -@interface LOTStrokeRenderer : LOTRenderNode - -- (instancetype _Nonnull)initWithInputNode:(LOTAnimatorNode *_Nullable)inputNode - shapeStroke:(LOTShapeStroke *_Nonnull)stroke; - - -@end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.m b/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.m deleted file mode 100755 index 125d93b..0000000 --- a/ios/Classes/Lottie/lottie-ios/Classes/RenderSystem/RenderNodes/LOTStrokeRenderer.m +++ /dev/null @@ -1,122 +0,0 @@ -// -// LOTStrokeRenderer.m -// Lottie -// -// Created by brandon_withrow on 7/17/17. -// Copyright © 2017 Airbnb. All rights reserved. -// - -#import "LOTStrokeRenderer.h" -#import "LOTColorInterpolator.h" -#import "LOTNumberInterpolator.h" - -@implementation LOTStrokeRenderer { - LOTColorInterpolator *_colorInterpolator; - LOTNumberInterpolator *_opacityInterpolator; - LOTNumberInterpolator *_widthInterpolator; - LOTNumberInterpolator *_dashOffsetInterpolator; - NSArray *_dashPatternInterpolators; -} - -- (instancetype)initWithInputNode:(LOTAnimatorNode *)inputNode - shapeStroke:(LOTShapeStroke *)stroke { - self = [super initWithInputNode:inputNode keyName:stroke.keyname]; - if (self) { - _colorInterpolator = [[LOTColorInterpolator alloc] initWithKeyframes:stroke.color.keyframes]; - _opacityInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:stroke.opacity.keyframes]; - _widthInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:stroke.width.keyframes]; - - NSMutableArray *dashPatternIntpolators = [NSMutableArray array]; - NSMutableArray *dashPatterns = [NSMutableArray array]; - for (LOTKeyframeGroup *keyframegroup in stroke.lineDashPattern) { - LOTNumberInterpolator *interpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:keyframegroup.keyframes]; - [dashPatternIntpolators addObject:interpolator]; - if (dashPatterns && keyframegroup.keyframes.count == 1) { - LOTKeyframe *first = keyframegroup.keyframes.firstObject; - [dashPatterns addObject:@(first.floatValue)]; - } - if (keyframegroup.keyframes.count > 1) { - dashPatterns = nil; - } - } - - if (dashPatterns.count) { - self.outputLayer.lineDashPattern = dashPatterns; - } else { - _dashPatternInterpolators = dashPatternIntpolators; - } - - if (stroke.dashOffset) { - _dashOffsetInterpolator = [[LOTNumberInterpolator alloc] initWithKeyframes:stroke.dashOffset.keyframes]; - } - - self.outputLayer.fillColor = nil; - self.outputLayer.lineCap = stroke.capType == LOTLineCapTypeRound ? kCALineCapRound : kCALineCapButt; - switch (stroke.joinType) { - case LOTLineJoinTypeBevel: - self.outputLayer.lineJoin = kCALineJoinBevel; - break; - case LOTLineJoinTypeMiter: - self.outputLayer.lineJoin = kCALineJoinMiter; - break; - case LOTLineJoinTypeRound: - self.outputLayer.lineJoin = kCALineJoinRound; - break; - default: - break; - } - } - return self; -} - -- (NSDictionary *)valueInterpolators { - return @{@"Color" : _colorInterpolator, - @"Opacity" : _opacityInterpolator, - @"Stroke Width" : _widthInterpolator}; -} - -- (void)_updateLineDashPatternsForFrame:(NSNumber *)frame { - if (_dashPatternInterpolators.count) { - NSMutableArray *lineDashPatterns = [NSMutableArray array]; - CGFloat dashTotal = 0; - for (LOTNumberInterpolator *interpolator in _dashPatternInterpolators) { - CGFloat patternValue = [interpolator floatValueForFrame:frame]; - dashTotal = dashTotal + patternValue; - [lineDashPatterns addObject:@(patternValue)]; - } - if (dashTotal > 0) { - self.outputLayer.lineDashPattern = lineDashPatterns; - } - } -} - -- (BOOL)needsUpdateForFrame:(NSNumber *)frame { - [self _updateLineDashPatternsForFrame:frame]; - BOOL dashOffset = NO; - if (_dashOffsetInterpolator) { - dashOffset = [_dashOffsetInterpolator hasUpdateForFrame:frame]; - } - return (dashOffset || - [_colorInterpolator hasUpdateForFrame:frame] || - [_opacityInterpolator hasUpdateForFrame:frame] || - [_widthInterpolator hasUpdateForFrame:frame]); -} - -- (void)performLocalUpdate { - self.outputLayer.lineDashPhase = [_dashOffsetInterpolator floatValueForFrame:self.currentFrame]; - self.outputLayer.strokeColor = [_colorInterpolator colorForFrame:self.currentFrame]; - self.outputLayer.lineWidth = [_widthInterpolator floatValueForFrame:self.currentFrame]; - self.outputLayer.opacity = [_opacityInterpolator floatValueForFrame:self.currentFrame]; -} - -- (void)rebuildOutputs { - self.outputLayer.path = self.inputNode.outputPath.CGPath; -} - -- (NSDictionary *)actionsForRenderLayer { - return @{@"strokeColor": [NSNull null], - @"lineWidth": [NSNull null], - @"opacity" : [NSNull null]}; -} - -@end diff --git a/ios/Classes/Lottie/TiAnimationLottieView.h b/ios/Classes/TiAnimationAnimationView.h similarity index 72% rename from ios/Classes/Lottie/TiAnimationLottieView.h rename to ios/Classes/TiAnimationAnimationView.h index 3e3b5be..4477b15 100644 --- a/ios/Classes/Lottie/TiAnimationLottieView.h +++ b/ios/Classes/TiAnimationAnimationView.h @@ -10,16 +10,15 @@ NS_ASSUME_NONNULL_BEGIN @class LOTAnimationView; -@interface TiAnimationLottieView : TiUIView +@interface TiAnimationAnimationView : TiUIView @property (nonatomic, retain) LOTAnimationView *animationView; -- (void)playWithCompletionHandler:(KrollCallback * __nullable)callback; -- (void)playFromFrame:(NSNumber *)fromFrame toFrame:(NSNumber *)toFrame completion:(KrollCallback * __nullable)callback; -- (void)playFromProgress:(NSNumber *)fromProgress toProgress:(NSNumber *)toProgress completion:(KrollCallback * __nullable)callback; +- (void)playWithCompletionHandler:(KrollCallback *__nullable)callback; +- (void)playFromFrame:(NSNumber *)fromFrame toFrame:(NSNumber *)toFrame completion:(KrollCallback *__nullable)callback; +- (void)playFromProgress:(NSNumber *)fromProgress toProgress:(NSNumber *)toProgress completion:(KrollCallback *__nullable)callback; - (void)pause; - (void)stop; -- (void)addView:(UIView *)view toLayer:(NSString *)layer applyTransform:(BOOL)applyTransform; - (void)addView:(UIView *)view toKeypathLayer:(NSString *)layer; - (void)setProgress:(CGFloat)progress; diff --git a/ios/Classes/Lottie/TiAnimationLottieView.m b/ios/Classes/TiAnimationAnimationView.m similarity index 63% rename from ios/Classes/Lottie/TiAnimationLottieView.m rename to ios/Classes/TiAnimationAnimationView.m index 7291f4e..40f1fdb 100644 --- a/ios/Classes/Lottie/TiAnimationLottieView.m +++ b/ios/Classes/TiAnimationAnimationView.m @@ -5,16 +5,16 @@ * Please see the LICENSE included with this distribution for details. */ -#import "TiAnimationLottieView.h" -#import "Lottie.h" -#import "TiAnimationLottieViewProxy.h" +#import "TiAnimationAnimationView.h" +#import "TiAnimationAnimationViewProxy.h" -@implementation TiAnimationLottieView +#import + +@implementation TiAnimationAnimationView #pragma mark Internals -- (LOTAnimationView *)animationView -{ +- (LOTAnimationView *)animationView { if (_animationView == nil) { id file = [[self proxy] valueForKey:@"file"]; id autoStart = [[self proxy] valueForKey:@"autoStart"]; @@ -30,13 +30,13 @@ - (LOTAnimationView *)animationView } _animationView = [LOTAnimationView animationFromJSON:[self loadAnimationFromJSON:file]]; - + // Enable click-events UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickView:)]; [_animationView addGestureRecognizer:tapGestureRecognizer]; // Handle content mode - NSArray *validContentModes = @[ NUMINT(UIViewContentModeScaleAspectFit), NUMINT(UIViewContentModeScaleAspectFill), NUMINT(UIViewContentModeScaleToFill) ]; + NSArray *validContentModes = @[ @(UIViewContentModeScaleAspectFit), @(UIViewContentModeScaleAspectFill), @(UIViewContentModeScaleToFill) ]; if (contentMode && [validContentModes containsObject:contentMode]) { [_animationView setContentMode:[TiUtils intValue:contentMode]]; @@ -60,151 +60,124 @@ - (LOTAnimationView *)animationView return _animationView; } -- (void)didClickView:(UIGestureRecognizer *)sender -{ +- (void)didClickView:(UIGestureRecognizer *)sender { if ([[self proxy] _hasListeners:@"click"]) { [[self proxy] fireEvent:@"click"]; } } -- (NSDictionary *)loadAnimationFromJSON:(NSString *)file -{ +- (NSDictionary *)loadAnimationFromJSON:(NSString *)file { NSString *filePath = [[NSBundle mainBundle] pathForResource:[[self proxy] valueForKey:@"file"] ofType:nil inDirectory:nil]; NSData *data = [NSData dataWithContentsOfFile:filePath]; - NSDictionary *jsonAnimation = [[NSDictionary alloc] init]; if (!data) { [self log:[NSString stringWithFormat:@"The specified file %@ could not be loaded.", file] forLevel:@"error"]; - } else - jsonAnimation = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + return nil; + } - return jsonAnimation; + return [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; } -- (void)log:(NSString *)string forLevel:(NSString *)level -{ - NSLog(@"[%@] %@: %@", [level uppercaseString], NSStringFromClass([self class]), string); +- (void)log:(NSString *)string forLevel:(NSString *)level { + DebugLog(@"[%@] %@: %@", [level uppercaseString], NSStringFromClass([self class]), string); } #pragma mark Public APIs -- (void)playWithCompletionHandler:(KrollCallback *)callback -{ +- (void)playWithCompletionHandler:(KrollCallback *)callback { [[self animationView] playWithCompletion:^(BOOL animationFinished) { [self processCompleteEventWith:callback animationFinished:animationFinished]; }]; } -- (void)playFromFrame:(NSNumber *)fromFrame toFrame:(NSNumber *)toFrame completion:(KrollCallback *)callback -{ - [[self animationView] playFromFrame:fromFrame toFrame:toFrame withCompletion:^(BOOL animationFinished) { - [self processCompleteEventWith:callback animationFinished:animationFinished]; - }]; +- (void)playFromFrame:(NSNumber *)fromFrame toFrame:(NSNumber *)toFrame completion:(KrollCallback *)callback { + [[self animationView] playFromFrame:fromFrame + toFrame:toFrame + withCompletion:^(BOOL animationFinished) { + [self processCompleteEventWith:callback animationFinished:animationFinished]; + }]; } // TODO: Expose to module in next major, because we need to break the 3 parameters into a dictionary to be more flexible -- (void)playFromProgress:(NSNumber *)fromProgress toProgress:(NSNumber *)toProgress completion:(KrollCallback *)callback -{ - [[self animationView] playFromProgress:fromProgress.floatValue toProgress:toProgress.floatValue withCompletion:^(BOOL animationFinished) { - [self processCompleteEventWith:callback animationFinished:animationFinished]; - }]; +- (void)playFromProgress:(NSNumber *)fromProgress toProgress:(NSNumber *)toProgress completion:(KrollCallback *)callback { + [[self animationView] playFromProgress:fromProgress.floatValue + toProgress:toProgress.floatValue + withCompletion:^(BOOL animationFinished) { + [self processCompleteEventWith:callback animationFinished:animationFinished]; + }]; } -- (void)pause -{ +- (void)pause { [[self animationView] pause]; } -- (void)stop -{ +- (void)stop { [[self animationView] stop]; } -- (void)addView:(UIView *)view toLayer:(NSString *)layer applyTransform:(BOOL)applyTransform -{ - DEPRECATED_REPLACED(@"Lottie.addViewToLayer(view, layer)", @"2.6.0", @"Lottie.addViewToKeypathLayer(view, keypathLayer)"); - - [[self animationView] addSubview:view - toLayerNamed:layer - applyTransform:applyTransform]; -} - -- (void)addView:(UIView *)view toKeypathLayer:(NSString *)layer -{ +- (void)addView:(UIView *)view toKeypathLayer:(NSString *)layer { [[self animationView] addSubview:view toKeypathLayer:[LOTKeypath keypathWithString:layer]]; } -- (BOOL)isPlaying -{ +- (BOOL)isPlaying { return [[self animationView] isAnimationPlaying]; } -- (CGFloat)duration -{ +- (CGFloat)duration { return [[self animationView] animationDuration]; } -- (CGFloat)progress -{ +- (CGFloat)progress { return [[self animationView] animationProgress]; } -- (CGFloat)speed -{ +- (CGFloat)speed { return [[self animationView] animationSpeed]; } -- (BOOL)loop -{ +- (BOOL)loop { return [[self animationView] loopAnimation]; } -- (void)setProgress:(CGFloat)progress -{ +- (void)setProgress:(CGFloat)progress { [[self animationView] setAnimationProgress:progress]; } -- (void)setSpeed:(CGFloat)speed -{ +- (void)setSpeed:(CGFloat)speed { [[self animationView] setAnimationSpeed:speed]; } -- (void)setLoop:(BOOL)loop -{ +- (void)setLoop:(BOOL)loop { [[self animationView] setLoopAnimation:loop]; } -- (void)setCacheEnabled:(BOOL)cacheEnabled -{ +- (void)setCacheEnabled:(BOOL)cacheEnabled { [[self animationView] setCacheEnable:cacheEnabled]; } -- (BOOL)cacheEnabled -{ +- (BOOL)cacheEnabled { return [[self animationView] cacheEnable]; } -- (void)processCompleteEventWith:(KrollCallback *)callback animationFinished:(BOOL)animationFinished -{ +- (void)processCompleteEventWith:(KrollCallback *)callback animationFinished:(BOOL)animationFinished { if ([[self proxy] _hasListeners:@"complete"]) { - [[self proxy] fireEvent:@"complete" withObject:@{@"animationFinished": NUMBOOL(TRUE)}]; + [[self proxy] fireEvent:@"complete" withObject:@{ @"animationFinished" : @(YES) }]; } - + if (callback == nil) { return; } - - NSDictionary *propertiesDict = @{ @"finished" : NUMBOOL(animationFinished) }; + + NSDictionary *propertiesDict = @{ @"finished" : @(animationFinished) }; NSArray *invocationArray = [[NSArray alloc] initWithObjects:&propertiesDict count:1]; - + [callback call:invocationArray thisObject:[self proxy]]; } #pragma mark Layout utilities #ifdef TI_USE_AUTOLAYOUT -- (void)initializeTiLayoutView -{ +- (void)initializeTiLayoutView { [super initializeTiLayoutView]; [self setDefaultHeight:TiDimensionAutoFill]; [self setDefaultWidth:TiDimensionAutoFill]; @@ -213,8 +186,7 @@ - (void)initializeTiLayoutView #pragma mark Layout helper -- (void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds -{ +- (void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds { for (UIView *child in [self subviews]) { [TiUtils setView:child positionRect:bounds]; } diff --git a/ios/Classes/Lottie/TiAnimationLottieViewProxy.h b/ios/Classes/TiAnimationAnimationViewProxy.h similarity index 87% rename from ios/Classes/Lottie/TiAnimationLottieViewProxy.h rename to ios/Classes/TiAnimationAnimationViewProxy.h index 23d901a..a8bd070 100644 --- a/ios/Classes/Lottie/TiAnimationLottieViewProxy.h +++ b/ios/Classes/TiAnimationAnimationViewProxy.h @@ -4,16 +4,16 @@ * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ -#import "TiAnimationLottieView.h" +#import "TiAnimationAnimationView.h" #import "TiViewProxy.h" NS_ASSUME_NONNULL_BEGIN -@interface TiAnimationLottieViewProxy : TiViewProxy +@interface TiAnimationAnimationViewProxy : TiViewProxy #pragma mark Module Utilities -- (TiAnimationLottieView *)animationView; +- (TiAnimationAnimationView *)animationView; #pragma mark Public API's @@ -39,7 +39,6 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Layers -- (void)addViewToLayer:(id)args; - (void)addViewToKeypathLayer:(id)args; #pragma mark - Convert diff --git a/ios/Classes/Lottie/TiAnimationLottieViewProxy.m b/ios/Classes/TiAnimationAnimationViewProxy.m similarity index 57% rename from ios/Classes/Lottie/TiAnimationLottieViewProxy.m rename to ios/Classes/TiAnimationAnimationViewProxy.m index 6e8418d..1ccb543 100644 --- a/ios/Classes/Lottie/TiAnimationLottieViewProxy.m +++ b/ios/Classes/TiAnimationAnimationViewProxy.m @@ -5,29 +5,27 @@ * Please see the LICENSE included with this distribution for details. */ -#import "TiAnimationLottieViewProxy.h" -#import "Lottie.h" -#import "TiAnimationLottieView.h" +#import "TiAnimationAnimationViewProxy.h" +#import "TiAnimationAnimationView.h" +#import "TiAnimationConstants.h" #import "TiUtils.h" -#import "TiLottieConstants.h" -@implementation TiAnimationLottieViewProxy +#import -- (NSArray *)keySequence -{ +@implementation TiAnimationAnimationViewProxy + +- (NSArray *)keySequence { return @[ @"file", @"contentMode", @"autoStart" ]; } -- (TiAnimationLottieView *)animationView -{ - return (TiAnimationLottieView *)self.view; +- (TiAnimationAnimationView *)animationView { + return (TiAnimationAnimationView *)self.view; } #pragma mark Public APIs #pragma mark - Controlling -- (void)start:(id)args -{ +- (void)start:(id)args { ENSURE_UI_THREAD(start, args); if ([args count] == 1) { @@ -36,55 +34,49 @@ - (void)start:(id)args [[self animationView] playWithCompletionHandler:callback]; } else if ([args count] >= 2) { - NSNumber *startFrame; - NSNumber *endFrame; + NSNumber *startFrame = @(0); + NSNumber *endFrame = @(0); KrollCallback *callback; - + ENSURE_ARG_AT_INDEX(startFrame, args, 0, NSNumber); ENSURE_ARG_AT_INDEX(endFrame, args, 1, NSNumber); ENSURE_ARG_OR_NIL_AT_INDEX(callback, args, 2, KrollCallback); - + [[self animationView] playFromFrame:startFrame toFrame:endFrame completion:callback]; } else { [[self animationView] playWithCompletionHandler:nil]; } } -- (void)resume:(id)unused -{ +- (void)resume:(id)unused { [self start:nil]; } -- (void)stop:(id)unused -{ +- (void)stop:(id)unused { ENSURE_UI_THREAD(stop, unused); [[self animationView] stop]; } -- (void)pause:(id)unused -{ +- (void)pause:(id)unused { ENSURE_UI_THREAD(pause, unused); [[self animationView] pause]; } #pragma mark - Properties -- (void)setProgress:(id)progress -{ +- (void)setProgress:(id)progress { ENSURE_UI_THREAD(setProgress, progress); ENSURE_TYPE(progress, NSNumber); - + [[self animationView] setProgress:[TiUtils floatValue:progress]]; [self replaceValue:progress forKey:@"progress" notification:NO]; } -- (id)progress -{ - return NUMFLOAT([[self animationView] progress]); +- (id)progress { + return @([[self animationView] progress]); } -- (void)setSpeed:(id)speed -{ +- (void)setSpeed:(id)speed { ENSURE_UI_THREAD(setSpeed, speed); ENSURE_TYPE(speed, NSNumber); @@ -92,187 +84,159 @@ - (void)setSpeed:(id)speed [self replaceValue:speed forKey:@"speed" notification:NO]; } -- (id)speed -{ - return NUMFLOAT([[self animationView] speed]); +- (id)speed { + return @([[self animationView] speed]); } -- (void)setLoop:(id)loop -{ +- (void)setLoop:(id)loop { ENSURE_UI_THREAD(setLoop, loop); ENSURE_TYPE(loop, NSNumber); - + [[self animationView] setLoop:[TiUtils boolValue:loop]]; [self replaceValue:loop forKey:@"loop" notification:NO]; } -- (id)loop -{ - return NUMBOOL([[self animationView] loop]); +- (id)loop { + return @([[self animationView] loop]); } -- (void)setCache:(id)cache -{ +- (void)setCache:(id)cache { ENSURE_UI_THREAD(setCache, cache); ENSURE_TYPE(cache, NSNumber); - + [[self animationView] setCacheEnabled:[TiUtils boolValue:cache]]; [self replaceValue:cache forKey:@"cache" notification:NO]; } -- (id)cache -{ - return NUMBOOL([[self animationView] cacheEnabled]); +- (id)cache { + return @([[self animationView] cacheEnabled]); } -- (id)isPlaying:(id)unused -{ - return NUMBOOL([[self animationView] isPlaying]); +- (id)isPlaying:(id)unused { + return @([[self animationView] isPlaying]); } -- (id)duration -{ - return NUMFLOAT([[self animationView] duration]); +- (id)duration { + return @([[self animationView] duration]); } #pragma mark - Layers -- (void)addViewToLayer:(id)args -{ - ENSURE_UI_THREAD(addViewToLayer, args); +- (void)addViewToKeypathLayer:(id)args { + ENSURE_UI_THREAD(addViewToKeypathLayer, args); ENSURE_SINGLE_ARG(args, NSDictionary); - - id viewProxy = [args objectForKey:@"view"]; - id layerName = [args objectForKey:@"layer"]; - id applyTransform = [args objectForKey:@"applyTransform"]; - - ENSURE_TYPE(viewProxy, TiViewProxy); - ENSURE_TYPE(layerName, NSString); - ENSURE_TYPE_OR_NIL(applyTransform, NSNumber); - - [self rememberProxy:viewProxy]; - - [[self animationView] addView:[viewProxy view] toLayer:layerName applyTransform:[TiUtils boolValue:applyTransform def:NO]]; -} -- (void)addViewToKeypathLayer:(id)args -{ - ENSURE_UI_THREAD(addViewToLayer, args); - ENSURE_SINGLE_ARG(args, NSDictionary); - id viewProxy = [args objectForKey:@"view"]; id keypathLayer = [args objectForKey:@"layer"]; - + ENSURE_TYPE(viewProxy, TiViewProxy); ENSURE_TYPE(keypathLayer, NSString); - + [self rememberProxy:viewProxy]; - + [[self animationView] addView:[viewProxy view] toKeypathLayer:keypathLayer]; } #pragma mark - Convert -- (void)convertRectToKeypathLayer:(id)args -{ +- (void)convertRectToKeypathLayer:(id)args { ENSURE_UI_THREAD(convertRectToKeypathLayer, args); ENSURE_SINGLE_ARG(args, NSArray); - + CGRect rect = [TiUtils rectValue:[args objectAtIndex:0]]; LOTKeypath *keypathLayer = [LOTKeypath keypathWithString:[args objectAtIndex:1]]; - + [[[self animationView] animationView] convertRect:rect toKeypathLayer:keypathLayer]; } -- (void)convertPointToKeypathLayer:(id)args -{ +- (void)convertPointToKeypathLayer:(id)args { ENSURE_UI_THREAD(convertRectToKeypathLayer, args); ENSURE_SINGLE_ARG(args, NSArray); - + CGPoint point = [TiUtils pointValue:[args objectAtIndex:0]]; LOTKeypath *keypathLayer = [LOTKeypath keypathWithString:[args objectAtIndex:1]]; - + [[[self animationView] animationView] convertPoint:point toKeypathLayer:keypathLayer]; } -- (void)convertRectFromKeypathLayer:(id)args -{ +- (void)convertRectFromKeypathLayer:(id)args { ENSURE_UI_THREAD(convertRectToKeypathLayer, args); ENSURE_SINGLE_ARG(args, NSArray); - + CGRect rect = [TiUtils rectValue:[args objectAtIndex:0]]; LOTKeypath *keypathLayer = [LOTKeypath keypathWithString:[args objectAtIndex:1]]; - + [[[self animationView] animationView] convertRect:rect fromKeypathLayer:keypathLayer]; } -- (void)convertPointFromKeypathLayer:(id)args -{ +- (void)convertPointFromKeypathLayer:(id)args { ENSURE_UI_THREAD(convertRectToKeypathLayer, args); ENSURE_SINGLE_ARG(args, NSArray); - + CGPoint point = [TiUtils pointValue:[args objectAtIndex:0]]; LOTKeypath *keypathLayer = [LOTKeypath keypathWithString:[args objectAtIndex:1]]; - + [[[self animationView] animationView] convertPoint:point fromKeypathLayer:keypathLayer]; } #pragma mark - Dynamic Properties -- (void)setValueDelegateForKeyPath:(id)args -{ +- (void)setValueDelegateForKeyPath:(id)args { ENSURE_UI_THREAD(setValueDelegateForKeyPath, args); ENSURE_SINGLE_ARG(args, NSDictionary); id valueDelegate = nil; - + NSNumber *type = [args objectForKey:@"type"]; id value = [args objectForKey:@"value"]; id keypath = [args objectForKey:@"keypath"]; - + ENSURE_TYPE(type, NSNumber); ENSURE_TYPE(valueDelegate, NSObject); ENSURE_TYPE(keypath, NSString); - + switch ([TiUtils intValue:@"type" properties:args]) { - case TiLottieCallbackPathValue: - valueDelegate = [LOTPathValueCallback withCGPath:CGPathCreateWithRect([TiUtils rectValue:value], NULL)]; - break; - case TiLottieCallbackPathBlock: - NSLog(@"[WARN] Not implemented, yet"); - break; - case TiLottieCallbackColorValue: - valueDelegate = [LOTColorValueCallback withCGColor:[TiUtils colorValue:value].color.CGColor]; - break; - case TiLottieCallbackColorBlock: - NSLog(@"[WARN] Not implemented, yet"); - break; - case TiLottieCallbackNumberValue: - valueDelegate = [LOTNumberValueCallback withFloatValue:[TiUtils floatValue:value]]; - break; - case TiLottieCallbackNumberBlock: - NSLog(@"[WARN] Not implemented, yet"); - break; - case TiLottieCallbackPointValue: - valueDelegate = [LOTPointValueCallback withPointValue:[TiUtils pointValue:value]]; - break; - case TiLottieCallbackPointBlock: - NSLog(@"[WARN] Not implemented, yet"); - break; - case TiLottieCallbackSizeValue: - valueDelegate = [LOTSizeValueCallback - withPointValue:CGSizeMake([TiUtils floatValue:[value objectForKey:@"width"]], [TiUtils floatValue:[value objectForKey:@"height"]])]; - break; - case TiLottieCallbackSizeBlock: - NSLog(@"[WARN] Not implemented, yet"); - break; + case TiLottieCallbackPathValue: { + CGPathRef path = CGPathCreateWithRect([TiUtils rectValue:value], NULL); + valueDelegate = [LOTPathValueCallback withCGPath:path]; + CGPathRelease(path); + break; } - + case TiLottieCallbackPathBlock: + NSLog(@"[WARN] Not implemented, yet"); + break; + case TiLottieCallbackColorValue: + valueDelegate = [LOTColorValueCallback withCGColor:[TiUtils colorValue:value].color.CGColor]; + break; + case TiLottieCallbackColorBlock: + NSLog(@"[WARN] Not implemented, yet"); + break; + case TiLottieCallbackNumberValue: + valueDelegate = [LOTNumberValueCallback withFloatValue:[TiUtils floatValue:value]]; + break; + case TiLottieCallbackNumberBlock: + NSLog(@"[WARN] Not implemented, yet"); + break; + case TiLottieCallbackPointValue: + valueDelegate = [LOTPointValueCallback withPointValue:[TiUtils pointValue:value]]; + break; + case TiLottieCallbackPointBlock: + NSLog(@"[WARN] Not implemented, yet"); + break; + case TiLottieCallbackSizeValue: + valueDelegate = [LOTSizeValueCallback + withPointValue:CGSizeMake([TiUtils floatValue:[value objectForKey:@"width"]], [TiUtils floatValue:[value objectForKey:@"height"]])]; + break; + case TiLottieCallbackSizeBlock: + NSLog(@"[WARN] Not implemented, yet"); + break; + } + if (valueDelegate == nil) { NSLog(@"[ERROR] Cannot set value delegate for given type!"); return; } - + [[[self animationView] animationView] setValueDelegate:valueDelegate forKeypath:[LOTKeypath keypathWithString:[args objectForKey:@"keypath"]]]; } diff --git a/ios/Classes/TiLottieConstants.h b/ios/Classes/TiAnimationConstants.h similarity index 78% rename from ios/Classes/TiLottieConstants.h rename to ios/Classes/TiAnimationConstants.h index fd12d2d..7fa3efd 100644 --- a/ios/Classes/TiLottieConstants.h +++ b/ios/Classes/TiAnimationConstants.h @@ -1,12 +1,12 @@ // -// TiLottieConstants.h +// TiAnimationConstants.h // ti.animation // // Created by Hans Knöchel on 11.02.18. // -#ifndef TiLottieConstants_h -#define TiLottieConstants_h +#ifndef TiAnimationConstants_h +#define TiAnimationConstants_h typedef NS_ENUM(NSUInteger, TiLottieCallback) { TiLottieCallbackColorBlock, // Unused @@ -21,4 +21,4 @@ typedef NS_ENUM(NSUInteger, TiLottieCallback) { TiLottieCallbackPathValue }; -#endif /* TiLottieConstants_h */ +#endif /* TiAnimationConstants_h */ diff --git a/ios/Classes/TiAnimationModule.m b/ios/Classes/TiAnimationModule.m index 41a215c..48c9211 100644 --- a/ios/Classes/TiAnimationModule.m +++ b/ios/Classes/TiAnimationModule.m @@ -6,29 +6,26 @@ */ #import "TiAnimationModule.h" +#import "TiAnimationConstants.h" #import "TiBase.h" #import "TiHost.h" -#import "TiLottieConstants.h" #import "TiUtils.h" @implementation TiAnimationModule #pragma mark Internal -- (id)moduleGUID -{ +- (id)moduleGUID { return @"1fcfea69-bbbf-42f8-b738-9545b5dda74d"; } -- (NSString *)moduleId -{ +- (NSString *)moduleId { return @"ti.animation"; } #pragma mark Lifecycle -- (void)startup -{ +- (void)startup { [super startup]; NSLog(@"[DEBUG] %@ loaded", self); diff --git a/ios/Classes/TiAnimationModuleAssets.m b/ios/Classes/TiAnimationModuleAssets.m index e805b47..456ee27 100644 --- a/ios/Classes/TiAnimationModuleAssets.m +++ b/ios/Classes/TiAnimationModuleAssets.m @@ -7,14 +7,12 @@ @implementation TiAnimationModuleAssets -- (NSData *)moduleAsset -{ +- (NSData *)moduleAsset { return nil; } -- (NSData *)resolveModuleAsset:(NSString *)path -{ +- (NSData *)resolveModuleAsset:(NSString *)path { return nil; } diff --git a/ios/manifest b/ios/manifest index 5dd02e4..1acc3ff 100644 --- a/ios/manifest +++ b/ios/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 1.3.0 +version: 2.0.0 apiversion: 2 architectures: armv7 arm64 i386 x86_64 description: ti.animation @@ -15,4 +15,4 @@ name: ti.animation moduleid: ti.animation guid: 1fcfea69-bbbf-42f8-b738-9545b5dda74d platform: iphone -minsdk: 6.0.0 +minsdk: 7.0.0 diff --git a/ios/module.xcconfig b/ios/module.xcconfig index 8eb265c..8e9bc9e 100644 --- a/ios/module.xcconfig +++ b/ios/module.xcconfig @@ -7,4 +7,4 @@ // http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html // -OTHER_LDFLAGS=$(inherited) -framework CoreGraphics -framework QuartzCore +OTHER_LDFLAGS=$(inherited) -framework CoreGraphics -framework QuartzCore -framework Lottie diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimatedControl.h b/ios/platform/Lottie.framework/Headers/LOTAnimatedControl.h old mode 100755 new mode 100644 similarity index 78% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimatedControl.h rename to ios/platform/Lottie.framework/Headers/LOTAnimatedControl.h index 41b4479..2a14bfa --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimatedControl.h +++ b/ios/platform/Lottie.framework/Headers/LOTAnimatedControl.h @@ -22,7 +22,7 @@ - (void)setLayerName:(NSString * _Nonnull)layerName forState:(UIControlState)state; -@property (nonatomic, readonly, nonnull) LOTAnimationView *animationView; -@property (nonatomic, nullable) LOTComposition *animationComp; +@property (nonatomic, strong, readonly, nonnull) LOTAnimationView *animationView; +@property (nonatomic, strong, nullable) LOTComposition *animationComp; @end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimatedSwitch.h b/ios/platform/Lottie.framework/Headers/LOTAnimatedSwitch.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimatedSwitch.h rename to ios/platform/Lottie.framework/Headers/LOTAnimatedSwitch.h diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationCache.h b/ios/platform/Lottie.framework/Headers/LOTAnimationCache.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationCache.h rename to ios/platform/Lottie.framework/Headers/LOTAnimationCache.h diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationTransitionController.h b/ios/platform/Lottie.framework/Headers/LOTAnimationTransitionController.h old mode 100755 new mode 100644 similarity index 97% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationTransitionController.h rename to ios/platform/Lottie.framework/Headers/LOTAnimationTransitionController.h index 58eb89b..695b52a --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationTransitionController.h +++ b/ios/platform/Lottie.framework/Headers/LOTAnimationTransitionController.h @@ -11,7 +11,7 @@ /** LOTAnimationTransitionController * - * This class creates a custom UIViewController transisiton animation + * This class creates a custom UIViewController transition animation * using a Lottie animation to transition between two view controllers * The transition can use custom defined layers in After Effects for to/from * diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationView.h b/ios/platform/Lottie.framework/Headers/LOTAnimationView.h old mode 100755 new mode 100644 similarity index 86% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationView.h rename to ios/platform/Lottie.framework/Headers/LOTAnimationView.h index 058bf2f..1c7d043 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationView.h +++ b/ios/platform/Lottie.framework/Headers/LOTAnimationView.h @@ -34,22 +34,28 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); /// Creates an animation from the LOTComposition, images are loaded from the specified bundle - (nonnull instancetype)initWithModel:(nullable LOTComposition *)model inBundle:(nullable NSBundle *)bundle; -/// Loads animation asynchrounously from the specified URL +/// Loads animation asynchronously from the specified URL - (nonnull instancetype)initWithContentsOfURL:(nonnull NSURL *)url; +/// Set animation name from Interface Builder +@property (nonatomic, strong) IBInspectable NSString * _Nullable animation; + /// Load animation by name from the default bundle. Use when loading LOTAnimationView via Interface Builder. - (void)setAnimationNamed:(nonnull NSString *)animationName NS_SWIFT_NAME(setAnimation(named:)); +/// Load animation from a JSON dictionary +- (void)setAnimationFromJSON:(nonnull NSDictionary *)animationJSON NS_SWIFT_NAME(setAnimation(json:)); + /// Flag is YES when the animation is playing @property (nonatomic, readonly) BOOL isAnimationPlaying; -/// Tells the animation to loop indefinitely. +/// Tells the animation to loop indefinitely. Defaults to NO. @property (nonatomic, assign) BOOL loopAnimation; /// The animation will play forward and then backwards if loopAnimation is also YES @property (nonatomic, assign) BOOL autoReverseAnimation; -/// Sets a progress from 0 - 1 of the animation. If the animation is playing it will stop and the compeltion block will be called. +/// Sets a progress from 0 - 1 of the animation. If the animation is playing it will stop and the completion block will be called. /// The current progress of the animation in absolute time. /// e.g. a value of 0.75 always represents the same point in the animation, regardless of positive /// or negative speed. @@ -67,14 +73,19 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); /// Sets a completion block to call when the animation has completed @property (nonatomic, copy, nullable) LOTAnimationCompletionBlock completionBlock; -/// Set the amimation data +/// Set the animation data @property (nonatomic, strong, nullable) LOTComposition *sceneModel; +/// Sets sholdRasterize to YES on the animation layer to improve compositioning performance when not animating. +/// Note this will not produce crisp results at resolutions above the animations set resolution. +/// Defaults to NO +@property (nonatomic, assign) BOOL shouldRasterizeWhenIdle; + /* * Plays the animation from its current position to a specific progress. * The animation will start from its current position. * If loopAnimation is YES the animation will loop from start position to toProgress indefinitely. - * If loopAnimation is NO the animation will stop and the comletion block will be called. + * If loopAnimation is NO the animation will stop and the completion block will be called. */ - (void)playToProgress:(CGFloat)toProgress withCompletion:(nullable LOTAnimationCompletionBlock)completion; @@ -83,7 +94,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); * Plays the animation from specific progress to a specific progress * The animation will start from its current position.. * If loopAnimation is YES the animation will loop from the startProgress to the endProgress indefinitely - * If loopAnimation is NO the animation will stop and the comletion block will be called. + * If loopAnimation is NO the animation will stop and the completion block will be called. */ - (void)playFromProgress:(CGFloat)fromStartProgress toProgress:(CGFloat)toEndProgress @@ -93,7 +104,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); * Plays the animation from its current position to a specific frame. * The animation will start from its current position. * If loopAnimation is YES the animation will loop from beginning to toFrame indefinitely. - * If loopAnimation is NO the animation will stop and the comletion block will be called. + * If loopAnimation is NO the animation will stop and the completion block will be called. */ - (void)playToFrame:(nonnull NSNumber *)toFrame withCompletion:(nullable LOTAnimationCompletionBlock)completion; @@ -102,7 +113,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); * Plays the animation from specific frame to a specific frame. * The animation will start from its current position. * If loopAnimation is YES the animation will loop start frame to end frame indefinitely. - * If loopAnimation is NO the animation will stop and the comletion block will be called. + * If loopAnimation is NO the animation will stop and the completion block will be called. */ - (void)playFromFrame:(nonnull NSNumber *)fromStartFrame toFrame:(nonnull NSNumber *)toEndFrame @@ -113,11 +124,11 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); * Plays the animation from its current position to the end of the animation. * The animation will start from its current position. * If loopAnimation is YES the animation will loop from beginning to end indefinitely. - * If loopAnimation is NO the animation will stop and the comletion block will be called. + * If loopAnimation is NO the animation will stop and the completion block will be called. **/ - (void)playWithCompletion:(nullable LOTAnimationCompletionBlock)completion; -/// Plays the animaiton +/// Plays the animation - (void)play; /// Stops the animation at the current frame. The completion block will be called. @@ -150,7 +161,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); See the documentation for LOTKeypath to learn more about how to create keypaths. - NOTE: The delegate is weakly retained. Be sure that the creator of a delgate is retained. + NOTE: The delegate is weakly retained. Be sure that the creator of a delegate is retained. Read More at http://airbnb.io/lottie/ios/dynamic.html */ - (void)setValueDelegate:(id _Nonnull)delegates @@ -192,7 +203,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); toKeypathLayer:(nonnull LOTKeypath *)keypath; /*! - @brief Adds a UIView, or NSView, to the parentrenderable layer found at the Keypath and then masks the view with layer found at the keypath. + @brief Adds a UIView, or NSView, to the parent renderable layer found at the Keypath and then masks the view with layer found at the keypath. */ - (void)maskSubview:(nonnull LOTView *)view toKeypathLayer:(nonnull LOTKeypath *)keypath; @@ -205,8 +216,8 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); @brief Sets the keyframe value for a specific After Effects property at a given time. NOTE: Deprecated. Use setValueDelegate:forKeypath: @discussion NOTE: Deprecated and non functioning. Use setValueCallback:forKeypath: @param value Value is the color, point, or number object that should be set at given time - @param keypath NSString . separate keypath The Keypath is a dot seperated key path that specifies the location of the key to be set from the After Effects file. This will begin with the Layer Name. EG "Layer 1.Shape 1.Fill 1.Color" - @param frame The frame is the frame to be set. If the keyframe exists it will be overwritten, if it does not exist a new linearlly interpolated keyframe will be added + @param keypath NSString . separate keypath The Keypath is a dot separated key path that specifies the location of the key to be set from the After Effects file. This will begin with the Layer Name. EG "Layer 1.Shape 1.Fill 1.Color" + @param frame The frame is the frame to be set. If the keyframe exists it will be overwritten, if it does not exist a new linearly interpolated keyframe will be added */ - (void)setValue:(nonnull id)value forKeypath:(nonnull NSString *)keypath @@ -226,7 +237,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished); applyTransform:(BOOL)applyTransform __deprecated; /*! - @brief Converts the given CGRect from the recieving animation view's coordinate space to the supplied layer's coordinate space If layerName is null then the rect will be converted to the composition coordinate system. This is helpful when adding custom subviews to a LOTAnimationView + @brief Converts the given CGRect from the receiving animation view's coordinate space to the supplied layer's coordinate space If layerName is null then the rect will be converted to the composition coordinate system. This is helpful when adding custom subviews to a LOTAnimationView @discussion NOTE: Deprecated. Use convertRect:fromKeypathLayer: */ - (CGRect)convertRect:(CGRect)rect diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationView_Compat.h b/ios/platform/Lottie.framework/Headers/LOTAnimationView_Compat.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTAnimationView_Compat.h rename to ios/platform/Lottie.framework/Headers/LOTAnimationView_Compat.h diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTBlockCallback.h b/ios/platform/Lottie.framework/Headers/LOTBlockCallback.h old mode 100755 new mode 100644 similarity index 96% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTBlockCallback.h rename to ios/platform/Lottie.framework/Headers/LOTBlockCallback.h index 2288062..067ecc5 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTBlockCallback.h +++ b/ios/platform/Lottie.framework/Headers/LOTBlockCallback.h @@ -11,7 +11,7 @@ #import "LOTValueDelegate.h" /*! - @brief A block that is used to change a Color value at keytime, the block is called continuously for a keypath while the aniamtion plays. + @brief A block that is used to change a Color value at keytime, the block is called continuously for a keypath while the animation plays. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -30,7 +30,7 @@ typedef CGColorRef _Nonnull (^LOTColorValueCallbackBlock)(CGFloat currentFrame, CGColorRef _Nullable interpolatedColor); /*! - @brief A block that is used to change a Number value at keytime, the block is called continuously for a keypath while the aniamtion plays. + @brief A block that is used to change a Number value at keytime, the block is called continuously for a keypath while the animation plays. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -48,7 +48,7 @@ typedef CGFloat (^LOTNumberValueCallbackBlock)(CGFloat currentFrame, CGFloat endValue, CGFloat interpolatedValue); /*! - @brief A block that is used to change a Point value at keytime, the block is called continuously for a keypath while the aniamtion plays. + @brief A block that is used to change a Point value at keytime, the block is called continuously for a keypath while the animation plays. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -67,7 +67,7 @@ typedef CGPoint (^LOTPointValueCallbackBlock)(CGFloat currentFrame, CGPoint interpolatedPoint); /*! - @brief A block that is used to change a Size value at keytime, the block is called continuously for a keypath while the aniamtion plays. + @brief A block that is used to change a Size value at keytime, the block is called continuously for a keypath while the animation plays. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -86,7 +86,7 @@ typedef CGSize (^LOTSizeValueCallbackBlock)(CGFloat currentFrame, CGSize interpolatedSize); /*! - @brief A block that is used to change a Path value at keytime, the block is called continuously for a keypath while the aniamtion plays. + @brief A block that is used to change a Path value at keytime, the block is called continuously for a keypath while the animation plays. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyFrame When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyFrame When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTCacheProvider.h b/ios/platform/Lottie.framework/Headers/LOTCacheProvider.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTCacheProvider.h rename to ios/platform/Lottie.framework/Headers/LOTCacheProvider.h diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTComposition.h b/ios/platform/Lottie.framework/Headers/LOTComposition.h old mode 100755 new mode 100644 similarity index 77% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTComposition.h rename to ios/platform/Lottie.framework/Headers/LOTComposition.h index 2a8ec7f..9fad038 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTComposition.h +++ b/ios/platform/Lottie.framework/Headers/LOTComposition.h @@ -36,14 +36,14 @@ withAssetBundle:(NSBundle * _Nullable)bundle; @property (nonatomic, readonly) CGRect compBounds; -@property (nonatomic, readonly, nullable) NSNumber *startFrame; -@property (nonatomic, readonly, nullable) NSNumber *endFrame; -@property (nonatomic, readonly, nullable) NSNumber *framerate; +@property (nonatomic, strong, readonly, nullable) NSNumber *startFrame; +@property (nonatomic, strong, readonly, nullable) NSNumber *endFrame; +@property (nonatomic, strong, readonly, nullable) NSNumber *framerate; @property (nonatomic, readonly) NSTimeInterval timeDuration; -@property (nonatomic, readonly, nullable) LOTLayerGroup *layerGroup; -@property (nonatomic, readonly, nullable) LOTAssetGroup *assetGroup; -@property (nonatomic, readwrite, nullable) NSString *rootDirectory; -@property (nonatomic, readonly, nullable) NSBundle *assetBundle; +@property (nonatomic, strong, readonly, nullable) LOTLayerGroup *layerGroup; +@property (nonatomic, strong, readonly, nullable) LOTAssetGroup *assetGroup; +@property (nonatomic, strong, readwrite, nullable) NSString *rootDirectory; +@property (nonatomic, strong, readonly, nullable) NSBundle *assetBundle; @property (nonatomic, copy, nullable) NSString *cacheKey; @end diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTInterpolatorCallback.h b/ios/platform/Lottie.framework/Headers/LOTInterpolatorCallback.h old mode 100755 new mode 100644 similarity index 86% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTInterpolatorCallback.h rename to ios/platform/Lottie.framework/Headers/LOTInterpolatorCallback.h index 7cf7198..5d4b550 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTInterpolatorCallback.h +++ b/ios/platform/Lottie.framework/Headers/LOTInterpolatorCallback.h @@ -23,7 +23,7 @@ @property (nonatomic) CGPoint toPoint; /*! - @brief As currentProgess changes from 0 to 1 the point sent to the animation view is interpolated between fromPoint and toPoint. + @brief As currentProgress changes from 0 to 1 the point sent to the animation view is interpolated between fromPoint and toPoint. */ @property (nonatomic, assign) CGFloat currentProgress; @@ -43,7 +43,7 @@ @property (nonatomic) CGSize toSize; /*! - @brief As currentProgess changes from 0 to 1 the size sent to the animation view is interpolated between fromSize and toSize. + @brief As currentProgress changes from 0 to 1 the size sent to the animation view is interpolated between fromSize and toSize. */ @property (nonatomic, assign) CGFloat currentProgress; @@ -63,7 +63,7 @@ @property (nonatomic) CGFloat toFloat; /*! - @brief As currentProgess changes from 0 to 1 the float sent to the animation view is interpolated between fromFloat and toFloat. + @brief As currentProgress changes from 0 to 1 the float sent to the animation view is interpolated between fromFloat and toFloat. */ @property (nonatomic, assign) CGFloat currentProgress; diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTKeypath.h b/ios/platform/Lottie.framework/Headers/LOTKeypath.h old mode 100755 new mode 100644 similarity index 96% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTKeypath.h rename to ios/platform/Lottie.framework/Headers/LOTKeypath.h index c568abb..9c5b7a4 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTKeypath.h +++ b/ios/platform/Lottie.framework/Headers/LOTKeypath.h @@ -56,7 +56,7 @@ extern NSString * _Nonnull const kLOTKeypathEnd; LOTKeypath can describe a specific object, or can use wildcards for fuzzy matching of objects. Acceptable wildcards are either "*" (star) or "**" (double star). Single star will search a single depth for the next object, double star will search any depth. - @param firstKey A nil terminitated list of strings describing a keypath. EG @"Layer", @"Shape Group", @"Stroke 1", @"Color", nil + @param firstKey A nil terminated list of strings describing a keypath. EG @"Layer", @"Shape Group", @"Stroke 1", @"Color", nil @return A new LOTKeypath */ diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTValueCallback.h b/ios/platform/Lottie.framework/Headers/LOTValueCallback.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTValueCallback.h rename to ios/platform/Lottie.framework/Headers/LOTValueCallback.h diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTValueDelegate.h b/ios/platform/Lottie.framework/Headers/LOTValueDelegate.h old mode 100755 new mode 100644 similarity index 94% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTValueDelegate.h rename to ios/platform/Lottie.framework/Headers/LOTValueDelegate.h index 0250eb5..cdd5b64 --- a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/LOTValueDelegate.h +++ b/ios/platform/Lottie.framework/Headers/LOTValueDelegate.h @@ -11,7 +11,7 @@ /*! @brief LOTValueDelegate is not intended to be used directly. It is used for type safety. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. Prebuild delegates can be found in LOTBlockCallback, LOTInterpolatorCallback, and LOTValueCallback. These delegates allow direct setting and driving of an animated value. See LOTColorValueDelegate, LOTNumberValueDelegate, LOTPointValueDelegate, LOTSizeValueDelegate, LOTPathValueDelegate. @@ -25,7 +25,7 @@ @required /*! @brief LOTColorValueDelegate is called at runtime to override the color value of a property in a LOTAnimation. The property is defined by at LOTKeypath. The delegate is set via setValueDelegate:forKeypath on LOTAnimationView. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyframe When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyframe When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -51,7 +51,7 @@ @required /*! @brief LOTNumberValueDelegate is called at runtime to override the number value of a property in a LOTAnimation. The property is defined by at LOTKeypath. The delegate is set via setValueDelegate:forKeypath on LOTAnimationView. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyframe When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyframe When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -76,7 +76,7 @@ @required /*! @brief LOTPointValueDelegate is called at runtime to override the point value of a property in a LOTAnimation. The property is defined by at LOTKeypath. The delegate is set via setValueDelegate:forKeypath on LOTAnimationView. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyframe When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyframe When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -101,7 +101,7 @@ @required /*! @brief LOTSizeValueDelegate is called at runtime to override the size value of a property in a LOTAnimation. The property is defined by at LOTKeypath. The delegate is set via setValueDelegate:forKeypath on LOTAnimationView. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyframe When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyframe When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. @@ -127,7 +127,7 @@ @required /*! @brief LOTPathValueDelegate is called at runtime to override the path value of a property in a LOTAnimation. The property is defined by at LOTKeypath. The delegate is set via setValueDelegate:forKeypath on LOTAnimationView. - @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delagate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath methond on LOTAnimationView. + @discussion LOTValueDelegates are used to dynamically change animation data at runtime. A delegate is set for a keypath, defined by LOTKeypath. While the animation is running the delegate is asked for the value for the keypath at each frame of the animation. The delegate is given the computed animation value for the the current frame. See LOTKeypath and the setValueDelegate:forKeypath method on LOTAnimationView. @param currentFrame The current frame of the animation in the parent compositions time space. @param startKeyframe When the block is called, startFrame is the most recent keyframe for the keypath in relation to the current time. @param endKeyframe When the block is called, endFrame is the next keyframe for the keypath in relation to the current time. diff --git a/ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/Lottie.h b/ios/platform/Lottie.framework/Headers/Lottie.h old mode 100755 new mode 100644 similarity index 100% rename from ios/Classes/Lottie/lottie-ios/Classes/PublicHeaders/Lottie.h rename to ios/platform/Lottie.framework/Headers/Lottie.h diff --git a/ios/platform/Lottie.framework/Info.plist b/ios/platform/Lottie.framework/Info.plist new file mode 100644 index 0000000..9c6b207 Binary files /dev/null and b/ios/platform/Lottie.framework/Info.plist differ diff --git a/ios/platform/Lottie.framework/Lottie b/ios/platform/Lottie.framework/Lottie new file mode 100755 index 0000000..09c4c7a Binary files /dev/null and b/ios/platform/Lottie.framework/Lottie differ diff --git a/ios/platform/Lottie.framework/Modules/module.modulemap b/ios/platform/Lottie.framework/Modules/module.modulemap new file mode 100644 index 0000000..90a1ae1 --- /dev/null +++ b/ios/platform/Lottie.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Lottie { + umbrella header "Lottie.h" + + export * + module * { export * } +} diff --git a/ios/ti.animation.xcodeproj/project.pbxproj b/ios/ti.animation.xcodeproj/project.pbxproj index 454775b..a7be0ba 100644 --- a/ios/ti.animation.xcodeproj/project.pbxproj +++ b/ios/ti.animation.xcodeproj/project.pbxproj @@ -26,194 +26,14 @@ 24DD6CFA1134B3F500162E58 /* TiAnimationModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* TiAnimationModule.m */; }; 24DE9E1111C5FE74003F90F6 /* TiAnimationModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* TiAnimationModuleAssets.h */; }; 24DE9E1211C5FE74003F90F6 /* TiAnimationModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* TiAnimationModuleAssets.m */; }; + 3AB3D37B21BE459A0060E89D /* Lottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB3D37A21BE459A0060E89D /* Lottie.framework */; }; + 3AB3D38021BE475F0060E89D /* TiAnimationAnimationView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AB3D37C21BE475F0060E89D /* TiAnimationAnimationView.h */; }; + 3AB3D38121BE475F0060E89D /* TiAnimationAnimationViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB3D37D21BE475F0060E89D /* TiAnimationAnimationViewProxy.m */; }; + 3AB3D38221BE475F0060E89D /* TiAnimationAnimationViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AB3D37E21BE475F0060E89D /* TiAnimationAnimationViewProxy.h */; }; + 3AB3D38321BE475F0060E89D /* TiAnimationAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB3D37F21BE475F0060E89D /* TiAnimationAnimationView.m */; }; AA747D9F0F9514B9006C5449 /* TiAnimation_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* TiAnimation_Prefix.pch */; }; AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - DB79E5F22030CFD8009CFB39 /* LOTRenderNode.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5662030CFD8009CFB39 /* LOTRenderNode.m */; }; - DB79E5F32030CFD8009CFB39 /* LOTAnimatorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5672030CFD8009CFB39 /* LOTAnimatorNode.h */; }; - DB79E5F42030CFD8009CFB39 /* LOTRenderNode.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5682030CFD8009CFB39 /* LOTRenderNode.h */; }; - DB79E5F52030CFD8009CFB39 /* LOTTrimPathNode.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E56A2030CFD8009CFB39 /* LOTTrimPathNode.h */; }; - DB79E5F62030CFD8009CFB39 /* LOTTrimPathNode.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E56B2030CFD8009CFB39 /* LOTTrimPathNode.m */; }; - DB79E5F72030CFD8009CFB39 /* LOTColorInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E56D2030CFD8009CFB39 /* LOTColorInterpolator.m */; }; - DB79E5F82030CFD8009CFB39 /* LOTPathInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E56E2030CFD8009CFB39 /* LOTPathInterpolator.m */; }; - DB79E5F92030CFD8009CFB39 /* LOTSizeInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E56F2030CFD8009CFB39 /* LOTSizeInterpolator.h */; }; - DB79E5FA2030CFD8009CFB39 /* LOTValueInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5702030CFD8009CFB39 /* LOTValueInterpolator.h */; }; - DB79E5FB2030CFD8009CFB39 /* LOTPointInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5712030CFD8009CFB39 /* LOTPointInterpolator.h */; }; - DB79E5FC2030CFD8009CFB39 /* LOTNumberInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5722030CFD8009CFB39 /* LOTNumberInterpolator.h */; }; - DB79E5FD2030CFD8009CFB39 /* LOTTransformInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5732030CFD8009CFB39 /* LOTTransformInterpolator.h */; }; - DB79E5FE2030CFD8009CFB39 /* LOTArrayInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5742030CFD8009CFB39 /* LOTArrayInterpolator.h */; }; - DB79E5FF2030CFD8009CFB39 /* LOTColorInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5752030CFD8009CFB39 /* LOTColorInterpolator.h */; }; - DB79E6002030CFD8009CFB39 /* LOTSizeInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5762030CFD8009CFB39 /* LOTSizeInterpolator.m */; }; - DB79E6012030CFD8009CFB39 /* LOTPathInterpolator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5772030CFD8009CFB39 /* LOTPathInterpolator.h */; }; - DB79E6022030CFD8009CFB39 /* LOTPointInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5782030CFD8009CFB39 /* LOTPointInterpolator.m */; }; - DB79E6032030CFD8009CFB39 /* LOTValueInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5792030CFD8009CFB39 /* LOTValueInterpolator.m */; }; - DB79E6042030CFD8009CFB39 /* LOTTransformInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E57A2030CFD8009CFB39 /* LOTTransformInterpolator.m */; }; - DB79E6052030CFD8009CFB39 /* LOTArrayInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E57B2030CFD8009CFB39 /* LOTArrayInterpolator.m */; }; - DB79E6062030CFD8009CFB39 /* LOTNumberInterpolator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E57C2030CFD8009CFB39 /* LOTNumberInterpolator.m */; }; - DB79E6072030CFD8009CFB39 /* LOTAnimatorNode.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E57D2030CFD8009CFB39 /* LOTAnimatorNode.m */; }; - DB79E6082030CFD8009CFB39 /* LOTPathAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E57F2030CFD8009CFB39 /* LOTPathAnimator.m */; }; - DB79E6092030CFD8009CFB39 /* LOTPolystarAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5802030CFD8009CFB39 /* LOTPolystarAnimator.m */; }; - DB79E60A2030CFD8009CFB39 /* LOTPolygonAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5812030CFD8009CFB39 /* LOTPolygonAnimator.m */; }; - DB79E60B2030CFD8009CFB39 /* LOTRoundedRectAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5822030CFD8009CFB39 /* LOTRoundedRectAnimator.h */; }; - DB79E60C2030CFD8009CFB39 /* LOTCircleAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5832030CFD8009CFB39 /* LOTCircleAnimator.m */; }; - DB79E60D2030CFD8009CFB39 /* LOTPolystarAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5842030CFD8009CFB39 /* LOTPolystarAnimator.h */; }; - DB79E60E2030CFD8009CFB39 /* LOTPathAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5852030CFD8009CFB39 /* LOTPathAnimator.h */; }; - DB79E60F2030CFD8009CFB39 /* LOTCircleAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5862030CFD8009CFB39 /* LOTCircleAnimator.h */; }; - DB79E6102030CFD8009CFB39 /* LOTRoundedRectAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5872030CFD8009CFB39 /* LOTRoundedRectAnimator.m */; }; - DB79E6112030CFD8009CFB39 /* LOTPolygonAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5882030CFD8009CFB39 /* LOTPolygonAnimator.h */; }; - DB79E6122030CFD8009CFB39 /* LOTRenderGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E58A2030CFD8009CFB39 /* LOTRenderGroup.m */; }; - DB79E6132030CFD8009CFB39 /* LOTGradientFillRender.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E58B2030CFD8009CFB39 /* LOTGradientFillRender.m */; }; - DB79E6142030CFD8009CFB39 /* LOTFillRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E58C2030CFD8009CFB39 /* LOTFillRenderer.h */; }; - DB79E6152030CFD8009CFB39 /* LOTStrokeRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E58D2030CFD8009CFB39 /* LOTStrokeRenderer.h */; }; - DB79E6162030CFD8009CFB39 /* LOTRepeaterRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E58E2030CFD8009CFB39 /* LOTRepeaterRenderer.h */; }; - DB79E6172030CFD8009CFB39 /* LOTRenderGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E58F2030CFD8009CFB39 /* LOTRenderGroup.h */; }; - DB79E6182030CFD8009CFB39 /* LOTStrokeRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5902030CFD8009CFB39 /* LOTStrokeRenderer.m */; }; - DB79E6192030CFD8009CFB39 /* LOTFillRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5912030CFD8009CFB39 /* LOTFillRenderer.m */; }; - DB79E61A2030CFD8009CFB39 /* LOTGradientFillRender.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5922030CFD8009CFB39 /* LOTGradientFillRender.h */; }; - DB79E61B2030CFD8009CFB39 /* LOTRepeaterRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5932030CFD8009CFB39 /* LOTRepeaterRenderer.m */; }; - DB79E61C2030CFD8009CFB39 /* LOTMask.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5952030CFD8009CFB39 /* LOTMask.m */; }; - DB79E61D2030CFD8009CFB39 /* LOTLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5962030CFD8009CFB39 /* LOTLayer.m */; }; - DB79E61E2030CFD8009CFB39 /* LOTAssetGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5972030CFD8009CFB39 /* LOTAssetGroup.m */; }; - DB79E61F2030CFD8009CFB39 /* LOTShapeRectangle.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5982030CFD8009CFB39 /* LOTShapeRectangle.h */; }; - DB79E6202030CFD8009CFB39 /* LOTShapeRepeater.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5992030CFD8009CFB39 /* LOTShapeRepeater.h */; }; - DB79E6212030CFD8009CFB39 /* LOTAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E59A2030CFD8009CFB39 /* LOTAsset.h */; }; - DB79E6222030CFD8009CFB39 /* LOTShapeCircle.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E59B2030CFD8009CFB39 /* LOTShapeCircle.h */; }; - DB79E6232030CFD8009CFB39 /* LOTLayerGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E59C2030CFD8009CFB39 /* LOTLayerGroup.m */; }; - DB79E6242030CFD8009CFB39 /* LOTShapeStar.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E59D2030CFD8009CFB39 /* LOTShapeStar.m */; }; - DB79E6252030CFD8009CFB39 /* LOTShapeTrimPath.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E59E2030CFD8009CFB39 /* LOTShapeTrimPath.m */; }; - DB79E6262030CFD8009CFB39 /* LOTShapeGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E59F2030CFD8009CFB39 /* LOTShapeGroup.h */; }; - DB79E6272030CFD8009CFB39 /* LOTShapePath.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A02030CFD8009CFB39 /* LOTShapePath.h */; }; - DB79E6282030CFD8009CFB39 /* LOTShapeStroke.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A12030CFD8009CFB39 /* LOTShapeStroke.h */; }; - DB79E6292030CFD8009CFB39 /* LOTShapeGradientFill.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5A22030CFD8009CFB39 /* LOTShapeGradientFill.m */; }; - DB79E62A2030CFD8009CFB39 /* LOTShapeFill.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A32030CFD8009CFB39 /* LOTShapeFill.h */; }; - DB79E62B2030CFD8009CFB39 /* LOTShapeTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A42030CFD8009CFB39 /* LOTShapeTransform.h */; }; - DB79E62C2030CFD8009CFB39 /* LOTAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5A52030CFD8009CFB39 /* LOTAsset.m */; }; - DB79E62D2030CFD8009CFB39 /* LOTModels.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A62030CFD8009CFB39 /* LOTModels.h */; }; - DB79E62E2030CFD8009CFB39 /* LOTShapeRepeater.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5A72030CFD8009CFB39 /* LOTShapeRepeater.m */; }; - DB79E62F2030CFD8009CFB39 /* LOTAssetGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5A82030CFD8009CFB39 /* LOTAssetGroup.h */; }; - DB79E6302030CFD8009CFB39 /* LOTShapeRectangle.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5A92030CFD8009CFB39 /* LOTShapeRectangle.m */; }; - DB79E6312030CFD8009CFB39 /* LOTLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5AA2030CFD8009CFB39 /* LOTLayer.h */; }; - DB79E6322030CFD8009CFB39 /* LOTMask.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5AB2030CFD8009CFB39 /* LOTMask.h */; }; - DB79E6332030CFD8009CFB39 /* LOTShapeStar.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5AC2030CFD8009CFB39 /* LOTShapeStar.h */; }; - DB79E6342030CFD8009CFB39 /* LOTLayerGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5AD2030CFD8009CFB39 /* LOTLayerGroup.h */; }; - DB79E6352030CFD8009CFB39 /* LOTShapeCircle.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5AE2030CFD8009CFB39 /* LOTShapeCircle.m */; }; - DB79E6362030CFD8009CFB39 /* LOTShapePath.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5AF2030CFD8009CFB39 /* LOTShapePath.m */; }; - DB79E6372030CFD8009CFB39 /* LOTShapeGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5B02030CFD8009CFB39 /* LOTShapeGroup.m */; }; - DB79E6382030CFD8009CFB39 /* LOTShapeTrimPath.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5B12030CFD8009CFB39 /* LOTShapeTrimPath.h */; }; - DB79E6392030CFD8009CFB39 /* LOTShapeFill.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5B22030CFD8009CFB39 /* LOTShapeFill.m */; }; - DB79E63A2030CFD8009CFB39 /* LOTShapeTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5B32030CFD8009CFB39 /* LOTShapeTransform.m */; }; - DB79E63B2030CFD8009CFB39 /* LOTShapeGradientFill.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5B42030CFD8009CFB39 /* LOTShapeGradientFill.h */; }; - DB79E63C2030CFD8009CFB39 /* LOTShapeStroke.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5B52030CFD8009CFB39 /* LOTShapeStroke.m */; }; - DB79E63D2030CFD8009CFB39 /* LOTHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5B72030CFD8009CFB39 /* LOTHelpers.h */; }; - DB79E63E2030CFD8009CFB39 /* LOTRadialGradientLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5B82030CFD8009CFB39 /* LOTRadialGradientLayer.h */; }; - DB79E63F2030CFD8009CFB39 /* CGGeometry+LOTAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5B92030CFD8009CFB39 /* CGGeometry+LOTAdditions.m */; }; - DB79E6402030CFD8009CFB39 /* LOTBezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5BA2030CFD8009CFB39 /* LOTBezierPath.m */; }; - DB79E6412030CFD8009CFB39 /* UIColor+Expanded.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5BB2030CFD8009CFB39 /* UIColor+Expanded.h */; }; - DB79E6422030CFD8009CFB39 /* LOTRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5BC2030CFD8009CFB39 /* LOTRadialGradientLayer.m */; }; - DB79E6432030CFD8009CFB39 /* CGGeometry+LOTAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5BD2030CFD8009CFB39 /* CGGeometry+LOTAdditions.h */; }; - DB79E6442030CFD8009CFB39 /* LOTBezierPath.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5BE2030CFD8009CFB39 /* LOTBezierPath.h */; }; - DB79E6452030CFD8009CFB39 /* UIColor+Expanded.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5BF2030CFD8009CFB39 /* UIColor+Expanded.m */; }; - DB79E6462030CFD8009CFB39 /* UIColor.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5C12030CFD8009CFB39 /* UIColor.h */; }; - DB79E6472030CFD8009CFB39 /* UIBezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5C22030CFD8009CFB39 /* UIBezierPath.m */; }; - DB79E6482030CFD8009CFB39 /* CALayer+Compat.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5C32030CFD8009CFB39 /* CALayer+Compat.h */; }; - DB79E6492030CFD8009CFB39 /* NSValue+Compat.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5C42030CFD8009CFB39 /* NSValue+Compat.h */; }; - DB79E64A2030CFD8009CFB39 /* UIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5C52030CFD8009CFB39 /* UIColor.m */; }; - DB79E64B2030CFD8009CFB39 /* LOTPlatformCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5C62030CFD8009CFB39 /* LOTPlatformCompat.h */; }; - DB79E64C2030CFD8009CFB39 /* UIBezierPath.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5C72030CFD8009CFB39 /* UIBezierPath.h */; }; - DB79E64D2030CFD8009CFB39 /* NSValue+Compat.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5C82030CFD8009CFB39 /* NSValue+Compat.m */; }; - DB79E64E2030CFD8009CFB39 /* CALayer+Compat.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5C92030CFD8009CFB39 /* CALayer+Compat.m */; }; - DB79E64F2030CFD8009CFB39 /* LOTAnimationCache.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5CB2030CFD8009CFB39 /* LOTAnimationCache.m */; }; - DB79E6502030CFD8009CFB39 /* LOTComposition.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5CC2030CFD8009CFB39 /* LOTComposition.m */; }; - DB79E6512030CFD8009CFB39 /* LOTValueCallback.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5CD2030CFD8009CFB39 /* LOTValueCallback.m */; }; - DB79E6522030CFD8009CFB39 /* LOTBlockCallback.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5CE2030CFD8009CFB39 /* LOTBlockCallback.m */; }; - DB79E6532030CFD8009CFB39 /* LOTAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5CF2030CFD8009CFB39 /* LOTAnimationView.m */; }; - DB79E6542030CFD8009CFB39 /* LOTAnimationTransitionController.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D02030CFD8009CFB39 /* LOTAnimationTransitionController.m */; }; - DB79E6552030CFD8009CFB39 /* LOTAnimationView_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5D12030CFD8009CFB39 /* LOTAnimationView_Internal.h */; }; - DB79E6562030CFD8009CFB39 /* LOTKeypath.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D22030CFD8009CFB39 /* LOTKeypath.m */; }; - DB79E6572030CFD8009CFB39 /* LOTCacheProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D32030CFD8009CFB39 /* LOTCacheProvider.m */; }; - DB79E6582030CFD8009CFB39 /* LOTAnimatedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D42030CFD8009CFB39 /* LOTAnimatedControl.m */; }; - DB79E6592030CFD8009CFB39 /* LOTInterpolatorCallback.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D52030CFD8009CFB39 /* LOTInterpolatorCallback.m */; }; - DB79E65A2030CFD8009CFB39 /* LOTAnimatedSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D62030CFD8009CFB39 /* LOTAnimatedSwitch.m */; }; - DB79E65B2030CFD8009CFB39 /* LOTKeyframe.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D82030CFD8009CFB39 /* LOTKeyframe.m */; }; - DB79E65C2030CFD8009CFB39 /* LOTBezierData.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5D92030CFD8009CFB39 /* LOTBezierData.m */; }; - DB79E65D2030CFD8009CFB39 /* LOTKeyframe.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5DA2030CFD8009CFB39 /* LOTKeyframe.h */; }; - DB79E65E2030CFD8009CFB39 /* LOTBezierData.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5DB2030CFD8009CFB39 /* LOTBezierData.h */; }; - DB79E65F2030CFD8009CFB39 /* LOTLayerContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5DD2030CFD8009CFB39 /* LOTLayerContainer.m */; }; - DB79E6602030CFD8009CFB39 /* LOTCompositionContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5DE2030CFD8009CFB39 /* LOTCompositionContainer.h */; }; - DB79E6612030CFD8009CFB39 /* LOTMaskContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5DF2030CFD8009CFB39 /* LOTMaskContainer.h */; }; - DB79E6622030CFD8009CFB39 /* LOTLayerContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E02030CFD8009CFB39 /* LOTLayerContainer.h */; }; - DB79E6632030CFD8009CFB39 /* LOTCompositionContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5E12030CFD8009CFB39 /* LOTCompositionContainer.m */; }; - DB79E6642030CFD8009CFB39 /* LOTMaskContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB79E5E22030CFD8009CFB39 /* LOTMaskContainer.m */; }; - DB79E6652030CFD8009CFB39 /* LOTValueDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E42030CFD8009CFB39 /* LOTValueDelegate.h */; }; - DB79E6662030CFD8009CFB39 /* LOTAnimatedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E52030CFD8009CFB39 /* LOTAnimatedControl.h */; }; - DB79E6672030CFD8009CFB39 /* LOTCacheProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E62030CFD8009CFB39 /* LOTCacheProvider.h */; }; - DB79E6682030CFD8009CFB39 /* LOTKeypath.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E72030CFD8009CFB39 /* LOTKeypath.h */; }; - DB79E6692030CFD8009CFB39 /* LOTInterpolatorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E82030CFD8009CFB39 /* LOTInterpolatorCallback.h */; }; - DB79E66A2030CFD8009CFB39 /* LOTAnimatedSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5E92030CFD8009CFB39 /* LOTAnimatedSwitch.h */; }; - DB79E66B2030CFD8009CFB39 /* LOTAnimationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5EA2030CFD8009CFB39 /* LOTAnimationCache.h */; }; - DB79E66C2030CFD8009CFB39 /* Lottie.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5EB2030CFD8009CFB39 /* Lottie.h */; }; - DB79E66D2030CFD8009CFB39 /* LOTComposition.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5EC2030CFD8009CFB39 /* LOTComposition.h */; }; - DB79E66E2030CFD8009CFB39 /* LOTAnimationTransitionController.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5ED2030CFD8009CFB39 /* LOTAnimationTransitionController.h */; }; - DB79E66F2030CFD8009CFB39 /* LOTAnimationView.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5EE2030CFD8009CFB39 /* LOTAnimationView.h */; }; - DB79E6702030CFD8009CFB39 /* LOTAnimationView_Compat.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5EF2030CFD8009CFB39 /* LOTAnimationView_Compat.h */; }; - DB79E6712030CFD8009CFB39 /* LOTValueCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5F02030CFD8009CFB39 /* LOTValueCallback.h */; }; - DB79E6722030CFD8009CFB39 /* LOTBlockCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E5F12030CFD8009CFB39 /* LOTBlockCallback.h */; }; - DB79E6742030D7A8009CFB39 /* TiLottieConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E6732030D7A8009CFB39 /* TiLottieConstants.h */; }; - DB9C578D1E48B77D0010BF6F /* TiAnimationLottieView.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9C57471E48B77D0010BF6F /* TiAnimationLottieView.h */; }; - DB9C578E1E48B77D0010BF6F /* TiAnimationLottieView.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9C57481E48B77D0010BF6F /* TiAnimationLottieView.m */; }; - DB9C578F1E48B77D0010BF6F /* TiAnimationLottieViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9C57491E48B77D0010BF6F /* TiAnimationLottieViewProxy.h */; }; - DB9C57901E48B77D0010BF6F /* TiAnimationLottieViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9C574A1E48B77D0010BF6F /* TiAnimationLottieViewProxy.m */; }; - DB9C57EC1E48BA9D0010BF6F /* TiAnimationKeyframeView.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9C57C51E48BA9D0010BF6F /* TiAnimationKeyframeView.h */; }; - DB9C57ED1E48BA9D0010BF6F /* TiAnimationKeyframeView.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9C57C61E48BA9D0010BF6F /* TiAnimationKeyframeView.m */; }; - DB9C57EE1E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9C57C71E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.h */; }; - DB9C57EF1E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9C57C81E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.m */; }; - DB9EB30E1F63FFB40044FCC2 /* Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2CE1F63FFB40044FCC2 /* Compatibility.h */; }; - DB9EB30F1F63FFB40044FCC2 /* NSValue+PlatformCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2CF1F63FFB40044FCC2 /* NSValue+PlatformCompatibility.m */; }; - DB9EB3101F63FFB40044FCC2 /* NSImage+PlatformCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2D01F63FFB40044FCC2 /* NSImage+PlatformCompatibility.m */; }; - DB9EB3111F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2D11F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.m */; }; - DB9EB3121F63FFB40044FCC2 /* NSImage+PlatformCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D21F63FFB40044FCC2 /* NSImage+PlatformCompatibility.h */; }; - DB9EB3131F63FFB40044FCC2 /* NSValue+PlatformCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D31F63FFB40044FCC2 /* NSValue+PlatformCompatibility.h */; }; - DB9EB3141F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D41F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.h */; }; - DB9EB3151F63FFB40044FCC2 /* KFVectorLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D61F63FFB40044FCC2 /* KFVectorLayer.h */; }; - DB9EB3161F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D71F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.h */; }; - DB9EB3171F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2D81F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.m */; }; - DB9EB3181F63FFB40044FCC2 /* KFVectorFeatureLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2D91F63FFB40044FCC2 /* KFVectorFeatureLayer.h */; }; - DB9EB3191F63FFB40044FCC2 /* KFVectorLayerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2DA1F63FFB40044FCC2 /* KFVectorLayerHelper.h */; }; - DB9EB31A1F63FFB40044FCC2 /* KFVectorAnimationLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2DB1F63FFB40044FCC2 /* KFVectorAnimationLayer.m */; }; - DB9EB31B1F63FFB40044FCC2 /* KFVectorLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2DC1F63FFB40044FCC2 /* KFVectorLayer.m */; }; - DB9EB31C1F63FFB40044FCC2 /* KFVectorFeatureLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2DD1F63FFB40044FCC2 /* KFVectorFeatureLayer.m */; }; - DB9EB31D1F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2DE1F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.m */; }; - DB9EB31E1F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2DF1F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.h */; }; - DB9EB31F1F63FFB40044FCC2 /* KFVectorLayerHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2E01F63FFB40044FCC2 /* KFVectorLayerHelper.m */; }; - DB9EB3201F63FFB40044FCC2 /* KFVectorFeatureLayerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2E11F63FFB40044FCC2 /* KFVectorFeatureLayerInterface.h */; }; - DB9EB3211F63FFB40044FCC2 /* KFVectorAnimationLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2E21F63FFB40044FCC2 /* KFVectorAnimationLayer.h */; }; - DB9EB3221F63FFB40044FCC2 /* KFVectorGradientEffect.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2E41F63FFB40044FCC2 /* KFVectorGradientEffect.m */; }; - DB9EB3231F63FFB40044FCC2 /* KFVectorPathTrim.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2E51F63FFB40044FCC2 /* KFVectorPathTrim.m */; }; - DB9EB3241F63FFB40044FCC2 /* KFVectorFeature.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2E71F63FFB40044FCC2 /* KFVectorFeature.m */; }; - DB9EB3251F63FFB40044FCC2 /* KFVectorAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2E81F63FFB40044FCC2 /* KFVectorAnimation.h */; }; - DB9EB3261F63FFB40044FCC2 /* KFVector.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2E91F63FFB40044FCC2 /* KFVector.h */; }; - DB9EB3271F63FFB40044FCC2 /* KFVectorAnimationGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2EA1F63FFB40044FCC2 /* KFVectorAnimationGroup.h */; }; - DB9EB3281F63FFB40044FCC2 /* KFVectorAnimationKeyValue.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2EE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.h */; }; - DB9EB3291F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2F01F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.m */; }; - DB9EB32A1F63FFB40044FCC2 /* KFVectorFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2F11F63FFB40044FCC2 /* KFVectorFeature.h */; }; - DB9EB32B1F63FFB40044FCC2 /* KFVectorPathTrim.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2F21F63FFB40044FCC2 /* KFVectorPathTrim.h */; }; - DB9EB32C1F63FFB40044FCC2 /* KFVectorGradientEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2F41F63FFB40044FCC2 /* KFVectorGradientEffect.h */; }; - DB9EB32D1F63FFB40044FCC2 /* KFVectorAnimationGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2F51F63FFB40044FCC2 /* KFVectorAnimationGroup.m */; }; - DB9EB32E1F63FFB40044FCC2 /* KFVector.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2F61F63FFB40044FCC2 /* KFVector.m */; }; - DB9EB32F1F63FFB40044FCC2 /* KFVectorAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2F71F63FFB40044FCC2 /* KFVectorAnimation.m */; }; - DB9EB3301F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB2FC1F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.h */; }; - DB9EB3311F63FFB40044FCC2 /* KFVectorAnimationKeyValue.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB2FE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.m */; }; - DB9EB3321F63FFB40044FCC2 /* KFVectorView.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB3001F63FFB40044FCC2 /* KFVectorView.m */; }; - DB9EB3331F63FFB40044FCC2 /* KFVectorView.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB3011F63FFB40044FCC2 /* KFVectorView.h */; }; - DB9EB3341F63FFB40044FCC2 /* KFUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB3031F63FFB40044FCC2 /* KFUtilities.h */; }; - DB9EB3351F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB3041F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.h */; }; - DB9EB3361F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB3051F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.h */; }; - DB9EB3371F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB3061F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.m */; }; - DB9EB3381F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB3071F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.m */; }; - DB9EB3391F63FFB40044FCC2 /* KFUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB3081F63FFB40044FCC2 /* KFUtilities.m */; }; - DB9EB33A1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB30A1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.h */; }; - DB9EB33B1F63FFB40044FCC2 /* KFVectorParsingHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB30B1F63FFB40044FCC2 /* KFVectorParsingHelper.m */; }; - DB9EB33C1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DB9EB30C1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.m */; }; - DB9EB33D1F63FFB40044FCC2 /* KFVectorParsingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = DB9EB30D1F63FFB40044FCC2 /* KFVectorParsingHelper.h */; }; + DB79E6742030D7A8009CFB39 /* TiAnimationConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79E6732030D7A8009CFB39 /* TiAnimationConstants.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -232,205 +52,15 @@ 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; 24DE9E0F11C5FE74003F90F6 /* TiAnimationModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAnimationModuleAssets.h; path = Classes/TiAnimationModuleAssets.h; sourceTree = ""; }; 24DE9E1011C5FE74003F90F6 /* TiAnimationModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiAnimationModuleAssets.m; path = Classes/TiAnimationModuleAssets.m; sourceTree = ""; }; + 3AB3D37A21BE459A0060E89D /* Lottie.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lottie.framework; path = platform/Lottie.framework; sourceTree = ""; }; + 3AB3D37C21BE475F0060E89D /* TiAnimationAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAnimationAnimationView.h; path = Classes/TiAnimationAnimationView.h; sourceTree = ""; }; + 3AB3D37D21BE475F0060E89D /* TiAnimationAnimationViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiAnimationAnimationViewProxy.m; path = Classes/TiAnimationAnimationViewProxy.m; sourceTree = ""; }; + 3AB3D37E21BE475F0060E89D /* TiAnimationAnimationViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAnimationAnimationViewProxy.h; path = Classes/TiAnimationAnimationViewProxy.h; sourceTree = ""; }; + 3AB3D37F21BE475F0060E89D /* TiAnimationAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiAnimationAnimationView.m; path = Classes/TiAnimationAnimationView.m; sourceTree = ""; }; AA747D9E0F9514B9006C5449 /* TiAnimation_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiAnimation_Prefix.pch; sourceTree = SOURCE_ROOT; }; AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; D2AAC07E0554694100DB518D /* libti.animation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libti.animation.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DB79E5662030CFD8009CFB39 /* LOTRenderNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTRenderNode.m; sourceTree = ""; }; - DB79E5672030CFD8009CFB39 /* LOTAnimatorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimatorNode.h; sourceTree = ""; }; - DB79E5682030CFD8009CFB39 /* LOTRenderNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTRenderNode.h; sourceTree = ""; }; - DB79E56A2030CFD8009CFB39 /* LOTTrimPathNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTTrimPathNode.h; sourceTree = ""; }; - DB79E56B2030CFD8009CFB39 /* LOTTrimPathNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTTrimPathNode.m; sourceTree = ""; }; - DB79E56D2030CFD8009CFB39 /* LOTColorInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTColorInterpolator.m; sourceTree = ""; }; - DB79E56E2030CFD8009CFB39 /* LOTPathInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTPathInterpolator.m; sourceTree = ""; }; - DB79E56F2030CFD8009CFB39 /* LOTSizeInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTSizeInterpolator.h; sourceTree = ""; }; - DB79E5702030CFD8009CFB39 /* LOTValueInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTValueInterpolator.h; sourceTree = ""; }; - DB79E5712030CFD8009CFB39 /* LOTPointInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPointInterpolator.h; sourceTree = ""; }; - DB79E5722030CFD8009CFB39 /* LOTNumberInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTNumberInterpolator.h; sourceTree = ""; }; - DB79E5732030CFD8009CFB39 /* LOTTransformInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTTransformInterpolator.h; sourceTree = ""; }; - DB79E5742030CFD8009CFB39 /* LOTArrayInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTArrayInterpolator.h; sourceTree = ""; }; - DB79E5752030CFD8009CFB39 /* LOTColorInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTColorInterpolator.h; sourceTree = ""; }; - DB79E5762030CFD8009CFB39 /* LOTSizeInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTSizeInterpolator.m; sourceTree = ""; }; - DB79E5772030CFD8009CFB39 /* LOTPathInterpolator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPathInterpolator.h; sourceTree = ""; }; - DB79E5782030CFD8009CFB39 /* LOTPointInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTPointInterpolator.m; sourceTree = ""; }; - DB79E5792030CFD8009CFB39 /* LOTValueInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTValueInterpolator.m; sourceTree = ""; }; - DB79E57A2030CFD8009CFB39 /* LOTTransformInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTTransformInterpolator.m; sourceTree = ""; }; - DB79E57B2030CFD8009CFB39 /* LOTArrayInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTArrayInterpolator.m; sourceTree = ""; }; - DB79E57C2030CFD8009CFB39 /* LOTNumberInterpolator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTNumberInterpolator.m; sourceTree = ""; }; - DB79E57D2030CFD8009CFB39 /* LOTAnimatorNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimatorNode.m; sourceTree = ""; }; - DB79E57F2030CFD8009CFB39 /* LOTPathAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTPathAnimator.m; sourceTree = ""; }; - DB79E5802030CFD8009CFB39 /* LOTPolystarAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTPolystarAnimator.m; sourceTree = ""; }; - DB79E5812030CFD8009CFB39 /* LOTPolygonAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTPolygonAnimator.m; sourceTree = ""; }; - DB79E5822030CFD8009CFB39 /* LOTRoundedRectAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTRoundedRectAnimator.h; sourceTree = ""; }; - DB79E5832030CFD8009CFB39 /* LOTCircleAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTCircleAnimator.m; sourceTree = ""; }; - DB79E5842030CFD8009CFB39 /* LOTPolystarAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPolystarAnimator.h; sourceTree = ""; }; - DB79E5852030CFD8009CFB39 /* LOTPathAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPathAnimator.h; sourceTree = ""; }; - DB79E5862030CFD8009CFB39 /* LOTCircleAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTCircleAnimator.h; sourceTree = ""; }; - DB79E5872030CFD8009CFB39 /* LOTRoundedRectAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTRoundedRectAnimator.m; sourceTree = ""; }; - DB79E5882030CFD8009CFB39 /* LOTPolygonAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPolygonAnimator.h; sourceTree = ""; }; - DB79E58A2030CFD8009CFB39 /* LOTRenderGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTRenderGroup.m; sourceTree = ""; }; - DB79E58B2030CFD8009CFB39 /* LOTGradientFillRender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTGradientFillRender.m; sourceTree = ""; }; - DB79E58C2030CFD8009CFB39 /* LOTFillRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTFillRenderer.h; sourceTree = ""; }; - DB79E58D2030CFD8009CFB39 /* LOTStrokeRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTStrokeRenderer.h; sourceTree = ""; }; - DB79E58E2030CFD8009CFB39 /* LOTRepeaterRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTRepeaterRenderer.h; sourceTree = ""; }; - DB79E58F2030CFD8009CFB39 /* LOTRenderGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTRenderGroup.h; sourceTree = ""; }; - DB79E5902030CFD8009CFB39 /* LOTStrokeRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTStrokeRenderer.m; sourceTree = ""; }; - DB79E5912030CFD8009CFB39 /* LOTFillRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTFillRenderer.m; sourceTree = ""; }; - DB79E5922030CFD8009CFB39 /* LOTGradientFillRender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTGradientFillRender.h; sourceTree = ""; }; - DB79E5932030CFD8009CFB39 /* LOTRepeaterRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTRepeaterRenderer.m; sourceTree = ""; }; - DB79E5952030CFD8009CFB39 /* LOTMask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTMask.m; sourceTree = ""; }; - DB79E5962030CFD8009CFB39 /* LOTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTLayer.m; sourceTree = ""; }; - DB79E5972030CFD8009CFB39 /* LOTAssetGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAssetGroup.m; sourceTree = ""; }; - DB79E5982030CFD8009CFB39 /* LOTShapeRectangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeRectangle.h; sourceTree = ""; }; - DB79E5992030CFD8009CFB39 /* LOTShapeRepeater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeRepeater.h; sourceTree = ""; }; - DB79E59A2030CFD8009CFB39 /* LOTAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAsset.h; sourceTree = ""; }; - DB79E59B2030CFD8009CFB39 /* LOTShapeCircle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeCircle.h; sourceTree = ""; }; - DB79E59C2030CFD8009CFB39 /* LOTLayerGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTLayerGroup.m; sourceTree = ""; }; - DB79E59D2030CFD8009CFB39 /* LOTShapeStar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeStar.m; sourceTree = ""; }; - DB79E59E2030CFD8009CFB39 /* LOTShapeTrimPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeTrimPath.m; sourceTree = ""; }; - DB79E59F2030CFD8009CFB39 /* LOTShapeGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeGroup.h; sourceTree = ""; }; - DB79E5A02030CFD8009CFB39 /* LOTShapePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapePath.h; sourceTree = ""; }; - DB79E5A12030CFD8009CFB39 /* LOTShapeStroke.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeStroke.h; sourceTree = ""; }; - DB79E5A22030CFD8009CFB39 /* LOTShapeGradientFill.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeGradientFill.m; sourceTree = ""; }; - DB79E5A32030CFD8009CFB39 /* LOTShapeFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeFill.h; sourceTree = ""; }; - DB79E5A42030CFD8009CFB39 /* LOTShapeTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeTransform.h; sourceTree = ""; }; - DB79E5A52030CFD8009CFB39 /* LOTAsset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAsset.m; sourceTree = ""; }; - DB79E5A62030CFD8009CFB39 /* LOTModels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTModels.h; sourceTree = ""; }; - DB79E5A72030CFD8009CFB39 /* LOTShapeRepeater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeRepeater.m; sourceTree = ""; }; - DB79E5A82030CFD8009CFB39 /* LOTAssetGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAssetGroup.h; sourceTree = ""; }; - DB79E5A92030CFD8009CFB39 /* LOTShapeRectangle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeRectangle.m; sourceTree = ""; }; - DB79E5AA2030CFD8009CFB39 /* LOTLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTLayer.h; sourceTree = ""; }; - DB79E5AB2030CFD8009CFB39 /* LOTMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTMask.h; sourceTree = ""; }; - DB79E5AC2030CFD8009CFB39 /* LOTShapeStar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeStar.h; sourceTree = ""; }; - DB79E5AD2030CFD8009CFB39 /* LOTLayerGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTLayerGroup.h; sourceTree = ""; }; - DB79E5AE2030CFD8009CFB39 /* LOTShapeCircle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeCircle.m; sourceTree = ""; }; - DB79E5AF2030CFD8009CFB39 /* LOTShapePath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapePath.m; sourceTree = ""; }; - DB79E5B02030CFD8009CFB39 /* LOTShapeGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeGroup.m; sourceTree = ""; }; - DB79E5B12030CFD8009CFB39 /* LOTShapeTrimPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeTrimPath.h; sourceTree = ""; }; - DB79E5B22030CFD8009CFB39 /* LOTShapeFill.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeFill.m; sourceTree = ""; }; - DB79E5B32030CFD8009CFB39 /* LOTShapeTransform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeTransform.m; sourceTree = ""; }; - DB79E5B42030CFD8009CFB39 /* LOTShapeGradientFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTShapeGradientFill.h; sourceTree = ""; }; - DB79E5B52030CFD8009CFB39 /* LOTShapeStroke.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTShapeStroke.m; sourceTree = ""; }; - DB79E5B72030CFD8009CFB39 /* LOTHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTHelpers.h; sourceTree = ""; }; - DB79E5B82030CFD8009CFB39 /* LOTRadialGradientLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTRadialGradientLayer.h; sourceTree = ""; }; - DB79E5B92030CFD8009CFB39 /* CGGeometry+LOTAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CGGeometry+LOTAdditions.m"; sourceTree = ""; }; - DB79E5BA2030CFD8009CFB39 /* LOTBezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTBezierPath.m; sourceTree = ""; }; - DB79E5BB2030CFD8009CFB39 /* UIColor+Expanded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Expanded.h"; sourceTree = ""; }; - DB79E5BC2030CFD8009CFB39 /* LOTRadialGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTRadialGradientLayer.m; sourceTree = ""; }; - DB79E5BD2030CFD8009CFB39 /* CGGeometry+LOTAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CGGeometry+LOTAdditions.h"; sourceTree = ""; }; - DB79E5BE2030CFD8009CFB39 /* LOTBezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTBezierPath.h; sourceTree = ""; }; - DB79E5BF2030CFD8009CFB39 /* UIColor+Expanded.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Expanded.m"; sourceTree = ""; }; - DB79E5C12030CFD8009CFB39 /* UIColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIColor.h; sourceTree = ""; }; - DB79E5C22030CFD8009CFB39 /* UIBezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBezierPath.m; sourceTree = ""; }; - DB79E5C32030CFD8009CFB39 /* CALayer+Compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+Compat.h"; sourceTree = ""; }; - DB79E5C42030CFD8009CFB39 /* NSValue+Compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+Compat.h"; sourceTree = ""; }; - DB79E5C52030CFD8009CFB39 /* UIColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIColor.m; sourceTree = ""; }; - DB79E5C62030CFD8009CFB39 /* LOTPlatformCompat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTPlatformCompat.h; sourceTree = ""; }; - DB79E5C72030CFD8009CFB39 /* UIBezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBezierPath.h; sourceTree = ""; }; - DB79E5C82030CFD8009CFB39 /* NSValue+Compat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSValue+Compat.m"; sourceTree = ""; }; - DB79E5C92030CFD8009CFB39 /* CALayer+Compat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+Compat.m"; sourceTree = ""; }; - DB79E5CB2030CFD8009CFB39 /* LOTAnimationCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimationCache.m; sourceTree = ""; }; - DB79E5CC2030CFD8009CFB39 /* LOTComposition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTComposition.m; sourceTree = ""; }; - DB79E5CD2030CFD8009CFB39 /* LOTValueCallback.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTValueCallback.m; sourceTree = ""; }; - DB79E5CE2030CFD8009CFB39 /* LOTBlockCallback.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTBlockCallback.m; sourceTree = ""; }; - DB79E5CF2030CFD8009CFB39 /* LOTAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimationView.m; sourceTree = ""; }; - DB79E5D02030CFD8009CFB39 /* LOTAnimationTransitionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimationTransitionController.m; sourceTree = ""; }; - DB79E5D12030CFD8009CFB39 /* LOTAnimationView_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimationView_Internal.h; sourceTree = ""; }; - DB79E5D22030CFD8009CFB39 /* LOTKeypath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTKeypath.m; sourceTree = ""; }; - DB79E5D32030CFD8009CFB39 /* LOTCacheProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTCacheProvider.m; sourceTree = ""; }; - DB79E5D42030CFD8009CFB39 /* LOTAnimatedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimatedControl.m; sourceTree = ""; }; - DB79E5D52030CFD8009CFB39 /* LOTInterpolatorCallback.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTInterpolatorCallback.m; sourceTree = ""; }; - DB79E5D62030CFD8009CFB39 /* LOTAnimatedSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTAnimatedSwitch.m; sourceTree = ""; }; - DB79E5D82030CFD8009CFB39 /* LOTKeyframe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTKeyframe.m; sourceTree = ""; }; - DB79E5D92030CFD8009CFB39 /* LOTBezierData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTBezierData.m; sourceTree = ""; }; - DB79E5DA2030CFD8009CFB39 /* LOTKeyframe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTKeyframe.h; sourceTree = ""; }; - DB79E5DB2030CFD8009CFB39 /* LOTBezierData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTBezierData.h; sourceTree = ""; }; - DB79E5DD2030CFD8009CFB39 /* LOTLayerContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTLayerContainer.m; sourceTree = ""; }; - DB79E5DE2030CFD8009CFB39 /* LOTCompositionContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTCompositionContainer.h; sourceTree = ""; }; - DB79E5DF2030CFD8009CFB39 /* LOTMaskContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTMaskContainer.h; sourceTree = ""; }; - DB79E5E02030CFD8009CFB39 /* LOTLayerContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTLayerContainer.h; sourceTree = ""; }; - DB79E5E12030CFD8009CFB39 /* LOTCompositionContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTCompositionContainer.m; sourceTree = ""; }; - DB79E5E22030CFD8009CFB39 /* LOTMaskContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LOTMaskContainer.m; sourceTree = ""; }; - DB79E5E42030CFD8009CFB39 /* LOTValueDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTValueDelegate.h; sourceTree = ""; }; - DB79E5E52030CFD8009CFB39 /* LOTAnimatedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimatedControl.h; sourceTree = ""; }; - DB79E5E62030CFD8009CFB39 /* LOTCacheProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTCacheProvider.h; sourceTree = ""; }; - DB79E5E72030CFD8009CFB39 /* LOTKeypath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTKeypath.h; sourceTree = ""; }; - DB79E5E82030CFD8009CFB39 /* LOTInterpolatorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTInterpolatorCallback.h; sourceTree = ""; }; - DB79E5E92030CFD8009CFB39 /* LOTAnimatedSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimatedSwitch.h; sourceTree = ""; }; - DB79E5EA2030CFD8009CFB39 /* LOTAnimationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimationCache.h; sourceTree = ""; }; - DB79E5EB2030CFD8009CFB39 /* Lottie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Lottie.h; sourceTree = ""; }; - DB79E5EC2030CFD8009CFB39 /* LOTComposition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTComposition.h; sourceTree = ""; }; - DB79E5ED2030CFD8009CFB39 /* LOTAnimationTransitionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimationTransitionController.h; sourceTree = ""; }; - DB79E5EE2030CFD8009CFB39 /* LOTAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimationView.h; sourceTree = ""; }; - DB79E5EF2030CFD8009CFB39 /* LOTAnimationView_Compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTAnimationView_Compat.h; sourceTree = ""; }; - DB79E5F02030CFD8009CFB39 /* LOTValueCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTValueCallback.h; sourceTree = ""; }; - DB79E5F12030CFD8009CFB39 /* LOTBlockCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LOTBlockCallback.h; sourceTree = ""; }; - DB79E6732030D7A8009CFB39 /* TiLottieConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TiLottieConstants.h; path = Classes/TiLottieConstants.h; sourceTree = ""; }; - DB9C57471E48B77D0010BF6F /* TiAnimationLottieView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiAnimationLottieView.h; sourceTree = ""; }; - DB9C57481E48B77D0010BF6F /* TiAnimationLottieView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiAnimationLottieView.m; sourceTree = ""; }; - DB9C57491E48B77D0010BF6F /* TiAnimationLottieViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiAnimationLottieViewProxy.h; sourceTree = ""; }; - DB9C574A1E48B77D0010BF6F /* TiAnimationLottieViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TiAnimationLottieViewProxy.m; sourceTree = ""; }; - DB9C57C51E48BA9D0010BF6F /* TiAnimationKeyframeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAnimationKeyframeView.h; path = Classes/Keyframes/TiAnimationKeyframeView.h; sourceTree = ""; }; - DB9C57C61E48BA9D0010BF6F /* TiAnimationKeyframeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiAnimationKeyframeView.m; path = Classes/Keyframes/TiAnimationKeyframeView.m; sourceTree = ""; }; - DB9C57C71E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAnimationKeyframeViewProxy.h; path = Classes/Keyframes/TiAnimationKeyframeViewProxy.h; sourceTree = ""; }; - DB9C57C81E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiAnimationKeyframeViewProxy.m; path = Classes/Keyframes/TiAnimationKeyframeViewProxy.m; sourceTree = ""; }; - DB9EB2CE1F63FFB40044FCC2 /* Compatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compatibility.h; sourceTree = ""; }; - DB9EB2CF1F63FFB40044FCC2 /* NSValue+PlatformCompatibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSValue+PlatformCompatibility.m"; sourceTree = ""; }; - DB9EB2D01F63FFB40044FCC2 /* NSImage+PlatformCompatibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+PlatformCompatibility.m"; sourceTree = ""; }; - DB9EB2D11F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBezierPath+PlatformCompatibility.m"; sourceTree = ""; }; - DB9EB2D21F63FFB40044FCC2 /* NSImage+PlatformCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+PlatformCompatibility.h"; sourceTree = ""; }; - DB9EB2D31F63FFB40044FCC2 /* NSValue+PlatformCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+PlatformCompatibility.h"; sourceTree = ""; }; - DB9EB2D41F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBezierPath+PlatformCompatibility.h"; sourceTree = ""; }; - DB9EB2D61F63FFB40044FCC2 /* KFVectorLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorLayer.h; sourceTree = ""; }; - DB9EB2D71F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorGradientFeatureLayer.h; sourceTree = ""; }; - DB9EB2D81F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorBitmapFeatureLayer.m; sourceTree = ""; }; - DB9EB2D91F63FFB40044FCC2 /* KFVectorFeatureLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorFeatureLayer.h; sourceTree = ""; }; - DB9EB2DA1F63FFB40044FCC2 /* KFVectorLayerHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorLayerHelper.h; sourceTree = ""; }; - DB9EB2DB1F63FFB40044FCC2 /* KFVectorAnimationLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorAnimationLayer.m; sourceTree = ""; }; - DB9EB2DC1F63FFB40044FCC2 /* KFVectorLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorLayer.m; sourceTree = ""; }; - DB9EB2DD1F63FFB40044FCC2 /* KFVectorFeatureLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorFeatureLayer.m; sourceTree = ""; }; - DB9EB2DE1F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorGradientFeatureLayer.m; sourceTree = ""; }; - DB9EB2DF1F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorBitmapFeatureLayer.h; sourceTree = ""; }; - DB9EB2E01F63FFB40044FCC2 /* KFVectorLayerHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorLayerHelper.m; sourceTree = ""; }; - DB9EB2E11F63FFB40044FCC2 /* KFVectorFeatureLayerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorFeatureLayerInterface.h; sourceTree = ""; }; - DB9EB2E21F63FFB40044FCC2 /* KFVectorAnimationLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorAnimationLayer.h; sourceTree = ""; }; - DB9EB2E41F63FFB40044FCC2 /* KFVectorGradientEffect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorGradientEffect.m; sourceTree = ""; }; - DB9EB2E51F63FFB40044FCC2 /* KFVectorPathTrim.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorPathTrim.m; sourceTree = ""; }; - DB9EB2E61F63FFB40044FCC2 /* KFVectorAnimation.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorAnimation.value; sourceTree = ""; }; - DB9EB2E71F63FFB40044FCC2 /* KFVectorFeature.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorFeature.m; sourceTree = ""; }; - DB9EB2E81F63FFB40044FCC2 /* KFVectorAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorAnimation.h; sourceTree = ""; }; - DB9EB2E91F63FFB40044FCC2 /* KFVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVector.h; sourceTree = ""; }; - DB9EB2EA1F63FFB40044FCC2 /* KFVectorAnimationGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorAnimationGroup.h; sourceTree = ""; }; - DB9EB2EB1F63FFB40044FCC2 /* KFVector.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVector.value; sourceTree = ""; }; - DB9EB2EC1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorAnimationKeyValue.value; sourceTree = ""; }; - DB9EB2ED1F63FFB40044FCC2 /* KFVectorAnimationGroup.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorAnimationGroup.value; sourceTree = ""; }; - DB9EB2EE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorAnimationKeyValue.h; sourceTree = ""; }; - DB9EB2EF1F63FFB40044FCC2 /* .valueObjectConfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .valueObjectConfig; sourceTree = ""; }; - DB9EB2F01F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorFeatureKeyFrame.m; sourceTree = ""; }; - DB9EB2F11F63FFB40044FCC2 /* KFVectorFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorFeature.h; sourceTree = ""; }; - DB9EB2F21F63FFB40044FCC2 /* KFVectorPathTrim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorPathTrim.h; sourceTree = ""; }; - DB9EB2F31F63FFB40044FCC2 /* KFVectorGradientEffect.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorGradientEffect.value; sourceTree = ""; }; - DB9EB2F41F63FFB40044FCC2 /* KFVectorGradientEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorGradientEffect.h; sourceTree = ""; }; - DB9EB2F51F63FFB40044FCC2 /* KFVectorAnimationGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorAnimationGroup.m; sourceTree = ""; }; - DB9EB2F61F63FFB40044FCC2 /* KFVector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVector.m; sourceTree = ""; }; - DB9EB2F71F63FFB40044FCC2 /* KFVectorAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorAnimation.m; sourceTree = ""; }; - DB9EB2F81F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorFeatureKeyFrame.value; sourceTree = ""; }; - DB9EB2FA1F63FFB40044FCC2 /* fb-copyright-header-comment.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "fb-copyright-header-comment.js"; sourceTree = ""; }; - DB9EB2FB1F63FFB40044FCC2 /* KFVectorFeature.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorFeature.value; sourceTree = ""; }; - DB9EB2FC1F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorFeatureKeyFrame.h; sourceTree = ""; }; - DB9EB2FD1F63FFB40044FCC2 /* KFVectorPathTrim.value */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KFVectorPathTrim.value; sourceTree = ""; }; - DB9EB2FE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorAnimationKeyValue.m; sourceTree = ""; }; - DB9EB3001F63FFB40044FCC2 /* KFVectorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorView.m; sourceTree = ""; }; - DB9EB3011F63FFB40044FCC2 /* KFVectorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorView.h; sourceTree = ""; }; - DB9EB3031F63FFB40044FCC2 /* KFUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFUtilities.h; sourceTree = ""; }; - DB9EB3041F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+KFVectorLayer.h"; sourceTree = ""; }; - DB9EB3051F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CAMediaTimingFunction+KFVectorLayer.h"; sourceTree = ""; }; - DB9EB3061F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CAMediaTimingFunction+KFVectorLayer.m"; sourceTree = ""; }; - DB9EB3071F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+KFVectorLayer.m"; sourceTree = ""; }; - DB9EB3081F63FFB40044FCC2 /* KFUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFUtilities.m; sourceTree = ""; }; - DB9EB30A1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorBezierPathsHelper.h; sourceTree = ""; }; - DB9EB30B1F63FFB40044FCC2 /* KFVectorParsingHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorParsingHelper.m; sourceTree = ""; }; - DB9EB30C1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KFVectorBezierPathsHelper.m; sourceTree = ""; }; - DB9EB30D1F63FFB40044FCC2 /* KFVectorParsingHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KFVectorParsingHelper.h; sourceTree = ""; }; + DB79E6732030D7A8009CFB39 /* TiAnimationConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TiAnimationConstants.h; path = Classes/TiAnimationConstants.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -439,6 +69,7 @@ buildActionMask = 2147483647; files = ( AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, + 3AB3D37B21BE459A0060E89D /* Lottie.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -467,6 +98,7 @@ 0867D69AFE84028FC02AAC07 /* Frameworks */ = { isa = PBXGroup; children = ( + 3AB3D37A21BE459A0060E89D /* Lottie.framework */, AACBBE490F95108600F1A2B1 /* Foundation.framework */, ); name = Frameworks; @@ -475,13 +107,12 @@ 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( - DB9C56FE1E48B77D0010BF6F /* Lottie */, - DB9C57911E48BA450010BF6F /* Keyframes */, + 3AB3D37121BE458A0060E89D /* Animation View */, 24DE9E0F11C5FE74003F90F6 /* TiAnimationModuleAssets.h */, 24DE9E1011C5FE74003F90F6 /* TiAnimationModuleAssets.m */, 24DD6CF71134B3F500162E58 /* TiAnimationModule.h */, 24DD6CF81134B3F500162E58 /* TiAnimationModule.m */, - DB79E6732030D7A8009CFB39 /* TiLottieConstants.h */, + DB79E6732030D7A8009CFB39 /* TiAnimationConstants.h */, ); name = Classes; sourceTree = ""; @@ -495,391 +126,15 @@ name = "Other Sources"; sourceTree = ""; }; - DB79E5642030CFD8009CFB39 /* Classes */ = { + 3AB3D37121BE458A0060E89D /* Animation View */ = { isa = PBXGroup; children = ( - DB79E5652030CFD8009CFB39 /* RenderSystem */, - DB79E5942030CFD8009CFB39 /* Models */, - DB79E5B62030CFD8009CFB39 /* Extensions */, - DB79E5C02030CFD8009CFB39 /* MacCompatability */, - DB79E5CA2030CFD8009CFB39 /* Private */, - DB79E5D72030CFD8009CFB39 /* AnimatableProperties */, - DB79E5DC2030CFD8009CFB39 /* AnimatableLayers */, - DB79E5E32030CFD8009CFB39 /* PublicHeaders */, + 3AB3D37C21BE475F0060E89D /* TiAnimationAnimationView.h */, + 3AB3D37F21BE475F0060E89D /* TiAnimationAnimationView.m */, + 3AB3D37E21BE475F0060E89D /* TiAnimationAnimationViewProxy.h */, + 3AB3D37D21BE475F0060E89D /* TiAnimationAnimationViewProxy.m */, ); - path = Classes; - sourceTree = ""; - }; - DB79E5652030CFD8009CFB39 /* RenderSystem */ = { - isa = PBXGroup; - children = ( - DB79E5662030CFD8009CFB39 /* LOTRenderNode.m */, - DB79E5672030CFD8009CFB39 /* LOTAnimatorNode.h */, - DB79E5682030CFD8009CFB39 /* LOTRenderNode.h */, - DB79E5692030CFD8009CFB39 /* ManipulatorNodes */, - DB79E56C2030CFD8009CFB39 /* InterpolatorNodes */, - DB79E57D2030CFD8009CFB39 /* LOTAnimatorNode.m */, - DB79E57E2030CFD8009CFB39 /* AnimatorNodes */, - DB79E5892030CFD8009CFB39 /* RenderNodes */, - ); - path = RenderSystem; - sourceTree = ""; - }; - DB79E5692030CFD8009CFB39 /* ManipulatorNodes */ = { - isa = PBXGroup; - children = ( - DB79E56A2030CFD8009CFB39 /* LOTTrimPathNode.h */, - DB79E56B2030CFD8009CFB39 /* LOTTrimPathNode.m */, - ); - path = ManipulatorNodes; - sourceTree = ""; - }; - DB79E56C2030CFD8009CFB39 /* InterpolatorNodes */ = { - isa = PBXGroup; - children = ( - DB79E56D2030CFD8009CFB39 /* LOTColorInterpolator.m */, - DB79E56E2030CFD8009CFB39 /* LOTPathInterpolator.m */, - DB79E56F2030CFD8009CFB39 /* LOTSizeInterpolator.h */, - DB79E5702030CFD8009CFB39 /* LOTValueInterpolator.h */, - DB79E5712030CFD8009CFB39 /* LOTPointInterpolator.h */, - DB79E5722030CFD8009CFB39 /* LOTNumberInterpolator.h */, - DB79E5732030CFD8009CFB39 /* LOTTransformInterpolator.h */, - DB79E5742030CFD8009CFB39 /* LOTArrayInterpolator.h */, - DB79E5752030CFD8009CFB39 /* LOTColorInterpolator.h */, - DB79E5762030CFD8009CFB39 /* LOTSizeInterpolator.m */, - DB79E5772030CFD8009CFB39 /* LOTPathInterpolator.h */, - DB79E5782030CFD8009CFB39 /* LOTPointInterpolator.m */, - DB79E5792030CFD8009CFB39 /* LOTValueInterpolator.m */, - DB79E57A2030CFD8009CFB39 /* LOTTransformInterpolator.m */, - DB79E57B2030CFD8009CFB39 /* LOTArrayInterpolator.m */, - DB79E57C2030CFD8009CFB39 /* LOTNumberInterpolator.m */, - ); - path = InterpolatorNodes; - sourceTree = ""; - }; - DB79E57E2030CFD8009CFB39 /* AnimatorNodes */ = { - isa = PBXGroup; - children = ( - DB79E57F2030CFD8009CFB39 /* LOTPathAnimator.m */, - DB79E5802030CFD8009CFB39 /* LOTPolystarAnimator.m */, - DB79E5812030CFD8009CFB39 /* LOTPolygonAnimator.m */, - DB79E5822030CFD8009CFB39 /* LOTRoundedRectAnimator.h */, - DB79E5832030CFD8009CFB39 /* LOTCircleAnimator.m */, - DB79E5842030CFD8009CFB39 /* LOTPolystarAnimator.h */, - DB79E5852030CFD8009CFB39 /* LOTPathAnimator.h */, - DB79E5862030CFD8009CFB39 /* LOTCircleAnimator.h */, - DB79E5872030CFD8009CFB39 /* LOTRoundedRectAnimator.m */, - DB79E5882030CFD8009CFB39 /* LOTPolygonAnimator.h */, - ); - path = AnimatorNodes; - sourceTree = ""; - }; - DB79E5892030CFD8009CFB39 /* RenderNodes */ = { - isa = PBXGroup; - children = ( - DB79E58A2030CFD8009CFB39 /* LOTRenderGroup.m */, - DB79E58B2030CFD8009CFB39 /* LOTGradientFillRender.m */, - DB79E58C2030CFD8009CFB39 /* LOTFillRenderer.h */, - DB79E58D2030CFD8009CFB39 /* LOTStrokeRenderer.h */, - DB79E58E2030CFD8009CFB39 /* LOTRepeaterRenderer.h */, - DB79E58F2030CFD8009CFB39 /* LOTRenderGroup.h */, - DB79E5902030CFD8009CFB39 /* LOTStrokeRenderer.m */, - DB79E5912030CFD8009CFB39 /* LOTFillRenderer.m */, - DB79E5922030CFD8009CFB39 /* LOTGradientFillRender.h */, - DB79E5932030CFD8009CFB39 /* LOTRepeaterRenderer.m */, - ); - path = RenderNodes; - sourceTree = ""; - }; - DB79E5942030CFD8009CFB39 /* Models */ = { - isa = PBXGroup; - children = ( - DB79E5952030CFD8009CFB39 /* LOTMask.m */, - DB79E5962030CFD8009CFB39 /* LOTLayer.m */, - DB79E5972030CFD8009CFB39 /* LOTAssetGroup.m */, - DB79E5982030CFD8009CFB39 /* LOTShapeRectangle.h */, - DB79E5992030CFD8009CFB39 /* LOTShapeRepeater.h */, - DB79E59A2030CFD8009CFB39 /* LOTAsset.h */, - DB79E59B2030CFD8009CFB39 /* LOTShapeCircle.h */, - DB79E59C2030CFD8009CFB39 /* LOTLayerGroup.m */, - DB79E59D2030CFD8009CFB39 /* LOTShapeStar.m */, - DB79E59E2030CFD8009CFB39 /* LOTShapeTrimPath.m */, - DB79E59F2030CFD8009CFB39 /* LOTShapeGroup.h */, - DB79E5A02030CFD8009CFB39 /* LOTShapePath.h */, - DB79E5A12030CFD8009CFB39 /* LOTShapeStroke.h */, - DB79E5A22030CFD8009CFB39 /* LOTShapeGradientFill.m */, - DB79E5A32030CFD8009CFB39 /* LOTShapeFill.h */, - DB79E5A42030CFD8009CFB39 /* LOTShapeTransform.h */, - DB79E5A52030CFD8009CFB39 /* LOTAsset.m */, - DB79E5A62030CFD8009CFB39 /* LOTModels.h */, - DB79E5A72030CFD8009CFB39 /* LOTShapeRepeater.m */, - DB79E5A82030CFD8009CFB39 /* LOTAssetGroup.h */, - DB79E5A92030CFD8009CFB39 /* LOTShapeRectangle.m */, - DB79E5AA2030CFD8009CFB39 /* LOTLayer.h */, - DB79E5AB2030CFD8009CFB39 /* LOTMask.h */, - DB79E5AC2030CFD8009CFB39 /* LOTShapeStar.h */, - DB79E5AD2030CFD8009CFB39 /* LOTLayerGroup.h */, - DB79E5AE2030CFD8009CFB39 /* LOTShapeCircle.m */, - DB79E5AF2030CFD8009CFB39 /* LOTShapePath.m */, - DB79E5B02030CFD8009CFB39 /* LOTShapeGroup.m */, - DB79E5B12030CFD8009CFB39 /* LOTShapeTrimPath.h */, - DB79E5B22030CFD8009CFB39 /* LOTShapeFill.m */, - DB79E5B32030CFD8009CFB39 /* LOTShapeTransform.m */, - DB79E5B42030CFD8009CFB39 /* LOTShapeGradientFill.h */, - DB79E5B52030CFD8009CFB39 /* LOTShapeStroke.m */, - ); - path = Models; - sourceTree = ""; - }; - DB79E5B62030CFD8009CFB39 /* Extensions */ = { - isa = PBXGroup; - children = ( - DB79E5B72030CFD8009CFB39 /* LOTHelpers.h */, - DB79E5B82030CFD8009CFB39 /* LOTRadialGradientLayer.h */, - DB79E5B92030CFD8009CFB39 /* CGGeometry+LOTAdditions.m */, - DB79E5BA2030CFD8009CFB39 /* LOTBezierPath.m */, - DB79E5BB2030CFD8009CFB39 /* UIColor+Expanded.h */, - DB79E5BC2030CFD8009CFB39 /* LOTRadialGradientLayer.m */, - DB79E5BD2030CFD8009CFB39 /* CGGeometry+LOTAdditions.h */, - DB79E5BE2030CFD8009CFB39 /* LOTBezierPath.h */, - DB79E5BF2030CFD8009CFB39 /* UIColor+Expanded.m */, - ); - path = Extensions; - sourceTree = ""; - }; - DB79E5C02030CFD8009CFB39 /* MacCompatability */ = { - isa = PBXGroup; - children = ( - DB79E5C12030CFD8009CFB39 /* UIColor.h */, - DB79E5C22030CFD8009CFB39 /* UIBezierPath.m */, - DB79E5C32030CFD8009CFB39 /* CALayer+Compat.h */, - DB79E5C42030CFD8009CFB39 /* NSValue+Compat.h */, - DB79E5C52030CFD8009CFB39 /* UIColor.m */, - DB79E5C62030CFD8009CFB39 /* LOTPlatformCompat.h */, - DB79E5C72030CFD8009CFB39 /* UIBezierPath.h */, - DB79E5C82030CFD8009CFB39 /* NSValue+Compat.m */, - DB79E5C92030CFD8009CFB39 /* CALayer+Compat.m */, - ); - path = MacCompatability; - sourceTree = ""; - }; - DB79E5CA2030CFD8009CFB39 /* Private */ = { - isa = PBXGroup; - children = ( - DB79E5CB2030CFD8009CFB39 /* LOTAnimationCache.m */, - DB79E5CC2030CFD8009CFB39 /* LOTComposition.m */, - DB79E5CD2030CFD8009CFB39 /* LOTValueCallback.m */, - DB79E5CE2030CFD8009CFB39 /* LOTBlockCallback.m */, - DB79E5CF2030CFD8009CFB39 /* LOTAnimationView.m */, - DB79E5D02030CFD8009CFB39 /* LOTAnimationTransitionController.m */, - DB79E5D12030CFD8009CFB39 /* LOTAnimationView_Internal.h */, - DB79E5D22030CFD8009CFB39 /* LOTKeypath.m */, - DB79E5D32030CFD8009CFB39 /* LOTCacheProvider.m */, - DB79E5D42030CFD8009CFB39 /* LOTAnimatedControl.m */, - DB79E5D52030CFD8009CFB39 /* LOTInterpolatorCallback.m */, - DB79E5D62030CFD8009CFB39 /* LOTAnimatedSwitch.m */, - ); - path = Private; - sourceTree = ""; - }; - DB79E5D72030CFD8009CFB39 /* AnimatableProperties */ = { - isa = PBXGroup; - children = ( - DB79E5D82030CFD8009CFB39 /* LOTKeyframe.m */, - DB79E5D92030CFD8009CFB39 /* LOTBezierData.m */, - DB79E5DA2030CFD8009CFB39 /* LOTKeyframe.h */, - DB79E5DB2030CFD8009CFB39 /* LOTBezierData.h */, - ); - path = AnimatableProperties; - sourceTree = ""; - }; - DB79E5DC2030CFD8009CFB39 /* AnimatableLayers */ = { - isa = PBXGroup; - children = ( - DB79E5DD2030CFD8009CFB39 /* LOTLayerContainer.m */, - DB79E5DE2030CFD8009CFB39 /* LOTCompositionContainer.h */, - DB79E5DF2030CFD8009CFB39 /* LOTMaskContainer.h */, - DB79E5E02030CFD8009CFB39 /* LOTLayerContainer.h */, - DB79E5E12030CFD8009CFB39 /* LOTCompositionContainer.m */, - DB79E5E22030CFD8009CFB39 /* LOTMaskContainer.m */, - ); - path = AnimatableLayers; - sourceTree = ""; - }; - DB79E5E32030CFD8009CFB39 /* PublicHeaders */ = { - isa = PBXGroup; - children = ( - DB79E5E42030CFD8009CFB39 /* LOTValueDelegate.h */, - DB79E5E52030CFD8009CFB39 /* LOTAnimatedControl.h */, - DB79E5E62030CFD8009CFB39 /* LOTCacheProvider.h */, - DB79E5E72030CFD8009CFB39 /* LOTKeypath.h */, - DB79E5E82030CFD8009CFB39 /* LOTInterpolatorCallback.h */, - DB79E5E92030CFD8009CFB39 /* LOTAnimatedSwitch.h */, - DB79E5EA2030CFD8009CFB39 /* LOTAnimationCache.h */, - DB79E5EB2030CFD8009CFB39 /* Lottie.h */, - DB79E5EC2030CFD8009CFB39 /* LOTComposition.h */, - DB79E5ED2030CFD8009CFB39 /* LOTAnimationTransitionController.h */, - DB79E5EE2030CFD8009CFB39 /* LOTAnimationView.h */, - DB79E5EF2030CFD8009CFB39 /* LOTAnimationView_Compat.h */, - DB79E5F02030CFD8009CFB39 /* LOTValueCallback.h */, - DB79E5F12030CFD8009CFB39 /* LOTBlockCallback.h */, - ); - path = PublicHeaders; - sourceTree = ""; - }; - DB9C56FE1E48B77D0010BF6F /* Lottie */ = { - isa = PBXGroup; - children = ( - DBECE9F11FDAED2C0019C41E /* lottie-ios */, - DB9C57471E48B77D0010BF6F /* TiAnimationLottieView.h */, - DB9C57481E48B77D0010BF6F /* TiAnimationLottieView.m */, - DB9C57491E48B77D0010BF6F /* TiAnimationLottieViewProxy.h */, - DB9C574A1E48B77D0010BF6F /* TiAnimationLottieViewProxy.m */, - ); - name = Lottie; - path = Classes/Lottie; - sourceTree = ""; - }; - DB9C57911E48BA450010BF6F /* Keyframes */ = { - isa = PBXGroup; - children = ( - DB9EB2CC1F63FFB40044FCC2 /* keyframes-ios */, - DB9C57C51E48BA9D0010BF6F /* TiAnimationKeyframeView.h */, - DB9C57C61E48BA9D0010BF6F /* TiAnimationKeyframeView.m */, - DB9C57C71E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.h */, - DB9C57C81E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.m */, - ); - name = Keyframes; - sourceTree = ""; - }; - DB9EB2CC1F63FFB40044FCC2 /* keyframes-ios */ = { - isa = PBXGroup; - children = ( - DB9EB2CD1F63FFB40044FCC2 /* Compatibility */, - DB9EB2D51F63FFB40044FCC2 /* Layers */, - DB9EB2E31F63FFB40044FCC2 /* DataModel */, - DB9EB2FF1F63FFB40044FCC2 /* Views */, - DB9EB3021F63FFB40044FCC2 /* Helpers */, - DB9EB3091F63FFB40044FCC2 /* ParsingHelpers */, - ); - name = "keyframes-ios"; - path = "Classes/Keyframes/keyframes-ios"; - sourceTree = ""; - }; - DB9EB2CD1F63FFB40044FCC2 /* Compatibility */ = { - isa = PBXGroup; - children = ( - DB9EB2CE1F63FFB40044FCC2 /* Compatibility.h */, - DB9EB2CF1F63FFB40044FCC2 /* NSValue+PlatformCompatibility.m */, - DB9EB2D01F63FFB40044FCC2 /* NSImage+PlatformCompatibility.m */, - DB9EB2D11F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.m */, - DB9EB2D21F63FFB40044FCC2 /* NSImage+PlatformCompatibility.h */, - DB9EB2D31F63FFB40044FCC2 /* NSValue+PlatformCompatibility.h */, - DB9EB2D41F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.h */, - ); - path = Compatibility; - sourceTree = ""; - }; - DB9EB2D51F63FFB40044FCC2 /* Layers */ = { - isa = PBXGroup; - children = ( - DB9EB2D61F63FFB40044FCC2 /* KFVectorLayer.h */, - DB9EB2D71F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.h */, - DB9EB2D81F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.m */, - DB9EB2D91F63FFB40044FCC2 /* KFVectorFeatureLayer.h */, - DB9EB2DA1F63FFB40044FCC2 /* KFVectorLayerHelper.h */, - DB9EB2DB1F63FFB40044FCC2 /* KFVectorAnimationLayer.m */, - DB9EB2DC1F63FFB40044FCC2 /* KFVectorLayer.m */, - DB9EB2DD1F63FFB40044FCC2 /* KFVectorFeatureLayer.m */, - DB9EB2DE1F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.m */, - DB9EB2DF1F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.h */, - DB9EB2E01F63FFB40044FCC2 /* KFVectorLayerHelper.m */, - DB9EB2E11F63FFB40044FCC2 /* KFVectorFeatureLayerInterface.h */, - DB9EB2E21F63FFB40044FCC2 /* KFVectorAnimationLayer.h */, - ); - path = Layers; - sourceTree = ""; - }; - DB9EB2E31F63FFB40044FCC2 /* DataModel */ = { - isa = PBXGroup; - children = ( - DB9EB2E41F63FFB40044FCC2 /* KFVectorGradientEffect.m */, - DB9EB2E51F63FFB40044FCC2 /* KFVectorPathTrim.m */, - DB9EB2E61F63FFB40044FCC2 /* KFVectorAnimation.value */, - DB9EB2E71F63FFB40044FCC2 /* KFVectorFeature.m */, - DB9EB2E81F63FFB40044FCC2 /* KFVectorAnimation.h */, - DB9EB2E91F63FFB40044FCC2 /* KFVector.h */, - DB9EB2EA1F63FFB40044FCC2 /* KFVectorAnimationGroup.h */, - DB9EB2EB1F63FFB40044FCC2 /* KFVector.value */, - DB9EB2EC1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.value */, - DB9EB2ED1F63FFB40044FCC2 /* KFVectorAnimationGroup.value */, - DB9EB2EE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.h */, - DB9EB2EF1F63FFB40044FCC2 /* .valueObjectConfig */, - DB9EB2F01F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.m */, - DB9EB2F11F63FFB40044FCC2 /* KFVectorFeature.h */, - DB9EB2F21F63FFB40044FCC2 /* KFVectorPathTrim.h */, - DB9EB2F31F63FFB40044FCC2 /* KFVectorGradientEffect.value */, - DB9EB2F41F63FFB40044FCC2 /* KFVectorGradientEffect.h */, - DB9EB2F51F63FFB40044FCC2 /* KFVectorAnimationGroup.m */, - DB9EB2F61F63FFB40044FCC2 /* KFVector.m */, - DB9EB2F71F63FFB40044FCC2 /* KFVectorAnimation.m */, - DB9EB2F81F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.value */, - DB9EB2F91F63FFB40044FCC2 /* remodel-plugins */, - DB9EB2FB1F63FFB40044FCC2 /* KFVectorFeature.value */, - DB9EB2FC1F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.h */, - DB9EB2FD1F63FFB40044FCC2 /* KFVectorPathTrim.value */, - DB9EB2FE1F63FFB40044FCC2 /* KFVectorAnimationKeyValue.m */, - ); - path = DataModel; - sourceTree = ""; - }; - DB9EB2F91F63FFB40044FCC2 /* remodel-plugins */ = { - isa = PBXGroup; - children = ( - DB9EB2FA1F63FFB40044FCC2 /* fb-copyright-header-comment.js */, - ); - path = "remodel-plugins"; - sourceTree = ""; - }; - DB9EB2FF1F63FFB40044FCC2 /* Views */ = { - isa = PBXGroup; - children = ( - DB9EB3001F63FFB40044FCC2 /* KFVectorView.m */, - DB9EB3011F63FFB40044FCC2 /* KFVectorView.h */, - ); - path = Views; - sourceTree = ""; - }; - DB9EB3021F63FFB40044FCC2 /* Helpers */ = { - isa = PBXGroup; - children = ( - DB9EB3031F63FFB40044FCC2 /* KFUtilities.h */, - DB9EB3041F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.h */, - DB9EB3051F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.h */, - DB9EB3061F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.m */, - DB9EB3071F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.m */, - DB9EB3081F63FFB40044FCC2 /* KFUtilities.m */, - ); - path = Helpers; - sourceTree = ""; - }; - DB9EB3091F63FFB40044FCC2 /* ParsingHelpers */ = { - isa = PBXGroup; - children = ( - DB9EB30A1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.h */, - DB9EB30B1F63FFB40044FCC2 /* KFVectorParsingHelper.m */, - DB9EB30C1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.m */, - DB9EB30D1F63FFB40044FCC2 /* KFVectorParsingHelper.h */, - ); - path = ParsingHelpers; - sourceTree = ""; - }; - DBECE9F11FDAED2C0019C41E /* lottie-ios */ = { - isa = PBXGroup; - children = ( - DB79E5642030CFD8009CFB39 /* Classes */, - ); - path = "lottie-ios"; + name = "Animation View"; sourceTree = ""; }; /* End PBXGroup section */ @@ -889,107 +144,12 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - DB79E64C2030CFD8009CFB39 /* UIBezierPath.h in Headers */, - DB9EB3341F63FFB40044FCC2 /* KFUtilities.h in Headers */, - DB79E6552030CFD8009CFB39 /* LOTAnimationView_Internal.h in Headers */, - DB9EB3351F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.h in Headers */, - DB9EB33D1F63FFB40044FCC2 /* KFVectorParsingHelper.h in Headers */, - DB79E6152030CFD8009CFB39 /* LOTStrokeRenderer.h in Headers */, - DB79E65D2030CFD8009CFB39 /* LOTKeyframe.h in Headers */, - DB79E6682030CFD8009CFB39 /* LOTKeypath.h in Headers */, - DB79E6442030CFD8009CFB39 /* LOTBezierPath.h in Headers */, - DB9C578F1E48B77D0010BF6F /* TiAnimationLottieViewProxy.h in Headers */, - DB79E5FE2030CFD8009CFB39 /* LOTArrayInterpolator.h in Headers */, - DB9EB3331F63FFB40044FCC2 /* KFVectorView.h in Headers */, - DB9EB3251F63FFB40044FCC2 /* KFVectorAnimation.h in Headers */, - DB9EB3201F63FFB40044FCC2 /* KFVectorFeatureLayerInterface.h in Headers */, - DB79E66E2030CFD8009CFB39 /* LOTAnimationTransitionController.h in Headers */, - DB9EB31E1F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.h in Headers */, - DB79E5F42030CFD8009CFB39 /* LOTRenderNode.h in Headers */, - DB79E63B2030CFD8009CFB39 /* LOTShapeGradientFill.h in Headers */, - DB79E66F2030CFD8009CFB39 /* LOTAnimationView.h in Headers */, - DB9EB3191F63FFB40044FCC2 /* KFVectorLayerHelper.h in Headers */, - DB79E5F32030CFD8009CFB39 /* LOTAnimatorNode.h in Headers */, - DB79E6622030CFD8009CFB39 /* LOTLayerContainer.h in Headers */, - DB9EB3211F63FFB40044FCC2 /* KFVectorAnimationLayer.h in Headers */, - DB79E61F2030CFD8009CFB39 /* LOTShapeRectangle.h in Headers */, - DB9C57EE1E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.h in Headers */, - DB9C57EC1E48BA9D0010BF6F /* TiAnimationKeyframeView.h in Headers */, - DB79E5FF2030CFD8009CFB39 /* LOTColorInterpolator.h in Headers */, - DB79E6722030CFD8009CFB39 /* LOTBlockCallback.h in Headers */, - DB79E64B2030CFD8009CFB39 /* LOTPlatformCompat.h in Headers */, - DB79E66D2030CFD8009CFB39 /* LOTComposition.h in Headers */, - DB79E60D2030CFD8009CFB39 /* LOTPolystarAnimator.h in Headers */, - DB79E6272030CFD8009CFB39 /* LOTShapePath.h in Headers */, - DB79E5FD2030CFD8009CFB39 /* LOTTransformInterpolator.h in Headers */, - DB79E6222030CFD8009CFB39 /* LOTShapeCircle.h in Headers */, - DB79E6662030CFD8009CFB39 /* LOTAnimatedControl.h in Headers */, - DB9EB3261F63FFB40044FCC2 /* KFVector.h in Headers */, - DB9EB3181F63FFB40044FCC2 /* KFVectorFeatureLayer.h in Headers */, - DB79E60B2030CFD8009CFB39 /* LOTRoundedRectAnimator.h in Headers */, - DB9EB3141F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.h in Headers */, - DB79E6312030CFD8009CFB39 /* LOTLayer.h in Headers */, - DB79E6162030CFD8009CFB39 /* LOTRepeaterRenderer.h in Headers */, - DB79E6382030CFD8009CFB39 /* LOTShapeTrimPath.h in Headers */, - DB79E62A2030CFD8009CFB39 /* LOTShapeFill.h in Headers */, - DB9EB3281F63FFB40044FCC2 /* KFVectorAnimationKeyValue.h in Headers */, - DB79E6692030CFD8009CFB39 /* LOTInterpolatorCallback.h in Headers */, + 3AB3D38021BE475F0060E89D /* TiAnimationAnimationView.h in Headers */, AA747D9F0F9514B9006C5449 /* TiAnimation_Prefix.pch in Headers */, - DB79E6012030CFD8009CFB39 /* LOTPathInterpolator.h in Headers */, - DB79E6702030CFD8009CFB39 /* LOTAnimationView_Compat.h in Headers */, - DB79E6142030CFD8009CFB39 /* LOTFillRenderer.h in Headers */, - DB9EB32B1F63FFB40044FCC2 /* KFVectorPathTrim.h in Headers */, - DB79E66A2030CFD8009CFB39 /* LOTAnimatedSwitch.h in Headers */, - DB79E62F2030CFD8009CFB39 /* LOTAssetGroup.h in Headers */, - DB79E63E2030CFD8009CFB39 /* LOTRadialGradientLayer.h in Headers */, - DB79E5FC2030CFD8009CFB39 /* LOTNumberInterpolator.h in Headers */, - DB9EB3121F63FFB40044FCC2 /* NSImage+PlatformCompatibility.h in Headers */, - DB79E6112030CFD8009CFB39 /* LOTPolygonAnimator.h in Headers */, - DB9EB3361F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.h in Headers */, - DB9EB3301F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.h in Headers */, - DB79E6462030CFD8009CFB39 /* UIColor.h in Headers */, - DB79E6172030CFD8009CFB39 /* LOTRenderGroup.h in Headers */, - DB79E61A2030CFD8009CFB39 /* LOTGradientFillRender.h in Headers */, - DB79E6342030CFD8009CFB39 /* LOTLayerGroup.h in Headers */, - DB79E6672030CFD8009CFB39 /* LOTCacheProvider.h in Headers */, - DB79E63D2030CFD8009CFB39 /* LOTHelpers.h in Headers */, - DB9EB32A1F63FFB40044FCC2 /* KFVectorFeature.h in Headers */, 24DD6CF91134B3F500162E58 /* TiAnimationModule.h in Headers */, - DB79E6332030CFD8009CFB39 /* LOTShapeStar.h in Headers */, - DB79E6482030CFD8009CFB39 /* CALayer+Compat.h in Headers */, - DB79E6262030CFD8009CFB39 /* LOTShapeGroup.h in Headers */, - DB79E62B2030CFD8009CFB39 /* LOTShapeTransform.h in Headers */, - DB79E6612030CFD8009CFB39 /* LOTMaskContainer.h in Headers */, - DB79E65E2030CFD8009CFB39 /* LOTBezierData.h in Headers */, - DB79E6212030CFD8009CFB39 /* LOTAsset.h in Headers */, - DB79E6712030CFD8009CFB39 /* LOTValueCallback.h in Headers */, - DB79E5F52030CFD8009CFB39 /* LOTTrimPathNode.h in Headers */, - DB79E6322030CFD8009CFB39 /* LOTMask.h in Headers */, + 3AB3D38221BE475F0060E89D /* TiAnimationAnimationViewProxy.h in Headers */, 24DE9E1111C5FE74003F90F6 /* TiAnimationModuleAssets.h in Headers */, - DB9C578D1E48B77D0010BF6F /* TiAnimationLottieView.h in Headers */, - DB79E6602030CFD8009CFB39 /* LOTCompositionContainer.h in Headers */, - DB79E66B2030CFD8009CFB39 /* LOTAnimationCache.h in Headers */, - DB79E5F92030CFD8009CFB39 /* LOTSizeInterpolator.h in Headers */, - DB79E5FA2030CFD8009CFB39 /* LOTValueInterpolator.h in Headers */, - DB79E5FB2030CFD8009CFB39 /* LOTPointInterpolator.h in Headers */, - DB79E6202030CFD8009CFB39 /* LOTShapeRepeater.h in Headers */, - DB79E60E2030CFD8009CFB39 /* LOTPathAnimator.h in Headers */, - DB79E6492030CFD8009CFB39 /* NSValue+Compat.h in Headers */, - DB79E6412030CFD8009CFB39 /* UIColor+Expanded.h in Headers */, - DB9EB32C1F63FFB40044FCC2 /* KFVectorGradientEffect.h in Headers */, - DB9EB3161F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.h in Headers */, - DB9EB3151F63FFB40044FCC2 /* KFVectorLayer.h in Headers */, - DB79E6432030CFD8009CFB39 /* CGGeometry+LOTAdditions.h in Headers */, - DB9EB3271F63FFB40044FCC2 /* KFVectorAnimationGroup.h in Headers */, - DB79E62D2030CFD8009CFB39 /* LOTModels.h in Headers */, - DB79E6652030CFD8009CFB39 /* LOTValueDelegate.h in Headers */, - DB9EB3131F63FFB40044FCC2 /* NSValue+PlatformCompatibility.h in Headers */, - DB9EB33A1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.h in Headers */, - DB79E60F2030CFD8009CFB39 /* LOTCircleAnimator.h in Headers */, - DB79E66C2030CFD8009CFB39 /* Lottie.h in Headers */, - DB79E6742030D7A8009CFB39 /* TiLottieConstants.h in Headers */, - DB79E6282030CFD8009CFB39 /* LOTShapeStroke.h in Headers */, - DB9EB30E1F63FFB40044FCC2 /* Compatibility.h in Headers */, + DB79E6742030D7A8009CFB39 /* TiAnimationConstants.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1019,7 +179,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1010; }; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "ti.animation" */; compatibilityVersion = "Xcode 3.2"; @@ -1063,96 +223,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3AB3D38121BE475F0060E89D /* TiAnimationAnimationViewProxy.m in Sources */, + 3AB3D38321BE475F0060E89D /* TiAnimationAnimationView.m in Sources */, 24DD6CFA1134B3F500162E58 /* TiAnimationModule.m in Sources */, - DB79E65A2030CFD8009CFB39 /* LOTAnimatedSwitch.m in Sources */, - DB9EB3231F63FFB40044FCC2 /* KFVectorPathTrim.m in Sources */, - DB79E5F72030CFD8009CFB39 /* LOTColorInterpolator.m in Sources */, - DB79E5F62030CFD8009CFB39 /* LOTTrimPathNode.m in Sources */, - DB79E6052030CFD8009CFB39 /* LOTArrayInterpolator.m in Sources */, - DB79E6572030CFD8009CFB39 /* LOTCacheProvider.m in Sources */, - DB9EB3221F63FFB40044FCC2 /* KFVectorGradientEffect.m in Sources */, - DB79E60C2030CFD8009CFB39 /* LOTCircleAnimator.m in Sources */, - DB79E6642030CFD8009CFB39 /* LOTMaskContainer.m in Sources */, - DB79E63A2030CFD8009CFB39 /* LOTShapeTransform.m in Sources */, - DB9EB33B1F63FFB40044FCC2 /* KFVectorParsingHelper.m in Sources */, - DB79E62C2030CFD8009CFB39 /* LOTAsset.m in Sources */, - DB9EB3101F63FFB40044FCC2 /* NSImage+PlatformCompatibility.m in Sources */, - DB79E6062030CFD8009CFB39 /* LOTNumberInterpolator.m in Sources */, - DB79E63F2030CFD8009CFB39 /* CGGeometry+LOTAdditions.m in Sources */, - DB79E6302030CFD8009CFB39 /* LOTShapeRectangle.m in Sources */, - DB79E6522030CFD8009CFB39 /* LOTBlockCallback.m in Sources */, - DB79E64D2030CFD8009CFB39 /* NSValue+Compat.m in Sources */, - DB9EB3291F63FFB40044FCC2 /* KFVectorFeatureKeyFrame.m in Sources */, - DB79E6032030CFD8009CFB39 /* LOTValueInterpolator.m in Sources */, - DB79E6582030CFD8009CFB39 /* LOTAnimatedControl.m in Sources */, - DB79E6182030CFD8009CFB39 /* LOTStrokeRenderer.m in Sources */, - DB79E6502030CFD8009CFB39 /* LOTComposition.m in Sources */, - DB79E6352030CFD8009CFB39 /* LOTShapeCircle.m in Sources */, - DB79E6392030CFD8009CFB39 /* LOTShapeFill.m in Sources */, - DB79E6632030CFD8009CFB39 /* LOTCompositionContainer.m in Sources */, - DB9EB3381F63FFB40044FCC2 /* UIBezierPath+KFVectorLayer.m in Sources */, - DB79E6542030CFD8009CFB39 /* LOTAnimationTransitionController.m in Sources */, - DB79E6122030CFD8009CFB39 /* LOTRenderGroup.m in Sources */, - DB79E6592030CFD8009CFB39 /* LOTInterpolatorCallback.m in Sources */, - DB79E61E2030CFD8009CFB39 /* LOTAssetGroup.m in Sources */, - DB79E6562030CFD8009CFB39 /* LOTKeypath.m in Sources */, - DB79E6192030CFD8009CFB39 /* LOTFillRenderer.m in Sources */, - DB9EB32E1F63FFB40044FCC2 /* KFVector.m in Sources */, - DB79E6512030CFD8009CFB39 /* LOTValueCallback.m in Sources */, - DB79E6452030CFD8009CFB39 /* UIColor+Expanded.m in Sources */, - DB9EB3241F63FFB40044FCC2 /* KFVectorFeature.m in Sources */, - DB79E6242030CFD8009CFB39 /* LOTShapeStar.m in Sources */, - DB79E65F2030CFD8009CFB39 /* LOTLayerContainer.m in Sources */, - DB9EB32D1F63FFB40044FCC2 /* KFVectorAnimationGroup.m in Sources */, - DB9EB3391F63FFB40044FCC2 /* KFUtilities.m in Sources */, - DB79E60A2030CFD8009CFB39 /* LOTPolygonAnimator.m in Sources */, 24DE9E1211C5FE74003F90F6 /* TiAnimationModuleAssets.m in Sources */, - DB79E6022030CFD8009CFB39 /* LOTPointInterpolator.m in Sources */, - DB79E6402030CFD8009CFB39 /* LOTBezierPath.m in Sources */, - DB9EB30F1F63FFB40044FCC2 /* NSValue+PlatformCompatibility.m in Sources */, - DB79E6042030CFD8009CFB39 /* LOTTransformInterpolator.m in Sources */, - DB79E5F82030CFD8009CFB39 /* LOTPathInterpolator.m in Sources */, - DB79E5F22030CFD8009CFB39 /* LOTRenderNode.m in Sources */, - DB9EB3321F63FFB40044FCC2 /* KFVectorView.m in Sources */, - DB9EB31D1F63FFB40044FCC2 /* KFVectorGradientFeatureLayer.m in Sources */, - DB79E61D2030CFD8009CFB39 /* LOTLayer.m in Sources */, - DB79E6232030CFD8009CFB39 /* LOTLayerGroup.m in Sources */, - DB79E6082030CFD8009CFB39 /* LOTPathAnimator.m in Sources */, - DB79E61C2030CFD8009CFB39 /* LOTMask.m in Sources */, - DB9EB31B1F63FFB40044FCC2 /* KFVectorLayer.m in Sources */, - DB79E6472030CFD8009CFB39 /* UIBezierPath.m in Sources */, - DB9EB31F1F63FFB40044FCC2 /* KFVectorLayerHelper.m in Sources */, - DB9EB32F1F63FFB40044FCC2 /* KFVectorAnimation.m in Sources */, - DB79E6532030CFD8009CFB39 /* LOTAnimationView.m in Sources */, - DB9EB33C1F63FFB40044FCC2 /* KFVectorBezierPathsHelper.m in Sources */, - DB79E6072030CFD8009CFB39 /* LOTAnimatorNode.m in Sources */, - DB79E6102030CFD8009CFB39 /* LOTRoundedRectAnimator.m in Sources */, - DB79E6002030CFD8009CFB39 /* LOTSizeInterpolator.m in Sources */, - DB9EB3311F63FFB40044FCC2 /* KFVectorAnimationKeyValue.m in Sources */, - DB9C57ED1E48BA9D0010BF6F /* TiAnimationKeyframeView.m in Sources */, - DB9C578E1E48B77D0010BF6F /* TiAnimationLottieView.m in Sources */, - DB79E64F2030CFD8009CFB39 /* LOTAnimationCache.m in Sources */, - DB79E6132030CFD8009CFB39 /* LOTGradientFillRender.m in Sources */, - DB79E6252030CFD8009CFB39 /* LOTShapeTrimPath.m in Sources */, - DB79E64E2030CFD8009CFB39 /* CALayer+Compat.m in Sources */, - DB79E6372030CFD8009CFB39 /* LOTShapeGroup.m in Sources */, - DB79E63C2030CFD8009CFB39 /* LOTShapeStroke.m in Sources */, - DB79E6092030CFD8009CFB39 /* LOTPolystarAnimator.m in Sources */, - DB79E61B2030CFD8009CFB39 /* LOTRepeaterRenderer.m in Sources */, - DB9EB3111F63FFB40044FCC2 /* NSBezierPath+PlatformCompatibility.m in Sources */, - DB9C57901E48B77D0010BF6F /* TiAnimationLottieViewProxy.m in Sources */, - DB9EB31C1F63FFB40044FCC2 /* KFVectorFeatureLayer.m in Sources */, - DB9C57EF1E48BA9D0010BF6F /* TiAnimationKeyframeViewProxy.m in Sources */, - DB9EB31A1F63FFB40044FCC2 /* KFVectorAnimationLayer.m in Sources */, - DB79E64A2030CFD8009CFB39 /* UIColor.m in Sources */, - DB9EB3371F63FFB40044FCC2 /* CAMediaTimingFunction+KFVectorLayer.m in Sources */, - DB79E6292030CFD8009CFB39 /* LOTShapeGradientFill.m in Sources */, - DB79E6422030CFD8009CFB39 /* LOTRadialGradientLayer.m in Sources */, - DB79E65C2030CFD8009CFB39 /* LOTBezierData.m in Sources */, - DB79E62E2030CFD8009CFB39 /* LOTShapeRepeater.m in Sources */, - DB79E6362030CFD8009CFB39 /* LOTShapePath.m in Sources */, - DB9EB3171F63FFB40044FCC2 /* KFVectorBitmapFeatureLayer.m in Sources */, - DB79E65B2030CFD8009CFB39 /* LOTKeyframe.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1263,11 +337,13 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; @@ -1327,11 +403,13 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; @@ -1374,6 +452,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -1385,9 +464,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; PRODUCT_NAME = "Build & test"; ZERO_LINK = NO; }; diff --git a/ios/ti.animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/ti.animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/ti.animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/timodule.xml b/ios/timodule.xml index 6affb2f..0bb74a4 100644 --- a/ios/timodule.xml +++ b/ios/timodule.xml @@ -1,13 +1,4 @@ - - - - - - - - + + diff --git a/ios/titanium.xcconfig b/ios/titanium.xcconfig index 63d0c0e..8d7c625 100644 --- a/ios/titanium.xcconfig +++ b/ios/titanium.xcconfig @@ -4,7 +4,7 @@ // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR // // -TITANIUM_SDK_VERSION = 7.0.2.GA +TITANIUM_SDK_VERSION = 7.5.0.GA //