nativescript-community / ui-lottie

NativeScript plugin to expose Airbnb Lottie
https://github.com/airbnb/lottie-android
Other
177 stars 57 forks source link

Working with Lottie files that has image references #32

Closed muratcorlu closed 2 years ago

muratcorlu commented 5 years ago

I wanted to use these animation on my NativeScript app: https://www.lottiefiles.com/2668-ball But it didn't work. Probably I need to place ball image to a special folder or set it via a method/property. Any suggestion?

bradmartin commented 5 years ago

Did you place the lottie file in your project following the readme?

Make sure to run a full build of the project so the native app is correct when executed.

muratcorlu commented 5 years ago

I have several animations but only that one is not working. Can you confirm, animations with images also should work with this extension?

bradmartin commented 5 years ago

Not sure, can you look at the android/ios lottie SDKs and see if this is something recent they've added? If so, then it'ls possible a simple update of the SDK version would fix it, but I haven't researched recent Lottie releases. I'll try to look at this next week but no time frame right now to research.

muratcorlu commented 5 years ago

Actually I'm not very familiar on Android/iOS SDKs but I saw a definition about using images in lottie files on Lottie Android documentation: http://airbnb.io/lottie/android/images.html But nothing mentions in iOS part.

bradmartin commented 5 years ago
src/assets
If you do need to use images, put the images in a folder inside of src/assets and don't change the filenames of the images. You then need to direct Lottie to the assetslder where the images are stored by calling setImageAssetsFolder on LottieAnimationView or LottieDrawable with the relative folder inside of assets. Again,make sure that the images that bodymovin export are in that folder with their names unchanged (should be img_#). If you use LottieDrawable directly. You should call recycleBitmaps when you are done animating.

That makes it sound like it should work with the Lottie SDK, but I haven't tried. Will try to take a look when some free time comes around 😄

jerbob92 commented 5 years ago

@bradmartin Is it easy to update to Lottie >= 2.6.0? Since 2.6.0 Lottie supports loading a zipfile containing the json and the images.

Edit: just tested this, upgrading to 2.6.0 works fine, upgrading to 2.7.0 doesn't work, some native calls are broken.