CircleComponent.relative constructor

CircleComponent.relative(
  1. double relation, {
  2. Vector2? position,
  3. required Vector2 parentSize,
  4. double angle = 0,
  5. Anchor? anchor,
})

With this constructor you define the CircleComponent in relation to the parentSize. For example having a relation of 0.5 would create a circle that fills half of the parentSize.

Implementation

CircleComponent.relative(
  double relation, {
  Vector2? position,
  required Vector2 parentSize,
  double angle = 0,
  Anchor? anchor,
}) : this(
        radius: relation * (min(parentSize.x, parentSize.y) / 2),
        position: position,
        angle: angle,
        anchor: anchor,
      );