hjx 29e08c4be5 接入语音代码 | 5 years ago | |
---|---|---|
.. | ||
Source | 5 years ago | |
LICENSE | 5 years ago | |
readme.md | 5 years ago |
This version fixed SVGAPlayer render issue on iOS 13.1, upgrade to this version ASAP.
SVGAPlayer is a light-weight animation renderer. You use tools to export svga
file from Adobe Animate CC
or Adobe After Effects
, and then use SVGAPlayer to render animation on mobile application.
SVGAPlayer-iOS
render animation natively via iOS CoreAnimation Framework, brings you a high-performance, low-cost animation experience.
If wonder more information, go to this website.
Here introduce SVGAPlayer-iOS
usage. Wonder exporting usage? Click here.
You want to add pod 'SVGAPlayer', '~> 2.3' similar to the following to your Podfile:
target 'MyApp' do pod 'SVGAPlayer', '~> 2.3' end
Then run a pod install
inside your terminal, or from CocoaPods.app.
SVGAPlayer could load svga file from application bundle or remote server.
SVGAPlayer
instance.SVGAPlayer *player = [[SVGAPlayer alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubview:player]; // Add subview by yourself.
SVGAParser
instance, parse from bundle like this.SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithNamed:@"posche" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
} failureBlock:nil];
SVGAParser
instance, parse from remote server like this.SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
} failureBlock:nil];
SVGAPlayer
, play it as you want.[parser parseWithURL:[NSURL URLWithString:@"https://github.com/yyued/SVGA-Samples/blob/master/posche.svga?raw=true"] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
player.videoItem = videoItem;
[player startAnimation];
}
} failureBlock:nil];
SVGAParser
use NSURLSession
request remote data via network. You may use following ways to control cache.
Server response SVGA files in Body, and response header either. response header has cache-control / etag / expired keys, all these keys telling NSURLSession how to handle cache.
If you couldn't fix Server Response Header, You should build NSURLRequest with CachePolicy by yourself, and fetch NSData.
Deliver NSData to SVGAParser, as usual.
Here are many feature samples.
Head on over to https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs
Head on over to CHANGELOG