Lottie ThorVG for Flutter
This Lottie for Flutter uses ThorVG as a renderer, provides a high performance and compact size.
We've compared lottie-thorvg
with lottie-flutter, we found approximately +12%
improvement in frame rates of single animation. (300x300 in 'Pixel 3a' emulator)
lottie-thorvg
aims to maintain the same interface as lottie-flutter
. If you are currently using them, you can utilize the code by simply replacing the import statement with import 'package:lottie_thorvg/lottie.dart'
.
import 'package:lottie_thorvg/lottie.dart';
// ...
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
// Load a Lottie animation from the assets
Lottie.asset('assets/lottie/dancing_star.json'),
// Load a Lottie animation from a url
Lottie.network(
'https://lottie.host/6d7dd6e2-ab92-4e98-826a-2f8430768886/NGnHQ6brWA.json'
),
],
),
),
);
}
}
License
MIT
Run this command:
With Flutter:
$ flutter pub add lottie_thorvg
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
lottie_thorvg: ^0.0.1
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:lottie_thorvg/lottie.dart';
import 'package:lottie_thorvg/thorvg.dart';
import 'package:lottie_thorvg/thorvg_flutter_bindings_generated.dart';
import 'package:lottie_thorvg/utils.dart';
Download details:
Author: tinyjin
Source: https://github.com/tinyjin/lottie-thorvg