zoom property

double get zoom

Zoom level of the game.

The default zoom value of 1 means that the world coordinates are in 1:1 correspondence with the pixels on the screen. Zoom levels higher than 1 make the world appear closer: each unit of game coordinate systems maps to zoom pixels on the screen. Conversely, when zoom is less than 1, the game world will appear further away and smaller in size.

See also: visibleGameSize for setting the zoom level dynamically.

Implementation

double get zoom => transform.scale.x;
set zoom (double value)

Implementation

set zoom(double value) {
  assert(value > 0, 'zoom level must be positive: $value');
  transform.scale = Vector2.all(value);
  visibleRect = null;
}