Skip to content

Commit

Permalink
Merge pull request #55 from mbender74/master
Browse files Browse the repository at this point in the history
MacCatalyst Support and change to XCFramework
  • Loading branch information
hansemannn authored Aug 19, 2021
2 parents f720448 + 2bbfcf0 commit 61cbc03
Show file tree
Hide file tree
Showing 63 changed files with 2,700 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 3.0.0
version: 4.0.0
apiversion: 2
architectures: arm64 x86_64
description: ti.animation
author: Hans Knöchel
license: Apache 2
mac: false
mac: true
copyright: Copyright (c) 2017-present by Hans Knöchel, Michael Gangolf

# these should not be edited
Expand Down
2 changes: 1 addition & 1 deletion ios/module.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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 -framework Lottie
OTHER_LDFLAGS=$(inherited) -framework CoreGraphics -framework QuartzCore
Binary file removed ios/platform/Lottie.framework/Lottie
Binary file not shown.
55 changes: 55 additions & 0 deletions ios/platform/Lottie.xcframework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>Lottie.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>Lottie.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>Lottie.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished);

/// 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 by name from a specific bundle.
- (void)setAnimationNamed:(nonnull NSString *)animationName inBundle:(nullable NSBundle *)bundle NS_SWIFT_NAME(setAnimation(named:bundle:));

/// Load animation from a JSON dictionary
- (void)setAnimationFromJSON:(nonnull NSDictionary *)animationJSON NS_SWIFT_NAME(setAnimation(json:));

/// Load animation from a JSON dictionary from a specific bundle
- (void)setAnimationFromJSON:(nonnull NSDictionary *)animationJSON inBundle:(nullable NSBundle *)bundle NS_SWIFT_NAME(setAnimation(json:bundle:));

/// Flag is YES when the animation is playing
@property (nonatomic, readonly) BOOL isAnimationPlaying;

Expand Down Expand Up @@ -154,7 +160,7 @@ typedef void (^LOTAnimationCompletionBlock)(BOOL animationFinished);
@code
LOTKeypath *keypath = [LOTKeypath keypathWithKeys:@"Layer 1", @"Ellipse 1", @"Stroke 1", @"Color", nil];
LOTColorValueCallback *colorCallback = [LOTColorBlockCallback withColor:[UIColor redColor]];
[animationView setValueCallback:colorCallback forKeypath:keypath];
[animationView setValueDelegate:colorCallback forKeypath:keypath];
@endcode
See the documentation for LOTValueDelegate to see how to create LOTValueCallbacks. A delegate can be any object that conforms to the LOTValueDelegate protocol, or one of the prebuilt delegate classes found in LOTBlockCallback, LOTInterpolatorCallback, and LOTValueCallback.
Expand Down Expand Up @@ -214,7 +220,7 @@ 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:
@discussion NOTE: Deprecated and non functioning. Use setValueDelegate: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 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
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// LOTAnimatedControl.h
// Lottie
//
// Created by brandon_withrow on 8/25/17.
// Copyright © 2017 Airbnb. All rights reserved.
//

#import <UIKit/UIKit.h>

@class LOTAnimationView;
@class LOTComposition;

@interface LOTAnimatedControl : UIControl

// This class is a base class that is intended to be subclassed

/**
* Map a specific animation layer to a control state.
* When the state is set all layers will be hidden except the specified layer.
**/

- (void)setLayerName:(NSString * _Nonnull)layerName forState:(UIControlState)state;

@property (nonatomic, strong, readonly, nonnull) LOTAnimationView *animationView;
@property (nonatomic, strong, nullable) LOTComposition *animationComp;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// LOTAnimatedSwitch.h
// Lottie
//
// Created by brandon_withrow on 8/25/17.
// Copyright © 2017 Airbnb. All rights reserved.
//

#import "LOTAnimatedControl.h"

NS_ASSUME_NONNULL_BEGIN

@interface LOTAnimatedSwitch : LOTAnimatedControl

/// Convenience method to initialize a control from the Main Bundle by name
+ (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName;

/// Convenience method to initialize a control from the specified bundle by name
+ (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName inBundle:(NSBundle * _Nonnull)bundle;


/// The ON/OFF state of the control. Setting will toggle without animation
@property (nonatomic, getter=isOn) BOOL on;

/// Enable interactive sliding gesture for toggle
@property (nonatomic) BOOL interactiveGesture;

/// Set the state of the control with animation
- (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action

/// Styling

/**
* Sets the animation play range for the ON state animation.
* fromProgress is the start of the animation
* toProgress is the end of the animation and also the ON static state
* Defaults 0-1
**/
- (void)setProgressRangeForOnState:(CGFloat)fromProgress
toProgress:(CGFloat)toProgress NS_SWIFT_NAME(setProgressRangeForOnState(fromProgress:toProgress:));

/**
* Sets the animation play range for the OFF state animation.
* fromProgress is the start of the animation
* toProgress is the end of the animation and also the OFF static state
* Defaults 1-0
**/
- (void)setProgressRangeForOffState:(CGFloat)fromProgress
toProgress:(CGFloat)toProgress NS_SWIFT_NAME(setProgressRangeForOffState(fromProgress:toProgress:));

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// LOTAnimationCache.h
// Lottie
//
// Created by Brandon Withrow on 1/9/17.
// Copyright © 2017 Brandon Withrow. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class LOTComposition;

@interface LOTAnimationCache : NSObject

/// Global Cache
+ (instancetype)sharedCache;

/// Adds animation to the cache
- (void)addAnimation:(LOTComposition *)animation forKey:(NSString *)key;

/// Returns animation from cache.
- (LOTComposition * _Nullable)animationForKey:(NSString *)key;

/// Removes a specific animation from the cache
- (void)removeAnimationForKey:(NSString *)key;

/// Clears Everything from the Cache
- (void)clearCache;

/// Disables Caching Animation Model Objects
- (void)disableCaching;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// LOTAnimationTransitionController.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>

/** LOTAnimationTransitionController
*
* 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
*
* When referencing After Effects layers the animator masks or transforms the to/from viewController
* with the referenced layer.
*
*/

@interface LOTAnimationTransitionController : NSObject <UIViewControllerAnimatedTransitioning>

/**
The initializer to create a new transition animation.
@param animation The name of the Lottie Animation to load for the transition
@param 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 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.
@param applyAnimationTransform A boolean that determines if the custom layer should
have the transform animation from the After Effects layer applied to it. If NO the
layer will be masked by the After Effects Layer
*/
- (nonnull instancetype)initWithAnimationNamed:(nonnull NSString *)animation
fromLayerNamed:(nullable NSString *)fromLayer
toLayerNamed:(nullable NSString *)toLayer
applyAnimationTransform:(BOOL)applyAnimationTransform;

/**
The initializer to create a new transition animation.
@param animation The name of the Lottie Animation to load for the transition
@param 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 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.
@param applyAnimationTransform A boolean that determines if the custom layer should
have the transform animation from the After Effects layer applied to it. If NO the
layer will be masked by the After Effects Layer
@param bundle custom bundle to load animation and images, if no bundle is specified will load
from mainBundle
*/
- (instancetype _Nonnull)initWithAnimationNamed:(NSString *_Nonnull)animation
fromLayerNamed:(NSString *_Nullable)fromLayer
toLayerNamed:(NSString *_Nullable)toLayer
applyAnimationTransform:(BOOL)applyAnimationTransform
inBundle:(NSBundle *_Nonnull)bundle;

@end

Loading

0 comments on commit 61cbc03

Please sign in to comment.