SpriteAnimationComponent constructor
SpriteAnimationComponent({})
Creates a component with an empty animation which can be set later
Implementation
SpriteAnimationComponent({
SpriteAnimation? animation,
bool? autoResize,
this.removeOnFinish = false,
this.playing = true,
Paint? paint,
super.position,
super.size,
super.scale,
super.angle,
super.nativeAngle,
super.anchor,
super.children,
super.priority,
super.key,
}) : assert(
(size == null) == (autoResize ?? size == null),
'''If size is set, autoResize should be false or size should be null when autoResize is true.''',
),
_autoResize = autoResize ?? size == null,
_animationTicker = animation?.createTicker() {
if (paint != null) {
this.paint = paint;
}
/// Register a listener to differentiate between size modification done by
/// external calls v/s the ones done by [_resizeToSprite].
size.addListener(_handleAutoResizeState);
_resizeToSprite();
}