Search code examples
codenameonelottie

Can i use Lottie animation in Codenameone apps


I am wanting to render a short piece of animation on the splash screen of my CN1 app but am struggling.

The Lottiefiles website contains a lot of good animation content, but the closest example i can find to using it is within XCode. I have the downloaded JSON file, of the animation, but am wanting to know if anyone has figured a way of incorporating into a CN1 Java app?

I can see that developers have used in Java, but CN1 wouldn't allow the LottieAnimationView component on it's layout manager i would guess. https://steemit.com/utopian-io/@fahrulhidayat/beautiful-animation-for-android-application-using-lottie-library

Any pointers appreciated. Thanks


Solution

  • The "right way" would probably be to wrap the native implementations for the various OS's in a cn1lib so you can use lottie in a cross platform way. There's a long tutorial about wrapping native code in the developer guide and Steve did a 3 part video series on the subject a few years back: https://www.codenameone.com/blog/integrating-3rd-party-native-sdks-part-3.html

    It's mostly mechanical so it shouldn't be too hard. If you want to take a shortcut you can probably use the web version of the API in a BrowserComponent and call it a day.