playOnce method
Future
playOnce(
- Future<
SpriteAnimation> animation, { - VoidCallback? onFinish,
- bool runToTheEnd = false,
Method used to play animation once time
Implementation
Future playOnce(
Future<SpriteAnimation> animation, {
VoidCallback? onFinish,
bool runToTheEnd = false,
}) async {
if (position != null) {
runToTheEndFastAnimation = runToTheEnd;
final anim = AnimatedObjectOnce(
position: position!,
animation: animation,
onFinish: () {
onFinish?.call();
_fastAnimation = null;
},
);
await anim.onLoad();
_fastAnimation = anim;
}
}