flame_lottie

Creator: coderz1093

Last updated:

Add to Cart

Description:

flame lottie

Adds support for Lottie animations to your Flame games.











flame_lottie #
This package allows you to load and add Lottie animations to your Flame game.

Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations
exported as json with Bodymovin and renders them natively on mobile!

Source: lottie-android on Github
The native Lottie libraries (such as lottie-android)
are maintained by Airbnb.
The Flutter package lottie, on which this wrapper is based on, is by xaha.dev and can be
found on pub dev.
Usage #
To use it in your game you just need to add flame_lottie to your pubspec.yaml.
Simply load the Lottie animation using the loadLottie method and the
LottieBuilder. It
allows all the various ways of loading a Lottie file:

Lottie.asset, for
obtaining a Lottie file from an AssetBundle using a key.
Lottie.network, for
obtaining a lottie file from a URL.
Lottie.file, for obtaining
a lottie file from a File.
Lottie.memory, for
obtaining a lottie file from a Uint8List.

... and add it as LottieComponent to your flame 🔥 game.
Example:
class MyGame extends FlameGame {
...
@override
Future<void> onLoad() async {
final asset = Lottie.asset('assets/LottieLogo1.json');
final animation = await loadLottie(asset);
add(
LottieComponent(
composition: animation,
repeating: true, // continuously loop the animation
),
);
}
...
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.