Provide a set of Java libraries that can
Parse existing Lottie animations to Java objects.
Generate Lottie files from Java objects.
Play Lottie animations in JavaFX.
And achieve this by using a recent Java version with the use of Records to minimize the code and make the project easy to maintain, test, and extend.
I’m working on this, but slowly… Not sure if I should create a full JavaFX player myself or integrate with e.g. the work Alessio Vinerbi is doing with MoonsonFX, his "After Effects"-like application written in JavaFX. Maybe a conversion from Lottie-format to the format he is using would be a good approach… In the meantime, whenever I have time, I dive deeper into the Lottie format to fully understand it.
This announcement seems to be pretty important: Announcing Lottie as a Standard with Lottie Animation Community (LAC) Format Specification Body. Lottie gets a big push to become an even more "efficient, scalable and cross-platform animated vector graphics technology and open file format". To be continued…
Hmm, the Lottie data format is harder to understand than I hoped… I already knew it’s not a logical nested structure, but actually there is a lot of references to data in other structures inside the JSON.
So, to be honest, I’m in the typical worst point that every project faces…
(Graph from bettersheepdog.blogspot.com)
But on the bright side, we have our first correct color and stroke width output! The right pink border is the same as on the left, so I know where to find some info to be used in the drawing…
Based on a LottieFile with an animation, created with Flow, the Bezier object needed to be extended in two different objects: FixedBezier and AnimatedBezier.
Core
Added FixedBezier and AnimatedBezier with BezierDeserializer
Extended unit tests
FXPlayer and FXDemo
Loading of initial test file
Position, colors, strokes… still to be done
Core: can already load many different JSON files
But not all yet…
To be added to the unit tests and the model needs to be further extended
FXPlayer: very basic visualizer
Can read a basic Lottie JSON file and draw the paths
See below with DemoApplication.java showing the original Lottie on the left, and the very first JavaFX generated image on the right.