playSpriteAnimationOnce method

Future playSpriteAnimationOnce(
  1. FutureOr<SpriteAnimation> animation, {
  2. Vector2? size,
  3. Vector2? offset,
  4. VoidCallback? onFinish,
  5. VoidCallback? onStart,
})

Method used to play animation once time

Implementation

Future playSpriteAnimationOnce(
  FutureOr<SpriteAnimation> animation, {
  Vector2? size,
  Vector2? offset,
  VoidCallback? onFinish,
  VoidCallback? onStart,
}) async {
  _fastAnimation = SpriteAnimationRender(
    position: offset,
    size: size ?? this.size,
    animation: await animation,
    loop: false,
    onFinish: () {
      _fastAnimation = null;
      onFinish?.call();
    },
    onStart: onStart,
  );
}