flame_lottie 0.4.0 copy "flame_lottie: ^0.4.0" to clipboard
flame_lottie: ^0.4.0 copied to clipboard

Flame wrapper for Lottie by AirBnB. This package implements a bridge between Lottie and Flame, allowing to load and display Lottie animations.

flame

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:

... 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
        ),
    );
  }
  ...
}
10
likes
130
pub points
89%
popularity

Publisher

verified publisherflame-engine.org

Flame wrapper for Lottie by AirBnB. This package implements a bridge between Lottie and Flame, allowing to load and display Lottie animations.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

Funding

Consider supporting this project:

opencollective.com
github.com
patreon.com

License

MIT (LICENSE)

Dependencies

flame, flutter, lottie

More

Packages that depend on flame_lottie