Skip to content

Commit

Permalink
Update Pods
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon_withrow committed Aug 2, 2017
1 parent 582a876 commit ac25888
Show file tree
Hide file tree
Showing 25 changed files with 367 additions and 57 deletions.
1 change: 1 addition & 0 deletions Example/Example for lottie-macos/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ @implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application

}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 83 additions & 6 deletions Example/Example for lottie-macos/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
</dependencies>
<scenes>
<!--Application-->
Expand Down Expand Up @@ -653,7 +656,7 @@
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider=""/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
Expand All @@ -667,6 +670,7 @@
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<value key="minSize" type="size" width="480" height="270"/>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
Expand All @@ -679,15 +683,88 @@
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl" customClass="LAMainView">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<box fixedFrame="YES" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="YTj-Uo-B4h">
<rect key="frame" x="-4" y="-4" width="486" height="52"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<view key="contentView" ambiguous="YES" id="EKt-ZS-Egf">
<rect key="frame" x="2" y="2" width="482" height="48"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" fixedFrame="YES" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jP4-qt-gDU">
<rect key="frame" x="0.0" y="14" width="480" height="19"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<slider verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VpF-bM-XJe">
<rect key="frame" x="18" y="0.0" width="166" height="19"/>
<sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="1" tickMarkPosition="above" sliderType="linear" id="6fd-41-KYo"/>
<connections>
<action selector="_sliderChanged:" target="XfG-lQ-9wD" id="uKY-Ax-W2u"/>
</connections>
</slider>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="amC-RQ-U5a" userLabel="Rewind">
<rect key="frame" x="190" y="0.0" width="128" height="19"/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSRewindTemplate" imagePosition="only" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="RS7-hY-xSf">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>
<connections>
<action selector="_rewind:" target="XfG-lQ-9wD" id="fqo-T2-fnV"/>
</connections>
</button>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GYy-OU-55f" userLabel="Play">
<rect key="frame" x="326" y="0.0" width="128" height="19"/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSPlayTemplate" imagePosition="only" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="tVZ-Af-g6D">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>
<connections>
<action selector="_play:" target="XfG-lQ-9wD" id="Boz-70-S1H"/>
</connections>
</button>
<button horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NWr-Br-icp" userLabel="Loop">
<rect key="frame" x="462" y="0.0" width="18" height="19"/>
<buttonCell key="cell" type="roundRect" bezelStyle="roundedRect" image="NSRefreshFreestandingTemplate" imagePosition="only" alignment="center" state="on" imageScaling="proportionallyDown" inset="2" id="XTd-KF-TWL">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>
<connections>
<action selector="_loops:" target="XfG-lQ-9wD" id="jy9-Pz-6F7"/>
</connections>
</button>
</subviews>
<edgeInsets key="edgeInsets" left="20" right="0.0" top="0.0" bottom="0.0"/>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
</view>
</box>
</subviews>
</view>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
<resources>
<image name="NSPlayTemplate" width="128" height="128"/>
<image name="NSRefreshFreestandingTemplate" width="14" height="14"/>
<image name="NSRewindTemplate" width="128" height="128"/>
</resources>
</document>
2 changes: 0 additions & 2 deletions Example/Example for lottie-macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
18 changes: 18 additions & 0 deletions Example/Example for lottie-macos/LAMainView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// LAMainView.h
// lottie-ios
//
// Created by brandon_withrow on 8/1/17.
// Copyright © 2017 Brandon Withrow. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface LAMainView : NSView

- (void)setAnimationProgress:(CGFloat)progress;
- (void)playAnimation;
- (void)rewindAnimation;
- (void)toggleLoop;

@end
127 changes: 127 additions & 0 deletions Example/Example for lottie-macos/LAMainView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
//
// LAMainView.m
// lottie-ios
//
// Created by brandon_withrow on 8/1/17.
// Copyright © 2017 Brandon Withrow. All rights reserved.
//

#import "LAMainView.h"
#import <Lottie/Lottie.h>

@interface LAMainView ()

@property (nonatomic, strong) LOTAnimationView *lottieLogo;

@end
@implementation LAMainView

- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self) {
[self commonInit];
}
return self;
}

- (instancetype)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self commonInit];
}
return self;
}

- (void)commonInit {
NSArray *dragTypes = [NSArray arrayWithObjects:NSFilenamesPboardType, nil];
[self registerForDraggedTypes:dragTypes];

self.lottieLogo = [LOTAnimationView animationNamed:@"LottieLogo1"];
self.lottieLogo.contentMode = LOTViewContentModeScaleAspectFill;
self.lottieLogo.frame = self.bounds;
self.lottieLogo.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
self.lottieLogo.layer.zPosition = -10000;
[self addSubview:self.lottieLogo];
}

- (void)viewDidMoveToSuperview {
[self.lottieLogo play];
}

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;

sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];

if ( [[pboard types] containsObject:NSColorPboardType] ) {
if (sourceDragMask & NSDragOperationGeneric) {
return NSDragOperationGeneric;
}
}
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
if (sourceDragMask & NSDragOperationLink) {
return NSDragOperationLink;
} else if (sourceDragMask & NSDragOperationCopy) {
return NSDragOperationCopy;
}
}
return NSDragOperationNone;
}

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;

sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];

if ( [[pboard types] containsObject:NSColorPboardType] ) {
// Only a copy operation allowed so just copy the data

} else if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];

NSArray *jsonFiles = [files pathsMatchingExtensions:@[@"json"]];
if (jsonFiles.count) {
[self _openAnimationFile:jsonFiles.firstObject];
}
// Depending on the dragging source and modifier keys,
// the file data may be copied or linked
NSLog(@"FILES");
}
return YES;
}

- (void)_openAnimationFile:(NSString *)file {
[self.lottieLogo removeFromSuperview];
self.lottieLogo = nil;

self.lottieLogo = [LOTAnimationView animationWithFilePath:file];
self.lottieLogo.contentMode = LOTViewContentModeScaleAspectFill;
self.lottieLogo.frame = self.bounds;
self.lottieLogo.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;

[self addSubview:self.lottieLogo];
[self.lottieLogo play];
}

- (void)setAnimationProgress:(CGFloat)progress {
self.lottieLogo.animationProgress = progress;
}
- (void)playAnimation {
if (self.lottieLogo.isAnimationPlaying) {
[self.lottieLogo pause];
} else {
[self.lottieLogo play];
}
}
- (void)rewindAnimation {
[self.lottieLogo stop];
}
- (void)toggleLoop {
self.lottieLogo.loopAnimation = !self.lottieLogo.loopAnimation;
}

@end
Loading

0 comments on commit ac25888

Please sign in to comment.