Repository navigation
[GSoC 19] Export Animation for Web using Lottie - #756
Conversation
|
@AnishGG Great! I did a quick overview and it looks good so far! I will test it tomorrow. P.S. Marked this issue as [WIP] and leaving it open for now. So, you can push more commits in the same branch when you get done with animation thing - it will get updated automatically. Keep up the good work! ^__^ |
|
@morevnaproject, Does the ordering of the star layers depend on the value of z_depth? |
|
@AnishGG Yes, the values in Z-Depth column of Layers Panel indicate order of layers. They are given as reference only. You can notice each layer also has Z-Depth parameter, which allows to set a shift of layer's depth, relatively to its place in the stack of layers. Positive values of layer's Z-Depth parameter mean that layer is moved lower in stack. Negative values mean that layer is raised upper. By default this value is = 0 (so, layer has no shift by default). For details see https://wiki.synfig.org/Z_Depth_Parameter. |
|
Regarding the layout: wouldn't it be reasonable to merge both shapes into single layer? I wonder, if that will make any impact on speed. |
I didn't catch up. |
Yes, if we have two star layers (Synfig layers), then in Lottie they can use one layer (Lottie layer here), which includes several shapes. I did some experimenting and found that this is possible, BUT in this case all stars will share the same fill color. Here is an example - https://gist.github.com/morevnaproject/f4686b5b0868447af64f5b620d0ad669 I am not sure if we need this now, but we can consider this for future optimization. |
|
One more note: if you look at screenshot in #756 (comment), then you might notice the stars in Synfig and in browser has slightly different colors. This is because Synfig internally uses gamma value = 2.2. Exporter should handle that and do proper correction for colors. Please check this post on the hints how to deal with gamma - https://forums.synfig.org/t/hack-to-import-gimp-palette/1882/5?u=konstantindmitriev |
Sure, I will do the correction for color calculation as per the gamma value. |
Oh, I was trying to fit more than 1 star in a single layer plus more than 1 fills also. That might be the reason the star was not rendering. |
|
@morevnaproject, the color correction as per the gamma value has been done.🙂 Please have a look at it. |
|
Yes, I've tested it already. Thank you for keeping me updated! ^__^ |
|
@morevnaproject, TCB only animations are now working. Please have a look at this. ^_^ |
|
@morevnaproject, So I modularized the code written till now. I am able to run this code properly using command line interface. But I am facing issues in I think I need to add |
|
@morevnaproject, I tried using |
|
I have observed that instead of installing the Here is the expanded output: |
Fixed ^__^ |
|
Awesome! |
|
Just keeping the discussion alive and posting the progress here. P.S. The FPS of my screen-recorder is bad, hence the bad quality. |
|
Looks impressive! keep up the good work! ^__^ |
|
Things not supported by lottie:
Currently, I am devising an algorithm for the first point. I have ideas to make the third point work in lottie format, but I am keeping it for later. |
If this is not supported by Lottie, then I suggest just drop this. This is a format limitation that is beyond of our scope. BTW, it would be nice to keep track of unsupported features in some document. ^__^ |
Sure, I will update the documentation in a day or two.
Okay, I will leave it for now. |
Oh, yeah! That would be absolutely awesome! |
|
@morevnaproject, Circle layer is now complete. |
|
I have created a repository for Lottie exporter tests - https://github.com/synfig/synfig-tests-regressions/tree/master/export/lottie The idea is to automate verification of how exporting works. I am not aiming at "full-featured" test suite. Just simple check if Lottie exporting fails (python error) will be enough. I plan to add this to Travis CI checks. ^__^ |
This is amazing! |
Can you please submit them to https://github.com/synfig/synfig-tests-regressions via PR? ^__^ |
Yes I will do that shortly. |
Added support for converts: - Add - Linear - Radial Composite - Scale - Subtract - Switch - Weighted Average - Bone Link (WIP) Added support for exported values. Added support for bones (WIP).
|
@AnishGG Merged into master now. Thank you! ^__^ |






Google Summer of Code 2019
Student: Anish Gulati(@AnishGG)
Mentors: Konstantin Dmitriev(@morevnaproject), Artem Konoplin(@ice0)
Project: Export Animation for Web
Feature: #704
Description
Created a plugin which allows export of Synfig format animations(.sif/.sifz) to Lottie JSON format. Lottie is a library that renders animations natively on mobile and on the web.
To access this plugin, there is new menu entry "Plugins" - "Export to Lottie". Choosing this will export the currently opened file to Lottie format. After the export, we will have 3 files:
FILE.htmlwith any browser like Firefox or Google Chrome.FILE.jsonis the main file where the Lottie format animation resides. An alternative to play this file is using an online code editor like codepen.io. Here is an example implementation.FILE.jsoncan be directly played using lottiefiles.com.FILE.logstores all the logs after the export. If a layer is not active/supported, it will be notified in the logs.Currently plugin is capable to export most main graphic elements, with animation applied to their parameters (various types of interpolations supported), some converters can be applied to parameters (see detailed list of supported layers and parameters below). There is a partial support for exporting bones.
Demonstration
Here is a video by @morevnaproject demonstrating the export process:
Example 1

Source file 1: http://www.konstantindmitriev.ru/lottie-demos/104/104.zip
Exported result 1: http://www.konstantindmitriev.ru/lottie-demos/104/104.html
Source file 2: http://www.konstantindmitriev.ru/lottie-demos/103/103.zip
Exported result 2: http://www.konstantindmitriev.ru/lottie-demos/103/103.html
Example 2

Supported Layers
Supported Convert methods
Limitations
TODO
See full list of pending issues here.
Code Contributions
Development Notes