SimpleDirectionAnimation constructor
SimpleDirectionAnimation({
- required FutureOr<
SpriteAnimation> idleRight, - required FutureOr<
SpriteAnimation> runRight, - FutureOr<
SpriteAnimation> ? idleLeft, - FutureOr<
SpriteAnimation> ? runLeft, - FutureOr<
SpriteAnimation> ? idleUp, - FutureOr<
SpriteAnimation> ? idleDown, - FutureOr<
SpriteAnimation> ? idleUpLeft, - FutureOr<
SpriteAnimation> ? idleUpRight, - FutureOr<
SpriteAnimation> ? idleDownLeft, - FutureOr<
SpriteAnimation> ? idleDownRight, - FutureOr<
SpriteAnimation> ? runUp, - FutureOr<
SpriteAnimation> ? runDown, - FutureOr<
SpriteAnimation> ? runUpLeft, - FutureOr<
SpriteAnimation> ? runUpRight, - FutureOr<
SpriteAnimation> ? runDownLeft, - FutureOr<
SpriteAnimation> ? runDownRight, - Map<
dynamic, FutureOr< ? others,SpriteAnimation> > - bool enabledFlipX = true,
- bool enabledFlipY = false,
- bool eightDirection = false,
- Vector2? centerAnchor,
Implementation
SimpleDirectionAnimation({
required FutureOr<SpriteAnimation> idleRight,
required FutureOr<SpriteAnimation> runRight,
FutureOr<SpriteAnimation>? idleLeft,
FutureOr<SpriteAnimation>? runLeft,
FutureOr<SpriteAnimation>? idleUp,
FutureOr<SpriteAnimation>? idleDown,
FutureOr<SpriteAnimation>? idleUpLeft,
FutureOr<SpriteAnimation>? idleUpRight,
FutureOr<SpriteAnimation>? idleDownLeft,
FutureOr<SpriteAnimation>? idleDownRight,
FutureOr<SpriteAnimation>? runUp,
FutureOr<SpriteAnimation>? runDown,
FutureOr<SpriteAnimation>? runUpLeft,
FutureOr<SpriteAnimation>? runUpRight,
FutureOr<SpriteAnimation>? runDownLeft,
FutureOr<SpriteAnimation>? runDownRight,
Map<dynamic, FutureOr<SpriteAnimation>>? others,
this.enabledFlipX = true,
this.enabledFlipY = false,
this.eightDirection = false,
this.centerAnchor,
}) {
_loader?.add(AssetToLoad(idleLeft, (value) => _idleLeftAnim = value));
_loader?.add(AssetToLoad(idleRight, (value) => _idleRightAnim = value));
_loader?.add(AssetToLoad(idleDown, (value) => _idleDownAnim = value));
_loader?.add(AssetToLoad(idleUp, (value) => _idleUpAnim = value));
_loader?.add(AssetToLoad(idleUpLeft, (value) => _idleUpLeftAnim = value));
_loader?.add(AssetToLoad(idleUpRight, (value) => _idleUpRightAnim = value));
_loader?.add(
AssetToLoad(idleDownLeft, (value) => _idleDownLeftAnim = value),
);
_loader?.add(
AssetToLoad(idleDownRight, (value) => _idleDownRightAnim = value),
);
_loader?.add(AssetToLoad(runUp, (value) => _runUpAnim = value));
_loader?.add(AssetToLoad(runRight, (value) => _runRightAnim = value));
_loader?.add(AssetToLoad(runDown, (value) => _runDownAnim = value));
_loader?.add(AssetToLoad(runLeft, (value) => _runLeftAnim = value));
_loader?.add(AssetToLoad(runUpLeft, (value) => _runUpLeftAnim = value));
_loader?.add(AssetToLoad(runUpRight, (value) => _runUpRightAnim = value));
_loader?.add(AssetToLoad(runDownLeft, (value) => _runDownLeftAnim = value));
_loader?.add(
AssetToLoad(runDownRight, (value) => _runDownRightAnim = value),
);
others?.forEach((key, anim) {
_loader?.add(AssetToLoad(anim, (value) {
return this.others[key] = value;
}));
});
_renderWrapper = RenderTransformWrapper(
transforms: [
FlipRenderTransform(
_flipRenderTransform,
),
CenterAdjustRenderTransform(
_adjustRenderTransform,
)
],
render: _myRender,
);
_fastAnimationRenderWrapper = RenderTransformWrapper(
transforms: [
FlipRenderTransform(
_flipFastAnimationRenderTransform,
),
CenterAdjustRenderTransform(
_adjustRenderTransform,
)
],
render: _myFastAnimationRender,
);
}