Files
lottie-flutter/example/lib/examples/specific_frame.dart
Xavier H 47e47f5cb8 Add examples (#43)
- How to run the animation between 2 specifics frames
- How to export the animation to a file
2020-04-09 23:04:07 +02:00

46 lines
981 B
Dart

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