render method

void render(
  1. Canvas canvas
)

Implementation

void render(Canvas canvas) {
  if (_fastAnimation != null) {
    _fastAnimation?.render(canvas);
  } else {
    if (_flipX || _flipY) {
      canvas.save();
      Vector2 center = Vector2(
        position.x + size.x / 2,
        position.y + size.y / 2,
      );
      canvas.translate(center.x, center.y);
      canvas.scale(_flipX ? -1 : 1, _flipY ? -1 : 1);
      canvas.translate(-center.x, -center.y);
    }
    _current?.getSprite().renderWithOpacity(
          canvas,
          position,
          size,
          opacity: opacity,
        );

    if (_flipX || _flipY) {
      canvas.restore();
    }
  }
}