AnimatedDrawing.paths constructor
AnimatedDrawing.paths(
- List<
Path> paths, { - List<
Paint> paints = const <Paint>[], - 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,
Creates an instance of AnimatedDrawing by directly passing path elements to the constructor (still experimental).
AnimatedDrawing.paths(
[
///Path objects
],
paints:[
///Paint objects (optional), specifies a [Paint] object for each [Path] element in `paths`.
],
run: this.run,
duration: new Duration(seconds: 3),
onFinish: () => setState(() {
this.run = false;
}),
)
Updating paths allows dynamically building animation scenes based on external states. For this widget the internal data structure is rebuild every time the state changes, therefore the animation performance might suffer if the amount of elements in paths is very high.
Optionally, paints can be provided which specifies a Paint object for each Path element in paths.
Implementation
AnimatedDrawing.paths(
this.paths, {
//AnimatedDrawing.paths
this.paints = const <Paint>[],
//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,
}) : assetPath = '' {
assertAnimationParameters();
assert(paths.isNotEmpty);
if (paints.isNotEmpty) assert(paints.length == paths.length);
}