playSpriteAnimationOnce method
Future<void>
playSpriteAnimationOnce(
- FutureOr<
SpriteAnimation> animation, { - Vector2? size,
- Vector2? offset,
- VoidCallback? onFinish,
- VoidCallback? onStart,
- bool loop = false,
Method used to play animation once time
Implementation
Future<void> playSpriteAnimationOnce(
FutureOr<SpriteAnimation> animation, {
Vector2? size,
Vector2? offset,
VoidCallback? onFinish,
VoidCallback? onStart,
bool loop = false,
}) async {
final completer = Completer();
_fastAnimation = SpriteAnimationRender(
position: offset,
size: size ?? this.size,
animation: await animation,
loop: loop,
onFinish: () {
_fastAnimation = null;
onFinish?.call();
completer.complete();
},
onStart: onStart,
);
return completer.future;
}