From 85a85dfe41b330a1c876a0dfce956fb6e52b2df4 Mon Sep 17 00:00:00 2001 From: Brandon Withrow Date: Wed, 18 Jan 2017 12:27:38 -0800 Subject: [PATCH] Added support for animated transitions Adds support for animated transitions between view controllers --- Lottie/Lottie.xcodeproj/project.pbxproj | 8 ++ .../xcschemes/Lotte.xcscheme | 2 +- Lottie/Lottie/LAAnimatableShapeValue.m | 12 +++ .../Lottie/LAAnimationTransistionController.h | 45 +++++++++ .../Lottie/LAAnimationTransistionController.m | 93 +++++++++++++++++++ Lottie/Lottie/LAAnimationView.h | 1 + Lottie/Lottie/LAAnimationView.m | 4 + Lottie/Lottie/Lottie.h | 1 + .../LottieExamples.xcodeproj/project.pbxproj | 82 +++++++++------- .../xcschemes/LotteExamples.xcscheme | 2 +- ...nimatedTextField.h => AnimatedTextField.h} | 2 +- ...nimatedTextField.m => AnimatedTextField.m} | 6 +- LottieExamples/LottieExamples/AppDelegate.m | 19 +--- .../LottieExamples/Base.lproj/Main.storyboard | 5 +- ...troller.h => JSONExplorerViewController.h} | 2 +- ...troller.m => JSONExplorerViewController.m} | 6 +- .../LALaunchLogoViewController.m | 37 -------- ...ontroller.h => LaunchLogoViewController.h} | 2 +- .../LottieExamples/LaunchLogoViewController.m | 50 ++++++++++ ...roller.h => LottieExampleViewController.h} | 2 +- ...roller.m => LottieExampleViewController.m} | 11 ++- ...ontroller.h => TypingDemoViewController.h} | 2 +- ...ontroller.m => TypingDemoViewController.m} | 12 +-- 23 files changed, 294 insertions(+), 112 deletions(-) create mode 100644 Lottie/Lottie/LAAnimationTransistionController.h create mode 100644 Lottie/Lottie/LAAnimationTransistionController.m rename LottieExamples/LottieExamples/{LAAnimatedTextField.h => AnimatedTextField.h} (91%) rename LottieExamples/LottieExamples/{LAAnimatedTextField.m => AnimatedTextField.m} (98%) rename LottieExamples/LottieExamples/{LAJSONExplorerViewController.h => JSONExplorerViewController.h} (82%) rename LottieExamples/LottieExamples/{LAJSONExplorerViewController.m => JSONExplorerViewController.m} (92%) delete mode 100644 LottieExamples/LottieExamples/LALaunchLogoViewController.m rename LottieExamples/LottieExamples/{LALaunchLogoViewController.h => LaunchLogoViewController.h} (77%) create mode 100644 LottieExamples/LottieExamples/LaunchLogoViewController.m rename LottieExamples/LottieExamples/{BBLottieExampleViewController.h => LottieExampleViewController.h} (75%) rename LottieExamples/LottieExamples/{BBLottieExampleViewController.m => LottieExampleViewController.m} (93%) rename LottieExamples/LottieExamples/{LATypingDemoViewController.h => TypingDemoViewController.h} (77%) rename LottieExamples/LottieExamples/{LATypingDemoViewController.m => TypingDemoViewController.m} (88%) diff --git a/Lottie/Lottie.xcodeproj/project.pbxproj b/Lottie/Lottie.xcodeproj/project.pbxproj index 289ccc1d31..0159e53730 100644 --- a/Lottie/Lottie.xcodeproj/project.pbxproj +++ b/Lottie/Lottie.xcodeproj/project.pbxproj @@ -68,6 +68,8 @@ 48E774AA1D4AABF00029FC2D /* UIColor+Expanded.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774A41D4AABF00029FC2D /* UIColor+Expanded.m */; }; 48E774AB1D4AABF00029FC2D /* CGGeometryAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E774A51D4AABF00029FC2D /* CGGeometryAdditions.h */; }; 48E774AC1D4AABF00029FC2D /* CGGeometryAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774A61D4AABF00029FC2D /* CGGeometryAdditions.m */; }; + 48F7F3041E2FF8A200E34939 /* LAAnimationTransistionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F7F3021E2FF8A200E34939 /* LAAnimationTransistionController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 48F7F3051E2FF8A200E34939 /* LAAnimationTransistionController.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F7F3031E2FF8A200E34939 /* LAAnimationTransistionController.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -136,6 +138,8 @@ 48E774A51D4AABF00029FC2D /* CGGeometryAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGGeometryAdditions.h; sourceTree = ""; }; 48E774A61D4AABF00029FC2D /* CGGeometryAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGGeometryAdditions.m; sourceTree = ""; }; 48E774AF1D4AAD2E0029FC2D /* LAHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LAHelpers.h; sourceTree = ""; }; + 48F7F3021E2FF8A200E34939 /* LAAnimationTransistionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAAnimationTransistionController.h; sourceTree = ""; }; + 48F7F3031E2FF8A200E34939 /* LAAnimationTransistionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAAnimationTransistionController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -173,6 +177,8 @@ 48E774531D4AABC10029FC2D /* Animatable Layers */, 48E774331D4AAB200029FC2D /* LAAnimationView.h */, 48E774341D4AAB200029FC2D /* LAAnimationView.m */, + 48F7F3021E2FF8A200E34939 /* LAAnimationTransistionController.h */, + 48F7F3031E2FF8A200E34939 /* LAAnimationTransistionController.m */, 4871B3601E243D6E00AE29CD /* LAAnimationCache.h */, 4871B3611E243D6E00AE29CD /* LAAnimationCache.m */, 48A7230A1DF8C99D00A55C00 /* LAAnimationView_Internal.h */, @@ -290,6 +296,7 @@ 48E774801D4AABDA0029FC2D /* LAAnimatableNumberValue.h in Headers */, 48E774901D4AABDA0029FC2D /* LAShapeGroup.h in Headers */, 48E7744B1D4AABB70029FC2D /* LAGroupLayerView.h in Headers */, + 48F7F3041E2FF8A200E34939 /* LAAnimationTransistionController.h in Headers */, 48E774921D4AABDA0029FC2D /* LAShapeStroke.h in Headers */, 48E774861D4AABDA0029FC2D /* LAAnimatableScaleValue.h in Headers */, 48E7749E1D4AABDA0029FC2D /* LAShapeRectangle.h in Headers */, @@ -371,6 +378,7 @@ files = ( 48E774501D4AABB70029FC2D /* LARectShapeLayer.m in Sources */, 48E774AC1D4AABF00029FC2D /* CGGeometryAdditions.m in Sources */, + 48F7F3051E2FF8A200E34939 /* LAAnimationTransistionController.m in Sources */, 48E774891D4AABDA0029FC2D /* CAAnimationGroup+LAAnimatableGroup.m in Sources */, 48E7747D1D4AABDA0029FC2D /* LAAnimatableColorValue.m in Sources */, 48E7749D1D4AABDA0029FC2D /* LAShapeCircle.m in Sources */, diff --git a/Lottie/Lottie.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/Lotte.xcscheme b/Lottie/Lottie.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/Lotte.xcscheme index 037ed1f1f8..641ab4195f 100644 --- a/Lottie/Lottie.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/Lotte.xcscheme +++ b/Lottie/Lottie.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/Lotte.xcscheme @@ -1,6 +1,6 @@ +#import + +/** LAAnimationTransistionController + * + * This class creates a custom UIViewController transisiton animation + * using a Lottie animation to transition between two view controllers + * The transition can use custom defined layers in After Effects for to/from + * + * When referencing After Effects layers the animator masks the to/from viewController + * with the referenced layer. + * + */ + +@interface LAAnimationTransistionController : NSObject + +/** Initializer + + @param NSString *animation + The name of the Lottie Animation to load for the transition + + @param NSString *fromLayer + The name of the custom layer to mask the fromVC screenshot with. + If no layer is specified then the screenshot is added behind the Lottie Animation + + @param NSString *toLayer + The name of the custom layer to mask the toVC screenshot with. + If no layer is specified then the screenshot is added behind the Lottie Animation + and a fade transition is performed along with the Lottie animation. + + */ + +- (instancetype)initWithAnimationNamed:(NSString *)animation + fromLayerNamed:(NSString *)fromLayer + toLayerNamed:(NSString *)toLayer; + +@end diff --git a/Lottie/Lottie/LAAnimationTransistionController.m b/Lottie/Lottie/LAAnimationTransistionController.m new file mode 100644 index 0000000000..ed5ce7f135 --- /dev/null +++ b/Lottie/Lottie/LAAnimationTransistionController.m @@ -0,0 +1,93 @@ +// +// LAAnimationTransistionController.m +// Lottie +// +// Created by Brandon Withrow on 1/18/17. +// Copyright © 2017 Brandon Withrow. All rights reserved. +// + +#import "LAAnimationTransistionController.h" +#import "LAAnimationView.h" + +@implementation LAAnimationTransistionController { + LAAnimationView *tranistionAnimationView_; + NSString *fromLayerName_; + NSString *toLayerName_; +} + +- (instancetype)initWithAnimationNamed:(NSString *)animation + fromLayerNamed:(NSString *)fromLayer + toLayerNamed:(NSString *)toLayer { + self = [super init]; + if (self) { + tranistionAnimationView_ = [LAAnimationView animationNamed:animation]; + fromLayerName_ = fromLayer; + toLayerName_ = toLayer; + } + 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 snapshotViewAfterScreenUpdates:YES]; + toSnapshot.frame = containerView.bounds; + + UIView *fromSnapshot = [fromVC.view snapshotViewAfterScreenUpdates:YES]; + fromSnapshot.frame = containerView.bounds; + + tranistionAnimationView_.frame = containerView.bounds; + tranistionAnimationView_.contentMode = UIViewContentModeScaleAspectFill; + [containerView addSubview:tranistionAnimationView_]; + + BOOL crossFadeViews = NO; + + if (toLayerName_.length) { + [tranistionAnimationView_ addSubview:toSnapshot toLayerNamed:toLayerName_]; + } else { + [containerView addSubview:toSnapshot]; + [containerView sendSubviewToBack:toSnapshot]; + toSnapshot.alpha = 0; + crossFadeViews = YES; + } + + if (fromLayerName_.length) { + [tranistionAnimationView_ addSubview:fromSnapshot toLayerNamed:fromLayerName_]; + } 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/Lottie/Lottie/LAAnimationView.h b/Lottie/Lottie/LAAnimationView.h index ca901e8a3f..9cb96f35e9 100644 --- a/Lottie/Lottie/LAAnimationView.h +++ b/Lottie/Lottie/LAAnimationView.h @@ -21,6 +21,7 @@ typedef void (^LAAnimationCompletionBlock)(BOOL animationFinished); @property (nonatomic, assign) BOOL loopAnimation; @property (nonatomic, assign) CGFloat animationProgress; @property (nonatomic, assign) CGFloat animationSpeed; +@property (nonatomic, readonly) CGFloat animationDuration; - (void)playWithCompletion:(LAAnimationCompletionBlock)completion; - (void)play; diff --git a/Lottie/Lottie/LAAnimationView.m b/Lottie/Lottie/LAAnimationView.m index 12833a576f..37fb13f8f3 100644 --- a/Lottie/Lottie/LAAnimationView.m +++ b/Lottie/Lottie/LAAnimationView.m @@ -487,6 +487,10 @@ const NSTimeInterval singleFrameTimeValue = 1.0 / 60.0; return _animationState.animationIsPlaying; } +- (CGFloat)animationDuration { + return _animationState.animationDuration; +} + # pragma mark - Overrides - (void)didMoveToWindow { diff --git a/Lottie/Lottie/Lottie.h b/Lottie/Lottie/Lottie.h index 24d80a179e..5c9c048639 100644 --- a/Lottie/Lottie/Lottie.h +++ b/Lottie/Lottie/Lottie.h @@ -16,4 +16,5 @@ FOUNDATION_EXPORT const unsigned char LottieVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import #import +#import diff --git a/LottieExamples/LottieExamples.xcodeproj/project.pbxproj b/LottieExamples/LottieExamples.xcodeproj/project.pbxproj index e1c647067e..04df648428 100644 --- a/LottieExamples/LottieExamples.xcodeproj/project.pbxproj +++ b/LottieExamples/LottieExamples.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 4844D3701E259B4A00D1B02D /* LAAnimatedTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 4844D36F1E259B4A00D1B02D /* LAAnimatedTextField.m */; }; + 4844D3701E259B4A00D1B02D /* AnimatedTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 4844D36F1E259B4A00D1B02D /* AnimatedTextField.m */; }; 486F03991E2EDF08001F5B4F /* Animography-AMELIE.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03921E2EDF08001F5B4F /* Animography-AMELIE.json */; }; 486F039A1E2EDF08001F5B4F /* HamburgerArrow.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03931E2EDF08001F5B4F /* HamburgerArrow.json */; }; 486F039B1E2EDF08001F5B4F /* LottieLogo1.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03941E2EDF08001F5B4F /* LottieLogo1.json */; }; @@ -15,9 +15,9 @@ 486F039D1E2EDF08001F5B4F /* MotionCorpse-Jrcanest.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03961E2EDF08001F5B4F /* MotionCorpse-Jrcanest.json */; }; 486F039E1E2EDF08001F5B4F /* PinJump.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03971E2EDF08001F5B4F /* PinJump.json */; }; 486F039F1E2EDF08001F5B4F /* TwitterHeart.json in Resources */ = {isa = PBXBuildFile; fileRef = 486F03981E2EDF08001F5B4F /* TwitterHeart.json */; }; - 486F03A21E2EE00A001F5B4F /* LALaunchLogoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 486F03A11E2EE00A001F5B4F /* LALaunchLogoViewController.m */; }; - 4871B3661E244BB900AE29CD /* LATypingDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4871B3651E244BB900AE29CD /* LATypingDemoViewController.m */; }; - 4872845A1D4FCF3200007A88 /* LAJSONExplorerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 487284591D4FCF3200007A88 /* LAJSONExplorerViewController.m */; }; + 486F03A21E2EE00A001F5B4F /* LaunchLogoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 486F03A11E2EE00A001F5B4F /* LaunchLogoViewController.m */; }; + 4871B3661E244BB900AE29CD /* TypingDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4871B3651E244BB900AE29CD /* TypingDemoViewController.m */; }; + 4872845A1D4FCF3200007A88 /* JSONExplorerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 487284591D4FCF3200007A88 /* JSONExplorerViewController.m */; }; 48B96B211E29741400A1C49C /* Lottie.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 48B96B1F1E29741400A1C49C /* Lottie.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 48E774CD1D4AC7300029FC2D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774CC1D4AC7300029FC2D /* main.m */; }; 48E774D01D4AC7300029FC2D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E774CF1D4AC7300029FC2D /* AppDelegate.m */; }; @@ -52,7 +52,7 @@ 48F7F2F81E2F005300E34939 /* X.json in Resources */ = {isa = PBXBuildFile; fileRef = 48F7F2DD1E2F005300E34939 /* X.json */; }; 48F7F2F91E2F005300E34939 /* Y.json in Resources */ = {isa = PBXBuildFile; fileRef = 48F7F2DE1E2F005300E34939 /* Y.json */; }; 48F7F2FA1E2F005300E34939 /* Z.json in Resources */ = {isa = PBXBuildFile; fileRef = 48F7F2DF1E2F005300E34939 /* Z.json */; }; - 6295CF381D526D72004FAD21 /* BBLottieExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6295CF371D526D72004FAD21 /* BBLottieExampleViewController.m */; }; + 6295CF381D526D72004FAD21 /* LottieExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6295CF371D526D72004FAD21 /* LottieExampleViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -71,8 +71,8 @@ /* Begin PBXFileReference section */ 48440E7D1E1F0A6800A7882C /* Lottie.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lottie.framework; path = "../../../Library/Developer/Xcode/DerivedData/LottieExamples-gdyakbdnisazzyhjjynybvmvamdk/Build/Products/Debug-iphonesimulator/Lottie.framework"; sourceTree = ""; }; - 4844D36E1E259B4A00D1B02D /* LAAnimatedTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAAnimatedTextField.h; sourceTree = ""; }; - 4844D36F1E259B4A00D1B02D /* LAAnimatedTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAAnimatedTextField.m; sourceTree = ""; }; + 4844D36E1E259B4A00D1B02D /* AnimatedTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimatedTextField.h; sourceTree = ""; }; + 4844D36F1E259B4A00D1B02D /* AnimatedTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimatedTextField.m; sourceTree = ""; }; 486F03921E2EDF08001F5B4F /* Animography-AMELIE.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "Animography-AMELIE.json"; sourceTree = ""; }; 486F03931E2EDF08001F5B4F /* HamburgerArrow.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = HamburgerArrow.json; sourceTree = ""; }; 486F03941E2EDF08001F5B4F /* LottieLogo1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = LottieLogo1.json; sourceTree = ""; }; @@ -80,12 +80,12 @@ 486F03961E2EDF08001F5B4F /* MotionCorpse-Jrcanest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "MotionCorpse-Jrcanest.json"; sourceTree = ""; }; 486F03971E2EDF08001F5B4F /* PinJump.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PinJump.json; sourceTree = ""; }; 486F03981E2EDF08001F5B4F /* TwitterHeart.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TwitterHeart.json; sourceTree = ""; }; - 486F03A01E2EE00A001F5B4F /* LALaunchLogoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LALaunchLogoViewController.h; sourceTree = ""; }; - 486F03A11E2EE00A001F5B4F /* LALaunchLogoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LALaunchLogoViewController.m; sourceTree = ""; }; - 4871B3641E244BB900AE29CD /* LATypingDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LATypingDemoViewController.h; sourceTree = ""; }; - 4871B3651E244BB900AE29CD /* LATypingDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LATypingDemoViewController.m; sourceTree = ""; }; - 487284581D4FCF3200007A88 /* LAJSONExplorerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAJSONExplorerViewController.h; sourceTree = ""; }; - 487284591D4FCF3200007A88 /* LAJSONExplorerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAJSONExplorerViewController.m; sourceTree = ""; }; + 486F03A01E2EE00A001F5B4F /* LaunchLogoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchLogoViewController.h; sourceTree = ""; }; + 486F03A11E2EE00A001F5B4F /* LaunchLogoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LaunchLogoViewController.m; sourceTree = ""; }; + 4871B3641E244BB900AE29CD /* TypingDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypingDemoViewController.h; sourceTree = ""; }; + 4871B3651E244BB900AE29CD /* TypingDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TypingDemoViewController.m; sourceTree = ""; }; + 487284581D4FCF3200007A88 /* JSONExplorerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONExplorerViewController.h; sourceTree = ""; }; + 487284591D4FCF3200007A88 /* JSONExplorerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONExplorerViewController.m; sourceTree = ""; }; 48B96B1F1E29741400A1C49C /* Lottie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Lottie.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 48E774C81D4AC7300029FC2D /* LottieExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LottieExamples.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48E774CC1D4AC7300029FC2D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -123,8 +123,8 @@ 48F7F2DD1E2F005300E34939 /* X.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = X.json; sourceTree = ""; }; 48F7F2DE1E2F005300E34939 /* Y.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Y.json; sourceTree = ""; }; 48F7F2DF1E2F005300E34939 /* Z.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Z.json; sourceTree = ""; }; - 6295CF361D526D72004FAD21 /* BBLottieExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBLottieExampleViewController.h; sourceTree = ""; }; - 6295CF371D526D72004FAD21 /* BBLottieExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBLottieExampleViewController.m; sourceTree = ""; }; + 6295CF361D526D72004FAD21 /* LottieExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LottieExampleViewController.h; sourceTree = ""; }; + 6295CF371D526D72004FAD21 /* LottieExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LottieExampleViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -169,16 +169,12 @@ children = ( 48E774CE1D4AC7300029FC2D /* AppDelegate.h */, 48E774CF1D4AC7300029FC2D /* AppDelegate.m */, - 486F03A01E2EE00A001F5B4F /* LALaunchLogoViewController.h */, - 486F03A11E2EE00A001F5B4F /* LALaunchLogoViewController.m */, - 487284581D4FCF3200007A88 /* LAJSONExplorerViewController.h */, - 487284591D4FCF3200007A88 /* LAJSONExplorerViewController.m */, - 6295CF361D526D72004FAD21 /* BBLottieExampleViewController.h */, - 6295CF371D526D72004FAD21 /* BBLottieExampleViewController.m */, - 4871B3641E244BB900AE29CD /* LATypingDemoViewController.h */, - 4871B3651E244BB900AE29CD /* LATypingDemoViewController.m */, - 4844D36E1E259B4A00D1B02D /* LAAnimatedTextField.h */, - 4844D36F1E259B4A00D1B02D /* LAAnimatedTextField.m */, + 48F7F2FE1E2FEDE000E34939 /* LaunchAnimation */, + 487284581D4FCF3200007A88 /* JSONExplorerViewController.h */, + 487284591D4FCF3200007A88 /* JSONExplorerViewController.m */, + 6295CF361D526D72004FAD21 /* LottieExampleViewController.h */, + 6295CF371D526D72004FAD21 /* LottieExampleViewController.m */, + 48F7F3061E2FFD1000E34939 /* Typing Demo */, 48E774D41D4AC7300029FC2D /* Main.storyboard */, 48E774D71D4AC7300029FC2D /* Assets.xcassets */, 48E774D91D4AC7300029FC2D /* LaunchScreen.storyboard */, @@ -239,6 +235,26 @@ path = "Animography-AnimatedTypeface"; sourceTree = ""; }; + 48F7F2FE1E2FEDE000E34939 /* LaunchAnimation */ = { + isa = PBXGroup; + children = ( + 486F03A01E2EE00A001F5B4F /* LaunchLogoViewController.h */, + 486F03A11E2EE00A001F5B4F /* LaunchLogoViewController.m */, + ); + name = LaunchAnimation; + sourceTree = ""; + }; + 48F7F3061E2FFD1000E34939 /* Typing Demo */ = { + isa = PBXGroup; + children = ( + 4871B3641E244BB900AE29CD /* TypingDemoViewController.h */, + 4871B3651E244BB900AE29CD /* TypingDemoViewController.m */, + 4844D36E1E259B4A00D1B02D /* AnimatedTextField.h */, + 4844D36F1E259B4A00D1B02D /* AnimatedTextField.m */, + ); + name = "Typing Demo"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -266,7 +282,7 @@ 48E774C01D4AC7300029FC2D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = "Brandon Withrow"; TargetAttributes = { 48E774C71D4AC7300029FC2D = { @@ -346,13 +362,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6295CF381D526D72004FAD21 /* BBLottieExampleViewController.m in Sources */, - 486F03A21E2EE00A001F5B4F /* LALaunchLogoViewController.m in Sources */, - 4872845A1D4FCF3200007A88 /* LAJSONExplorerViewController.m in Sources */, + 6295CF381D526D72004FAD21 /* LottieExampleViewController.m in Sources */, + 486F03A21E2EE00A001F5B4F /* LaunchLogoViewController.m in Sources */, + 4872845A1D4FCF3200007A88 /* JSONExplorerViewController.m in Sources */, 48E774D01D4AC7300029FC2D /* AppDelegate.m in Sources */, - 4871B3661E244BB900AE29CD /* LATypingDemoViewController.m in Sources */, + 4871B3661E244BB900AE29CD /* TypingDemoViewController.m in Sources */, 48E774CD1D4AC7300029FC2D /* main.m in Sources */, - 4844D3701E259B4A00D1B02D /* LAAnimatedTextField.m in Sources */, + 4844D3701E259B4A00D1B02D /* AnimatedTextField.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -391,8 +407,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -435,8 +453,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; diff --git a/LottieExamples/LottieExamples.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/LotteExamples.xcscheme b/LottieExamples/LottieExamples.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/LotteExamples.xcscheme index fed64deef2..b4ffa4fa00 100644 --- a/LottieExamples/LottieExamples.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/LotteExamples.xcscheme +++ b/LottieExamples/LottieExamples.xcodeproj/xcuserdata/brandonwithrow.xcuserdatad/xcschemes/LotteExamples.xcscheme @@ -1,6 +1,6 @@ -@interface LAAnimatedTextField : UIView +@interface AnimatedTextField : UIView @property (nonatomic, assign) NSInteger fontSize; @property (nonatomic, copy) NSString *text; diff --git a/LottieExamples/LottieExamples/LAAnimatedTextField.m b/LottieExamples/LottieExamples/AnimatedTextField.m similarity index 98% rename from LottieExamples/LottieExamples/LAAnimatedTextField.m rename to LottieExamples/LottieExamples/AnimatedTextField.m index 98d8e41dc2..4296ca9d37 100644 --- a/LottieExamples/LottieExamples/LAAnimatedTextField.m +++ b/LottieExamples/LottieExamples/AnimatedTextField.m @@ -6,7 +6,7 @@ // Copyright © 2017 Brandon Withrow. All rights reserved. // -#import "LAAnimatedTextField.h" +#import "AnimatedTextField.h" #import @interface LACharacterCell : UICollectionViewCell @@ -65,11 +65,11 @@ @end -@interface LAAnimatedTextField () +@interface AnimatedTextField () @end -@implementation LAAnimatedTextField { +@implementation AnimatedTextField { NSString *_text; UICollectionView *_collectionView; UICollectionViewFlowLayout *_layout; diff --git a/LottieExamples/LottieExamples/AppDelegate.m b/LottieExamples/LottieExamples/AppDelegate.m index e61bdbf739..612fab2350 100644 --- a/LottieExamples/LottieExamples/AppDelegate.m +++ b/LottieExamples/LottieExamples/AppDelegate.m @@ -7,10 +7,8 @@ // #import "AppDelegate.h" -#import -@interface AppDelegate () -@property (nonatomic, strong)LAAnimationView *splashScreen; +@interface AppDelegate () @end @@ -19,21 +17,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - [self.window makeKeyAndVisible]; - - - LAAnimationView *splashScreen = [LAAnimationView animationNamed:@"LottieLogo1_masked"]; - splashScreen.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - splashScreen.frame = self.window.bounds; - splashScreen.contentMode = UIViewContentModeScaleAspectFill; - - [self.window addSubview:splashScreen]; - self.splashScreen = splashScreen; - [self.splashScreen playWithCompletion:^(BOOL animationFinished) { - [self.splashScreen removeFromSuperview]; - self.splashScreen = nil; - }]; - return YES; } diff --git a/LottieExamples/LottieExamples/Base.lproj/Main.storyboard b/LottieExamples/LottieExamples/Base.lproj/Main.storyboard index 8321f4500b..cf20ee1a61 100644 --- a/LottieExamples/LottieExamples/Base.lproj/Main.storyboard +++ b/LottieExamples/LottieExamples/Base.lproj/Main.storyboard @@ -9,10 +9,10 @@ - + - + @@ -25,6 +25,7 @@ + diff --git a/LottieExamples/LottieExamples/LAJSONExplorerViewController.h b/LottieExamples/LottieExamples/JSONExplorerViewController.h similarity index 82% rename from LottieExamples/LottieExamples/LAJSONExplorerViewController.h rename to LottieExamples/LottieExamples/JSONExplorerViewController.h index 0358f64843..6803960609 100644 --- a/LottieExamples/LottieExamples/LAJSONExplorerViewController.h +++ b/LottieExamples/LottieExamples/JSONExplorerViewController.h @@ -8,7 +8,7 @@ #import -@interface LAJSONExplorerViewController : UIViewController +@interface JSONExplorerViewController : UIViewController @property (nonatomic, copy) void (^completionBlock)(NSString *jsonURL); diff --git a/LottieExamples/LottieExamples/LAJSONExplorerViewController.m b/LottieExamples/LottieExamples/JSONExplorerViewController.m similarity index 92% rename from LottieExamples/LottieExamples/LAJSONExplorerViewController.m rename to LottieExamples/LottieExamples/JSONExplorerViewController.m index ffc64935f8..c29f6b0fbb 100644 --- a/LottieExamples/LottieExamples/LAJSONExplorerViewController.m +++ b/LottieExamples/LottieExamples/JSONExplorerViewController.m @@ -6,16 +6,16 @@ // Copyright © 2015 Brandon Withrow. All rights reserved. // -#import "LAJSONExplorerViewController.h" +#import "JSONExplorerViewController.h" -@interface LAJSONExplorerViewController () +@interface JSONExplorerViewController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) NSArray *jsonFiles; @end -@implementation LAJSONExplorerViewController +@implementation JSONExplorerViewController - (void)viewDidLoad { [super viewDidLoad]; diff --git a/LottieExamples/LottieExamples/LALaunchLogoViewController.m b/LottieExamples/LottieExamples/LALaunchLogoViewController.m deleted file mode 100644 index 4a57dd1b15..0000000000 --- a/LottieExamples/LottieExamples/LALaunchLogoViewController.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// LALaunchLogoViewController.m -// LottieExamples -// -// Created by Brandon Withrow on 1/17/17. -// Copyright © 2017 Brandon Withrow. All rights reserved. -// - -#import "LALaunchLogoViewController.h" -#import - -@interface LALaunchLogoViewController () - -@property (nonatomic, strong) LAAnimationView *logoView; - -@end - -@implementation LALaunchLogoViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.logoView = [LAAnimationView animationNamed:@"LottieLogo1_masked"]; - self.logoView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - self.logoView.frame = self.view.bounds; - self.logoView.contentMode = UIViewContentModeScaleAspectFill; - [self.view addSubview:self.logoView]; - // Do any additional setup after loading the view. -} - -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - [self.logoView playWithCompletion:^(BOOL animationFinished) { - - }]; -} - -@end diff --git a/LottieExamples/LottieExamples/LALaunchLogoViewController.h b/LottieExamples/LottieExamples/LaunchLogoViewController.h similarity index 77% rename from LottieExamples/LottieExamples/LALaunchLogoViewController.h rename to LottieExamples/LottieExamples/LaunchLogoViewController.h index 9a4ed3608f..277560319f 100644 --- a/LottieExamples/LottieExamples/LALaunchLogoViewController.h +++ b/LottieExamples/LottieExamples/LaunchLogoViewController.h @@ -8,6 +8,6 @@ #import -@interface LALaunchLogoViewController : UIViewController +@interface LaunchLogoViewController : UIViewController @end diff --git a/LottieExamples/LottieExamples/LaunchLogoViewController.m b/LottieExamples/LottieExamples/LaunchLogoViewController.m new file mode 100644 index 0000000000..d07551a4ae --- /dev/null +++ b/LottieExamples/LottieExamples/LaunchLogoViewController.m @@ -0,0 +1,50 @@ +// +// LALaunchLogoViewController.m +// LottieExamples +// +// Created by Brandon Withrow on 1/17/17. +// Copyright © 2017 Brandon Withrow. All rights reserved. +// + +#import "LottieExampleViewController.h" +#import "LaunchLogoViewController.h" +#import + +@interface LaunchLogoViewController () + +@property (nonatomic, strong) UIViewController *appRootViewController; + +@end + +@implementation LaunchLogoViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor colorWithRed:50.f/255.f + green:207.f/255.f + blue:193.f/255.f + alpha:1.f]; + + UIViewController *rootVC = [[LottieExampleViewController alloc] initWithNibName:nil bundle:nil]; + self.appRootViewController = [[UINavigationController alloc] initWithRootViewController:rootVC]; + self.appRootViewController.transitioningDelegate = self; + +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + if (self.appRootViewController.presentingViewController == nil) { + [self presentViewController:self.appRootViewController animated:YES completion:nil]; + } +} + +- (id)animationControllerForPresentedController:(UIViewController *)presented + presentingController:(UIViewController *)presenting + sourceController:(UIViewController *)source { + LAAnimationTransistionController *animationController = [[LAAnimationTransistionController alloc] initWithAnimationNamed:@"LottieLogo1_masked" + fromLayerNamed:nil + toLayerNamed:@"DotLayerMask"]; + return animationController; +} + +@end diff --git a/LottieExamples/LottieExamples/BBLottieExampleViewController.h b/LottieExamples/LottieExamples/LottieExampleViewController.h similarity index 75% rename from LottieExamples/LottieExamples/BBLottieExampleViewController.h rename to LottieExamples/LottieExamples/LottieExampleViewController.h index 38d2efda71..e64795c108 100644 --- a/LottieExamples/LottieExamples/BBLottieExampleViewController.h +++ b/LottieExamples/LottieExamples/LottieExampleViewController.h @@ -8,7 +8,7 @@ #import -@interface BBLottieExampleViewController : UIViewController +@interface LottieExampleViewController : UIViewController @end diff --git a/LottieExamples/LottieExamples/BBLottieExampleViewController.m b/LottieExamples/LottieExamples/LottieExampleViewController.m similarity index 93% rename from LottieExamples/LottieExamples/BBLottieExampleViewController.m rename to LottieExamples/LottieExamples/LottieExampleViewController.m index 323f2a4c4c..326e81f179 100644 --- a/LottieExamples/LottieExamples/BBLottieExampleViewController.m +++ b/LottieExamples/LottieExamples/LottieExampleViewController.m @@ -6,16 +6,16 @@ // Copyright © 2016 Brandon Withrow. All rights reserved. // -#import "BBLottieExampleViewController.h" -#import "LAJSONExplorerViewController.h" +#import "LottieExampleViewController.h" +#import "JSONExplorerViewController.h" #import -@interface BBLottieExampleViewController () +@interface LottieExampleViewController () @end -@implementation BBLottieExampleViewController { +@implementation LottieExampleViewController { UIButton *playButton; UIButton *loopButton; UISlider *animationSlider; @@ -25,6 +25,7 @@ - (void)viewDidLoad { [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; openButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [openButton setTitle:@"Open" forState:UIControlStateNormal]; [self.view addSubview:openButton]; @@ -65,7 +66,7 @@ } - (void)_openPressed { - LAJSONExplorerViewController *jsonView = [[LAJSONExplorerViewController alloc] init]; + JSONExplorerViewController *jsonView = [[JSONExplorerViewController alloc] init]; [jsonView setCompletionBlock:^(NSString *path) { [self dismissViewControllerAnimated:YES completion:nil]; [self _openFileAtPath:path]; diff --git a/LottieExamples/LottieExamples/LATypingDemoViewController.h b/LottieExamples/LottieExamples/TypingDemoViewController.h similarity index 77% rename from LottieExamples/LottieExamples/LATypingDemoViewController.h rename to LottieExamples/LottieExamples/TypingDemoViewController.h index 72ab0df74b..fbedf4c9db 100644 --- a/LottieExamples/LottieExamples/LATypingDemoViewController.h +++ b/LottieExamples/LottieExamples/TypingDemoViewController.h @@ -8,6 +8,6 @@ #import -@interface LATypingDemoViewController : UIViewController +@interface TypingDemoViewController : UIViewController @end diff --git a/LottieExamples/LottieExamples/LATypingDemoViewController.m b/LottieExamples/LottieExamples/TypingDemoViewController.m similarity index 88% rename from LottieExamples/LottieExamples/LATypingDemoViewController.m rename to LottieExamples/LottieExamples/TypingDemoViewController.m index 367989d7bc..d60ab7043a 100644 --- a/LottieExamples/LottieExamples/LATypingDemoViewController.m +++ b/LottieExamples/LottieExamples/TypingDemoViewController.m @@ -6,15 +6,15 @@ // Copyright © 2017 Brandon Withrow. All rights reserved. // -#import "LATypingDemoViewController.h" -#import "LAAnimatedTextField.h" +#import "TypingDemoViewController.h" +#import "AnimatedTextField.h" -@interface LATypingDemoViewController () +@interface TypingDemoViewController () @end -@implementation LATypingDemoViewController { - LAAnimatedTextField *textField_; +@implementation TypingDemoViewController { + AnimatedTextField *textField_; UITextField *typingField_; UISlider *fontSlider_; } @@ -22,7 +22,7 @@ - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; - textField_ = [[LAAnimatedTextField alloc] initWithFrame:self.view.bounds]; + textField_ = [[AnimatedTextField alloc] initWithFrame:self.view.bounds]; [self.view addSubview:textField_]; [textField_ setText:@"Start Typing"];