Add examples (#43)

- How to run the animation between 2 specifics frames
- How to export the animation to a file
This commit is contained in:
Xavier H
2020-04-09 23:04:07 +02:00
committed by GitHub
parent 954ec05598
commit 47e47f5cb8
16 changed files with 446 additions and 2 deletions

View File

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(vsync: this);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Lottie.asset(
'assets/LottieLogo1.json',
controller: _controller,
onLoaded: (composition) {
_controller
..duration = composition.duration ~/ 5
..repeat(min: 0.0, max: 0.2, reverse: true);
},
),
),
),
);
}
}