Phaser API Documentation

  Version: 

Member of: Phaser.Structs.Size

setSize([width], [height])

Description:

Sets the width and height of this Size component based on the aspect mode.

If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current aspect ratio is honored across all other modes.

If snapTo values have been set then the given width and height are snapped first, prior to any further adjustment via min/max values, or a parent.

If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into that range prior to adjustment, but may still exceed them depending on the aspect mode.

If this Size component has a parent set, and the aspect mode is fit or envelop, then the given sizes will be clamped to the range specified by the parent.

Parameters:

name type arguments Default description
width number <optional> 0

The new width of the Size component.

height number <optional> width

The new height of the Size component. If not given, it will use the width.

Returns:
Description:

This Size component instance.

Examples:
Since: 3.16.0
Source: src/structs/Size.js (Line 303)