Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
詹瞻在欢聚 edited this page Dec 27, 2019 · 4 revisions

SVGAImageView

The SVGAImageView used to render animation, extends android.view.View

isAnimating: Boolean readonly

Returns current state if is animating.

loops: Int

Defaults to 0.

How many times should animation loops. 0 means Infinity Loop.

clearsAfterStop: Boolean

Defaults to true.

Clears canvas after animation stop.

fillMode: FillMode

Defaults to .Forward. Could be .Forward, .Backward.

.Forward means animation will pause on last frame after finished.

.Backward means animation will pause on first frame after finished.

callback: SVGACallback

SVGAImageView send events to callback object.

startAnimation()

Play animation from zero frame.

startAnimation(range: SVGARange, reverse: Boolean = false)

Play animation in specific range. If reverse sets to true, animation will play from end to start reversely.

pauseAnimation()

Pause animation and stop on current frame.

stopAnimation()

Stop animation, and clear canvas if clearsAfterStop sets to true.

stopAnimation(clear: Boolean)

Stop animation, and clear canvas if clear sets to true.

setVideoItem(videoItem: SVGAVideoEntity)

Assign the animation should be render.

setVideoItem(videoItem: SVGAVideoEntity, dynamicItem: SVGADynamicEntity)

Assign the animation should be render, and sets a dynamicItem options.

stepToFrame(frame: Int, andPlay: Boolean)

Render specific frame, play from this frame if andPlay sets to true.

stepToPercentage(percentage: Double, andPlay: Boolean)

Render specific percentage frame, the percentage value should from 0.0 to 1.0, play from this frame if andPlay sets to true.

SVGAParser

sharePerser: SVGAParser

ShareParser should be init(context) in Application or other Activity.

fileDownloader: FileDownloader

Assign a fileDownloader to load resource from assets and network. You may extends it, and implement your downloader.

parse(assetsName: String, callback: ParseCompletion)

Parse a svga file from Android assets directory.

parse(url: URL, callback: ParseCompletion)

Parse a remote file from network.

parse(inputStream: InputStream, cacheKey: String, callback: ParseCompletion, closeInputStream: Boolean = false)

Parse a svga file from stream, the cacheKey should be unique betweens files. If closeInputStream sets to true, stream will close after parse.

SVGAPlayerCallback

onPause()

Trigger after animation paused.

onFinished()

Trigger after animation finished.

onRepeat()

Trigger while animation repeat.

onStep(frame: Int, percentage: Double)

Trigger after animation play to specific frame.

SVGAVideoEntity

antiAlias: Boolean

Defaults to true, render animation without alias.

videoSize: SVGARect readonly

Returns video width and height.

SVGADynamicEntity

setHidden(value: Boolean, forKey: String)

Dynamic hidden an element.

setDynamicImage(bitmap: Bitmap, forKey: String)

Dynamic replace an element with a Bitmap.

setDynamicImage(url: String, forKey: String)

Dynamic replace an element with a network Bitmap.

setDynamicText(text: String, textPaint: TextPaint, forKey: String)

Add text above an element.

setDynamicText(layoutText: StaticLayout, forKey: String)

Add text via StaticLayout above an element.

setDynamicDrawer(drawer: (canvas: Canvas, frameIndex: Int) -> Boolean, forKey: String)

Draw on element.

clearDynamicObjects()

Reset all dynamic object.

Clone this wiki locally