mirror of
https://github.com/svga/SVGAPlayer-iOS.git
synced 2025-10-21 07:29:14 +08:00
Add samples.
This commit is contained in:
@@ -348,7 +348,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
90CFF6F7E27D61F7415658A8 /* [CP] Embed Pods Frameworks */ = {
|
||||
@@ -408,7 +408,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
@@ -1,25 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="4uQ-1Q-oSI">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<!--Samples-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Samples" id="fYC-8C-nQt">
|
||||
<barButtonItem key="rightBarButtonItem" title="Change" id="utM-aZ-rcO">
|
||||
<connections>
|
||||
<action selector="onChange:" destination="BYZ-38-t0r" id="Js8-MV-ZbS"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="r3U-AC-YtV">
|
||||
<objects>
|
||||
<navigationController id="4uQ-1Q-oSI" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="h5y-PJ-oVu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="JkD-iP-i9Z"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="VA1-XL-Er3" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1066" y="36"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
@@ -17,6 +17,8 @@
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
static SVGAParser *parser;
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
@@ -26,22 +28,37 @@
|
||||
self.aPlayer.frame = CGRectMake(0, 0, 320, 320);
|
||||
self.aPlayer.loops = 0;
|
||||
self.aPlayer.clearsAfterStop = YES;
|
||||
SVGAParser *parser = [[SVGAParser alloc] init];
|
||||
[parser parseWithURL:[NSURL URLWithString:@"http://legox.yy.com/svga/svga-yue/feng.svga"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
if (videoItem != nil) {
|
||||
// SVGAExporter *exporter = [SVGAExporter new];
|
||||
// exporter.videoItem = videoItem;
|
||||
// [exporter toImages];
|
||||
// [exporter saveImages:@"/Users/cuiminghui/Desktop/Test" filePrefix:@"rose_"];
|
||||
self.aPlayer.videoItem = videoItem;
|
||||
[self.aPlayer startAnimation];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
parser = [[SVGAParser alloc] init];
|
||||
[self onChange:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews {
|
||||
[super viewWillLayoutSubviews];
|
||||
self.aPlayer.frame = CGRectMake(0, 0, self.view.bounds.size.width, 300);
|
||||
self.aPlayer.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
|
||||
}
|
||||
|
||||
- (IBAction)onChange:(id)sender {
|
||||
NSArray *items = @[
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/EmptyState.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/HamburgerArrow.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/PinJump.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/TwitterHeart.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/Walkthrough.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/angel.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/halloween.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/kingset.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true",
|
||||
@"https://github.com/yyued/SVGA-Samples/blob/master/rose.svga?raw=true",
|
||||
];
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
|
||||
[parser parseWithURL:[NSURL URLWithString:items[arc4random() % 10]]
|
||||
completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
|
||||
if (videoItem != nil) {
|
||||
self.aPlayer.videoItem = videoItem;
|
||||
[self.aPlayer startAnimation];
|
||||
}
|
||||
} failureBlock:nil];
|
||||
}
|
||||
|
||||
- (SVGAPlayer *)aPlayer {
|
||||
|
Reference in New Issue
Block a user