Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Dynamic Drawer

PonyCui edited this page Dec 20, 2018 · 1 revision

Additionally, you want to draw things on element in animation.

Download Sample File

You can download a sample file from SVGA-Samples to try.

Step

Load animation as usual.

// Setup a SVGAPlayer by yourself.
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];

Setup drawer.

[...aPlayer setDrawingBlock:^(CALayer *contentLayer, NSInteger frameIndex) {
    // do things by yourself
} forKey:@"banner"];

ImageKey

The imageKey is the name of png file, ask your designer tell you the file name.

For example, the layer png image file name is xxx.png, imageKey is xxx. File name should always use English name, do not use Chinese or Japanese etc.

Clone this wiki locally