Lottie4J 1.3.0
1.3.0 Reads the Files You Actually Find
Lottie4J 1.3.0 is a bigger release than the recent fixes. It came out of using Lottie4J with the AnimatorFX Lottie importer, first as a reference renderer in its tests and then as a candidate for its parsing layer. That second use needs a parser that accepts what real-world files contain. (PR #15)
Files that used to be rejected now load
| Input | Before | Now |
|---|---|---|
Property with an expression ("x": "var …") | file rejected | loaded; the expression is kept and written back, never evaluated |
Image asset with an external file ("u": "images/") | file rejected | available as Asset.directory() |
| Unknown layer type, blend mode, matte mode, line cap, … | file rejected | logged and read as absent |
| Shape of an unknown type | file rejected | read as UnknownShape, draws nothing |
Property written as a bare number ("o": 100) | file rejected | fixed value |
Values that were read wrong
- Frame rate, in point and out point are now
Double. A frame rate of 29.97 was read as 29.FrameTiming.getFrameRategives the exact rate and the player uses it for playback. - Solid color layers now use their
swandshsize. A solid used to fill three times the composition, whatever its size. - Keyframes in the pre-5 format no longer drop to 0 at the last keyframe.
- A precomposition that contains itself no longer causes a
StackOverflowError, and parents that run in a circle are handled. - A track matte named with
tpis now the matte, instead of the neighbouring layer. - Hidden layers and shapes (
"hd": true) are no longer drawn. A hidden layer still works as parent and matte.
Know what is not drawn
UnsupportedFeatures.find(animation) lists what a file uses that the player does not draw, with counts and layer names: expressions, time remapping, layer styles, most effects, repeaters, unknown shapes, missing precompositions and more.
For tests and tooling
LottiePlayer.snapshotFrame(double frame)renders a single frame into an image.ImageSimilarity, a windowed, color- and alpha-aware SSIM, moved from the file viewer tests tocom.lottie4j.fxplayer.utiland is now public.LottieFileLoader.load(InputStream)andloadJson(String),Animation.fonts()andLayer.styles()were added.- The file viewer now requires
com.google.common, because Selenium’s HTTP client needs Guava and the viewer failed to start Chrome on the module path without it.
Breaking changes
Asset.shapeTypeis renamed toAsset.directoryand is aString.Animation.framesPerSecond(),inPoint(),outPoint()andAsset.frameRate()returnDoubleinstead ofInteger, andBezierKeyframe.time()returnsDouble.- The
fromValuemethods of the definitions returnnullfor an unknown value instead of throwingLottieModelDefinitionException. - An unknown shape keeps its type and name, but not its other members, when an animation is written again.
See the full changelog for the details, or the GitHub diff between 1.2.8 and 1.3.0.