SVGAPlayer-iOS

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。

  • Owner: svga/SVGAPlayer-iOS
  • Platform:
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

SVGAPlayer

简体中文

2.5.0 Released

This version add Support for matte layer and dynamic matte bitmap.
Head on over to Dynamic · Matte Layer

This version add Support for audio step to frame & percentage.

2.3.5 Released

This version fixed SVGAPlayer clearsAfterStop defaults too YES, Please check your player when it doesn't need to be cleared.

This version fixed SVGAPlayer render issue on iOS 13.1, upgrade to this version ASAP.

Introduce

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.

Usage

Here introduce SVGAPlayer-iOS usage. Wonder exporting usage? Click here.

Install Via CocoaPods

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.

Locate files

SVGAPlayer could load svga file from application bundle or remote server.

Using code

Create a SVGAPlayer instance.

SVGAPlayer *player = [[SVGAPlayer alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubview:player]; // Add subview by yourself.

Create a SVGAParser instance, parse from bundle like this.

SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithNamed:@"posche" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
    
} failureBlock:nil];

Create a 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];

Set videoItem to 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];

Cache

SVGAParser use NSURLSession request remote data via network. You may use following ways to control cache.

Response Header

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.

Request NSData By Yourself

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.

Features

Here are many feature samples.

APIs

Head on over to https://github.com/yyued/SVGAPlayer-iOS/wiki/APIs

CHANGELOG

Head on over to CHANGELOG

Main metrics

Overview
Name With Ownersvga/SVGAPlayer-iOS
Primary LanguageObjective-C
Program languageRuby (Language Count: 2)
Platform
License:Apache License 2.0
所有者活动
Created At2017-03-30 06:09:01
Pushed At2023-02-06 06:36:58
Last Commit At2023-02-06 14:36:58
Release Count34
Last Release Name2.5.7 (Posted on 2021-07-06 17:07:34)
First Release Name0.0.1 (Posted on 2016-06-17 18:21:22)
用户参与
Stargazers Count1.1k
Watchers Count17
Fork Count327
Commits Count223
Has Issues Enabled
Issues Count151
Issue Open Count26
Pull Requests Count20
Pull Requests Open Count4
Pull Requests Close Count11
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private