AnimatedDrawing.svg constructor
AnimatedDrawing.svg(
- String assetPath, {
- AnimationController? controller,
- bool? run,
- Duration? duration,
- Curve? animationCurve,
- VoidCallback? onFinish,
- PaintedPathCallback? onPaint,
- PathOrder? animationOrder,
- double? width,
- double? height,
- AnimationRange? range,
- LineAnimation? lineAnimation = LineAnimation.oneByOne,
- bool scaleToViewport = true,
- DebugOptions? debug,
Parses path data from an SVG asset. In order to use assets in your project specify those in pubspec.yaml
:
assets:
- assets/my_drawing.svg
By default every animation repeats infinitely. For running an animation only once you can use a callback to set run
to false after the first animation cycle completed (see field onFinish
).
AnimatedDrawing.svg(
"assets/test.svg",
run: this.run,
duration: new Duration(seconds: 3),
onFinish: () => setState(() {
this.run = false;
}),
)
Implementation
AnimatedDrawing.svg(
this.assetPath, {
//Standard
this.controller,
//Simplified version
this.run,
this.duration,
this.animationCurve,
this.onFinish,
this.onPaint,
//For both
this.animationOrder,
this.width,
this.height,
this.range,
this.lineAnimation = LineAnimation.oneByOne,
this.scaleToViewport = true,
this.debug,
}) : paths = [],
paints = [] {
assertAnimationParameters();
assert(assetPath.isNotEmpty);
}