xvrh / lottie-flutter

Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
https://pub.dev/packages/lottie
MIT License
1.15k stars 197 forks source link

Is this support open .lottie file? #295

Open tbm98 opened 1 year ago

tbm98 commented 1 year ago

Is this support open .lottie file?

canturkay commented 11 months ago

I would also like to hear about this. Dot lottie files are much smaller in size, one of the reasons we're using lottie in the first place.

xvrh commented 11 months ago

@canturkay you can already compress a json file to a zip file and AFAIK it will have the same size saving as dotlottie. Unless I'm misunderstanding something, his is already supported.

abdullah-cse commented 11 months ago

@canturkay you can already compress a json file to a zip file and AFAIK it will have the same size saving as dotlottie. Unless I'm misunderstanding something, his is already supported.

Does support added for .lottie???

canturkay commented 11 months ago

@canturkay you can already compress a json file to a zip file and AFAIK it will have the same size saving as dotlottie. Unless I'm misunderstanding something, his is already supported.

Does support added for .lottie???

As mentioned by @xvrh , you can just zip the .json file and use it as .zip. It should have the same size as .lottie.

So instead of using .lottie file, convert it to .json format, and then zip it.

abdullah-cse commented 11 months ago

@canturkay you can already compress a json file to a zip file and AFAIK it will have the same size saving as dotlottie. Unless I'm misunderstanding something, his is already supported.

Does support added for .lottie???

As mentioned by @xvrh , you can just zip the .json file and use it as .zip. It should have the same size as .lottie.

So instead of using .lottie file, convert it to .json format, and then zip it.

One more question, loading from .json vs .zip, What about performance perspective? Does .zip costier as it needs to Unzip, then animate?

canturkay commented 11 months ago

@canturkay you can already compress a json file to a zip file and AFAIK it will have the same size saving as dotlottie. Unless I'm misunderstanding something, his is already supported.

Does support added for .lottie???

As mentioned by @xvrh , you can just zip the .json file and use it as .zip. It should have the same size as .lottie. So instead of using .lottie file, convert it to .json format, and then zip it.

One more question, loading from .json vs .zip, What about performance perspective? Does .zip costier as it needs to Unzip, then animate?

I don't know technically how it works, but I wold assume it would be more costly. However, I see no issues on my app although I have like 10 decent animations on a single page.

xvrh commented 11 months ago

@canturkay What is your use case for compressing the animation in .zip?

On Android the .apk are themself compressed archive. Link On iOS, an .ipa is a compressed archive Link On the web, you can turn-on gzip on your server for the .json responses.

I'm trying to understand where it makes a difference to have it compressed?

AldoMX commented 11 months ago

There is a document called "numbers every programmer should know", from that document you can learn that unzipping a file is cheaper than downloading the file from the internet (which is why web servers enable gzip compression by default).

In the case of having the file locally, it depends on the file system. NTFS uses 4kb clusters by default, but exFAT uses 128kb clusters, so having a 200 byte vs a 128kb file makes no difference because the operating system reads/writes the whole cluster anyway (this is the reason why copying a lot of small files is slow, but compressing the folder and copying the zip is fast).

Anyway, I'm not here to talk about "numbers that every programmer should know", but to ask whether adding support for dotLottie files is planned, because dotLottie includes features like state machines to switch between animations and its not just "a zipped json":

https://dotlottie.io/structure/

xvrh commented 11 months ago

@AldoMX can you list precisely the features from dotLottie that you would like?

Smaller size was listed above and I answered that this is already supported (although I don't really see the value myself).

Can you provide some representative dotLottie examples? What changes to the API would be necessary to make use of it?

AldoMX commented 11 months ago

There are only 3 features for now:

https://dotlottie.io/features/