playSpriteAnimationOnce method
Future
playSpriteAnimationOnce(
- FutureOr<
SpriteAnimation> animation, { - Vector2? size,
- Vector2? offset,
- VoidCallback? onFinish,
- VoidCallback? onStart,
Method used to play animation once time
Implementation
Future playSpriteAnimationOnce(
FutureOr<SpriteAnimation> animation, {
Vector2? size,
Vector2? offset,
VoidCallback? onFinish,
VoidCallback? onStart,
}) async {
_fastAnimOffset = offset ?? Vector2.zero();
_fastAnimation?.onRemove();
_fastAnimation = AnimatedObjectOnce(
position: position + _fastAnimOffset,
size: size ?? this.size,
animation: animation,
onStart: onStart,
onFinish: () {
onFinish?.call();
_fastAnimation?.onRemove();
_fastAnimation = null;
},
)..gameRef = gameRef;
await _fastAnimation?.onLoad();
}