Files
flame/packages/flame_lottie
Lukas Klingsbo d409193300 chore(release): Publish Flame v1.16.0 et. al (#3044)
```
Package Name           Current Version   Updated Version   Update Reason
flame                  1.15.0            1.16.0            manual versioning
flame_audio            2.1.8             2.10.0            manual versioning
flame_bloc             1.10.10           1.11.0            manual versioning
flame_fire_atlas       1.4.8             1.5.0             manual versioning
flame_rive             1.9.11            1.10.0            manual versioning
flame_riverpod         5.2.0             5.3.0             manual versioning
flame_svg              1.9.0             1.10.0            manual versioning
flame_test             1.15.4            1.16.0            manual versioning
flame_texturepacker    3.0.0             3.1.0             manual versioning
flame_tiled            1.18.4            1.19.0            manual versioning
flame_forge2d          0.16.0+5          0.17.0            updated with major changes
flame_isolate          0.5.1             0.6.0             updated with major changes
flame_lottie           0.3.0+8           0.4.0             updated with major changes
flame_markdown         0.1.1+8           0.2.0             updated with major changes
flame_network_assets   0.2.0+13          0.3.0             updated with major changes
flame_noise            0.2.0             0.3.0             updated with major changes
flame_oxygen           0.1.9+8           0.2.0             updated with major changes
flame_spine            0.1.1+10          0.2.0             updated with major changes
flame_splash_screen    0.2.0             0.3.0             updated with major changes
jenny                  1.2.1             1.3.0             updated with minor changes
```
2024-02-17 11:23:14 +01:00
..
2022-11-22 21:42:15 +00:00
2022-11-22 21:42:15 +00:00

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
        ),
    );
  }
  ...
}