Repository navigation
v0.6.0
This release adds the package lottie, which renders Lottie animations with okage (D41). It is a port of velato, and it draws as ThorVG does where velato differs (D43).
go get github.com/xo/okage@v0.6.0lottie
c, err := lottie.Parse(data)
if err != nil {
return err
}
pm, _ := okage.NewPixmap(uint32(c.Width), uint32(c.Height))
m := pm.AsMut()
err = lottie.RenderFrame(c, c.Frames[0], lottie.IdentityAffine, &m)Parsereads a Lottie file into aComposition.RenderFramedraws a frame onto an okage pixmap.- A
Rendererdraws onto anySink, the interface of velato for a renderer.PixmapSinkis the sink that draws with okage. It draws the effects Fill and Tint. - The test module compares
lottiewith velato through the Rust oracle, and with ThorVG throughxo/lottie, on the 879 Noto animated emoji. With the differences of D42 and D43 off,lottiegives the same calls to its sink as velato on every file. Each of the 4,395 sampled frames is within the tolerance of D43 of ThorVG.
Differences from velato
lottie draws as ThorVG where velato differs (D43): the opacity, the opacity stops, the radius and the highlight of gradients, solid layers, time remap, easing, spatial positions, the closing of animated shapes, the opacity and the blend mode of layers, masks, stroke dashes, and a matte source with the blend mode multiply.
Renderer.MergePaths draws merge paths of modes 2 to 5 by compositing (D42). It is off by default, because ThorVG and velato draw a merge path as a compound path.
Not done
Expressions, the Gaussian blur and the drop shadow in PixmapSink, image assets and text layers. docs/BACKLOG.md lists them.
Other changes
internal/kurbo adds Affine, PathEl, PathSeg, Rect, Ellipse, RoundedRect, SolveCubic and the extrema of a quadratic Bezier.