lottie-js
lottie-js copied to clipboard
merge and sequence multiple Lottie animation into single animation
Overview
Allow to merge or sequence several Lottie animations into single animation (JSON). Allow to dynamically create animation from other animations. ...
Type
- [x] New feature
- [ ] Changes to existing features
Motivation
What inspired this feature request? What problems were you facing, or what else makes you think this should be included? I am trying to create animation dynamically from existing animations and then export it as video on the frontend only. Right now, I have an internal file format that specifies the sequence, and the whole of exporting it to video is not fast as I've to deal with a sequence in the video too. A single Lottie is easy to deal with. ...
Labels
- [x] Add the
Type: Feature Request
label to this issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.
👋@anilsoniaurionpro, I've got the exact same need for my current project. Did you make it somehow and if not, do you have any hints? Thanks for your help!
👋@anilsoniaurionpro, I've got the exact same need for my current project. Did you make it somehow and if not, do you have any hints? Thanks for your help!
I didn't find any lib to do this. I ended up understanding enough lottie json schema to dynamically merge multiple animations (in js). In my case, I exported Lottie json with a specific structure and special settings in bodymovin like preserving ids etc to achieve this in easy manner.
thanks @anilsoniaurionpro. I managed to merge my 2 lottie files (same width / height / frames) by doing the same stuff as you did. It wasn't that hard actually, the only "issue" was to rename the refID in the Precomposition layers using some assets.
thanks @anilsoniaurionpro. I managed to merge my 2 lottie files (same width / height / frames) by doing the same stuff as you did. It wasn't that hard actually, the only "issue" was to rename the refID in the Precomposition layers using some assets.
Before merging I did string replacement . Like jsonStr.replaceAll("comp1", nanoid()). do this for comp0 ... to comp20. Assuming there are max of 21 comps. Same for assets.
I created a method that took a lottie json and returns a new lottie json (which merges all the layers into a precomp first). this process involved string replacement to solve refID , assetId issues and moving all the layers to assets. so the layer contains only a single layer which is the comp. this makes it easy to adjust timings.
After this multiple json are merged in single one. this includes merging all layers , assets , fonts, markers , chars etc.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.