anchor property

  1. @override
Anchor get anchor
override

Anchor point for this component. An anchor point describes a point within the rectangle of size size. This point is considered to be the logical "center" of the component. This can be visualized as the point where Flame "grabs" the component. All transforms occur around this point: the position is where the anchor point will end up after the component is translated; the rotation and scaling also happen around this anchor point.

The anchor of a component can be modified during runtime. When this happens, the position of the component will remain unchanged, which means that visually the component will shift on the screen so that its new anchor will be at the same screen coordinates as the old anchor was.

Implementation

@override
Anchor get anchor => _anchor;
  1. @override
set anchor (Anchor anchor)
override

Implementation

@override
set anchor(Anchor anchor) {
  _anchor = anchor;
  _onModifiedSizeOrAnchor();
}