Added support for animated transitions

Adds support for animated transitions between view controllers
This commit is contained in:
Brandon Withrow
2017-01-18 12:27:38 -08:00
parent d8ab7508c8
commit 85a85dfe41
23 changed files with 294 additions and 112 deletions

View File

@@ -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 = "<group>"; };
48E774A61D4AABF00029FC2D /* CGGeometryAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGGeometryAdditions.m; sourceTree = "<group>"; };
48E774AF1D4AAD2E0029FC2D /* LAHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LAHelpers.h; sourceTree = "<group>"; };
48F7F3021E2FF8A200E34939 /* LAAnimationTransistionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAAnimationTransistionController.h; sourceTree = "<group>"; };
48F7F3031E2FF8A200E34939 /* LAAnimationTransistionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAAnimationTransistionController.m; sourceTree = "<group>"; };
/* 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 */,

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@@ -32,9 +32,21 @@
[[(NSArray *)value firstObject] isKindOfClass:[NSDictionary class]] &&
[(NSArray *)value firstObject][@"t"]) {
//Keframes
NSDictionary *first = [(NSArray *)value firstObject];
NSDictionary *start = ([first[@"s"] isKindOfClass:[NSDictionary class]] ?
first[@"s"] :
[(NSArray *)first[@"s"] firstObject]);
if ([(start[@"c"]) isKindOfClass:[NSNumber class]]) {
closed = [(start[@"c"]) boolValue];
}
[self _buildAnimationForKeyframes:value closed:closed];
} else if ([value isKindOfClass:[NSDictionary class]]) {
//Single Value, no animation
if ([value[@"c"] isKindOfClass:[NSNumber class]]) {
closed = [value[@"c"] boolValue];
}
_initialShape = [self _bezierShapeFromValue:value closed:closed];
}
}

View File

@@ -0,0 +1,45 @@
//
// LAAnimationTransistionController.h
// Lottie
//
// Created by Brandon Withrow on 1/18/17.
// Copyright © 2017 Brandon Withrow. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
/** 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 <UIViewControllerAnimatedTransitioning>
/** 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

View File

@@ -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<UIViewControllerContextTransitioning>)transitionContext {
return tranistionAnimationView_.animationDuration;
}
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)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

View File

@@ -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;

View File

@@ -487,6 +487,10 @@ const NSTimeInterval singleFrameTimeValue = 1.0 / 60.0;
return _animationState.animationIsPlaying;
}
- (CGFloat)animationDuration {
return _animationState.animationDuration;
}
# pragma mark - Overrides
- (void)didMoveToWindow {

View File

@@ -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 <Lottie/PublicHeader.h>
#import <Lottie/LAAnimationView.h>
#import <Lottie/LAAnimationTransistionController.h>

View File

@@ -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 = "<group>"; };
4844D36E1E259B4A00D1B02D /* LAAnimatedTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAAnimatedTextField.h; sourceTree = "<group>"; };
4844D36F1E259B4A00D1B02D /* LAAnimatedTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAAnimatedTextField.m; sourceTree = "<group>"; };
4844D36E1E259B4A00D1B02D /* AnimatedTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimatedTextField.h; sourceTree = "<group>"; };
4844D36F1E259B4A00D1B02D /* AnimatedTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimatedTextField.m; sourceTree = "<group>"; };
486F03921E2EDF08001F5B4F /* Animography-AMELIE.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "Animography-AMELIE.json"; sourceTree = "<group>"; };
486F03931E2EDF08001F5B4F /* HamburgerArrow.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = HamburgerArrow.json; sourceTree = "<group>"; };
486F03941E2EDF08001F5B4F /* LottieLogo1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = LottieLogo1.json; sourceTree = "<group>"; };
@@ -80,12 +80,12 @@
486F03961E2EDF08001F5B4F /* MotionCorpse-Jrcanest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "MotionCorpse-Jrcanest.json"; sourceTree = "<group>"; };
486F03971E2EDF08001F5B4F /* PinJump.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PinJump.json; sourceTree = "<group>"; };
486F03981E2EDF08001F5B4F /* TwitterHeart.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TwitterHeart.json; sourceTree = "<group>"; };
486F03A01E2EE00A001F5B4F /* LALaunchLogoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LALaunchLogoViewController.h; sourceTree = "<group>"; };
486F03A11E2EE00A001F5B4F /* LALaunchLogoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LALaunchLogoViewController.m; sourceTree = "<group>"; };
4871B3641E244BB900AE29CD /* LATypingDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LATypingDemoViewController.h; sourceTree = "<group>"; };
4871B3651E244BB900AE29CD /* LATypingDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LATypingDemoViewController.m; sourceTree = "<group>"; };
487284581D4FCF3200007A88 /* LAJSONExplorerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LAJSONExplorerViewController.h; sourceTree = "<group>"; };
487284591D4FCF3200007A88 /* LAJSONExplorerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LAJSONExplorerViewController.m; sourceTree = "<group>"; };
486F03A01E2EE00A001F5B4F /* LaunchLogoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchLogoViewController.h; sourceTree = "<group>"; };
486F03A11E2EE00A001F5B4F /* LaunchLogoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LaunchLogoViewController.m; sourceTree = "<group>"; };
4871B3641E244BB900AE29CD /* TypingDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypingDemoViewController.h; sourceTree = "<group>"; };
4871B3651E244BB900AE29CD /* TypingDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TypingDemoViewController.m; sourceTree = "<group>"; };
487284581D4FCF3200007A88 /* JSONExplorerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONExplorerViewController.h; sourceTree = "<group>"; };
487284591D4FCF3200007A88 /* JSONExplorerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONExplorerViewController.m; sourceTree = "<group>"; };
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 = "<group>"; };
@@ -123,8 +123,8 @@
48F7F2DD1E2F005300E34939 /* X.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = X.json; sourceTree = "<group>"; };
48F7F2DE1E2F005300E34939 /* Y.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Y.json; sourceTree = "<group>"; };
48F7F2DF1E2F005300E34939 /* Z.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Z.json; sourceTree = "<group>"; };
6295CF361D526D72004FAD21 /* BBLottieExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBLottieExampleViewController.h; sourceTree = "<group>"; };
6295CF371D526D72004FAD21 /* BBLottieExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBLottieExampleViewController.m; sourceTree = "<group>"; };
6295CF361D526D72004FAD21 /* LottieExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LottieExampleViewController.h; sourceTree = "<group>"; };
6295CF371D526D72004FAD21 /* LottieExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LottieExampleViewController.m; sourceTree = "<group>"; };
/* 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 = "<group>";
};
48F7F2FE1E2FEDE000E34939 /* LaunchAnimation */ = {
isa = PBXGroup;
children = (
486F03A01E2EE00A001F5B4F /* LaunchLogoViewController.h */,
486F03A11E2EE00A001F5B4F /* LaunchLogoViewController.m */,
);
name = LaunchAnimation;
sourceTree = "<group>";
};
48F7F3061E2FFD1000E34939 /* Typing Demo */ = {
isa = PBXGroup;
children = (
4871B3641E244BB900AE29CD /* TypingDemoViewController.h */,
4871B3651E244BB900AE29CD /* TypingDemoViewController.m */,
4844D36E1E259B4A00D1B02D /* AnimatedTextField.h */,
4844D36F1E259B4A00D1B02D /* AnimatedTextField.m */,
);
name = "Typing Demo";
sourceTree = "<group>";
};
/* 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";

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface LAAnimatedTextField : UIView
@interface AnimatedTextField : UIView
@property (nonatomic, assign) NSInteger fontSize;
@property (nonatomic, copy) NSString *text;

View File

@@ -6,7 +6,7 @@
// Copyright © 2017 Brandon Withrow. All rights reserved.
//
#import "LAAnimatedTextField.h"
#import "AnimatedTextField.h"
#import <Lottie/Lottie.h>
@interface LACharacterCell : UICollectionViewCell
@@ -65,11 +65,11 @@
@end
@interface LAAnimatedTextField () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@interface AnimatedTextField () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@end
@implementation LAAnimatedTextField {
@implementation AnimatedTextField {
NSString *_text;
UICollectionView *_collectionView;
UICollectionViewFlowLayout *_layout;

View File

@@ -7,10 +7,8 @@
//
#import "AppDelegate.h"
#import <Lottie/Lottie.h>
@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;
}

View File

@@ -9,10 +9,10 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Lottie Example View Controller-->
<!--Launch Logo View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="BBLottieExampleViewController" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="LaunchLogoViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@@ -25,6 +25,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="177" y="139"/>
</scene>
</scenes>
</document>

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface LAJSONExplorerViewController : UIViewController
@interface JSONExplorerViewController : UIViewController
@property (nonatomic, copy) void (^completionBlock)(NSString *jsonURL);

View File

@@ -6,16 +6,16 @@
// Copyright © 2015 Brandon Withrow. All rights reserved.
//
#import "LAJSONExplorerViewController.h"
#import "JSONExplorerViewController.h"
@interface LAJSONExplorerViewController () <UITableViewDataSource, UITableViewDelegate>
@interface JSONExplorerViewController () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *jsonFiles;
@end
@implementation LAJSONExplorerViewController
@implementation JSONExplorerViewController
- (void)viewDidLoad {
[super viewDidLoad];

View File

@@ -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 <Lottie/Lottie.h>
@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

View File

@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
@interface LALaunchLogoViewController : UIViewController
@interface LaunchLogoViewController : UIViewController
@end

View File

@@ -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 <Lottie/Lottie.h>
@interface LaunchLogoViewController () <UIViewControllerTransitioningDelegate>
@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<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
presentingController:(UIViewController *)presenting
sourceController:(UIViewController *)source {
LAAnimationTransistionController *animationController = [[LAAnimationTransistionController alloc] initWithAnimationNamed:@"LottieLogo1_masked"
fromLayerNamed:nil
toLayerNamed:@"DotLayerMask"];
return animationController;
}
@end

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface BBLottieExampleViewController : UIViewController
@interface LottieExampleViewController : UIViewController
@end

View File

@@ -6,16 +6,16 @@
// Copyright © 2016 Brandon Withrow. All rights reserved.
//
#import "BBLottieExampleViewController.h"
#import "LAJSONExplorerViewController.h"
#import "LottieExampleViewController.h"
#import "JSONExplorerViewController.h"
#import <Lottie/Lottie.h>
@interface BBLottieExampleViewController () <UITextFieldDelegate>
@interface LottieExampleViewController () <UITextFieldDelegate>
@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];

View File

@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
@interface LATypingDemoViewController : UIViewController
@interface TypingDemoViewController : UIViewController
@end

View File

@@ -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 () <UITextFieldDelegate>
@interface TypingDemoViewController () <UITextFieldDelegate>
@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"];