Repository navigation
v0.7.0
This release adds the helpers that a program needs to load and show Lottie files (D44).
go get github.com/xo/okage@v0.7.0New API in lottie
| API | What it does |
|---|---|
Detect(head []byte) bool |
Reports whether the start of a file is a Lottie document. Each of the top-level keys fr, ip, op, w and h must hold a number. The start can be cut short at any byte |
IsDotLottie(head []byte) bool |
Reports whether the data is a zip archive, and so a dotLottie archive |
OpenDotLottie(r io.ReaderAt, size int64) |
Reads a dotLottie archive. Animations holds the sorted paths of its documents, and FS, Data and Parse give its files |
Load(data []byte) |
Parses a Lottie document, or the first document of a dotLottie archive |
Composition.FrameCount, FrameDuration, Duration |
Count the frames and give their times |
Composition.Image(n, w, h int) |
Draws frame n into a new *image.RGBA of w by h pixels. The composition is scaled to fill the image |
The root package adds the sentinel errors ErrLottieEmpty and ErrLottieDotLottie.
The code comes from the Lottie decoder of the image viewer iv, which keeps only the parts that are particular to a viewer. The rendering of a frame is the same as in v0.6.1.