SimpleDirectionAnimation constructor

SimpleDirectionAnimation({
  1. required FutureOr<SpriteAnimation> idleRight,
  2. required FutureOr<SpriteAnimation> runRight,
  3. FutureOr<SpriteAnimation>? idleLeft,
  4. FutureOr<SpriteAnimation>? runLeft,
  5. FutureOr<SpriteAnimation>? idleUp,
  6. FutureOr<SpriteAnimation>? idleDown,
  7. FutureOr<SpriteAnimation>? idleUpLeft,
  8. FutureOr<SpriteAnimation>? idleUpRight,
  9. FutureOr<SpriteAnimation>? idleDownLeft,
  10. FutureOr<SpriteAnimation>? idleDownRight,
  11. FutureOr<SpriteAnimation>? runUp,
  12. FutureOr<SpriteAnimation>? runDown,
  13. FutureOr<SpriteAnimation>? runUpLeft,
  14. FutureOr<SpriteAnimation>? runUpRight,
  15. FutureOr<SpriteAnimation>? runDownLeft,
  16. FutureOr<SpriteAnimation>? runDownRight,
  17. Map<dynamic, FutureOr<SpriteAnimation>>? others,
  18. bool enabledFlipX = true,
  19. bool enabledFlipY = false,
  20. bool eightDirection = false,
  21. 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,
  );
}