Phaser API Documentation

  Version: 
setZoom([x], [y])

Description:

Set the zoom value of the Camera.

Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. Changing to a larger value, such as 2, will cause the camera to 'zoom in'.

A value of 1 means 'no zoom' and is the default.

Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering.

As of Phaser 3.50 you can now set the horizontal and vertical zoom values independently.

Parameters:

name type arguments Default description
x number <optional> 1

The horizontal zoom value of the Camera. The minimum it can be is 0.001.

y number <optional> x

The vertical zoom value of the Camera. The minimum it can be is 0.001.

Returns:
Description:

This Camera instance.

Since: 3.0.0