Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Utils
/
Size
Phaser 4.1.0
Phaser 4 examples
Size
9
examples
Examples
9
Aspect Mode Fit
Demonstrates using the FIT aspect mode in the Size component to scale a rectangle within a parent's bounds while preserving its aspect ratio.
Aspect Mode None
Demonstrates using Phaser.Structs.Size with the NONE aspect mode, allowing dimensions to be set independently without preserving an aspect ratio.
Aspect Mode: Envelop
Demonstrates the Envelop aspect mode in Phaser.Structs.Size, which scales a size to be as small as possible while still fully covering a parent area and maintaining its aspect ratio.
Aspect Mode: Height Controls Width
Demonstrates the Size component using the HEIGHT_CONTROLS_WIDTH aspect mode, where the width is automatically adjusted to maintain aspect ratio based on changes to the height.
Aspect Mode: Width Controls Height
Demonstrates using the Size structure aspect mode where the height is automatically calculated based on the width to maintain the aspect ratio.
Min Size
Demonstrates how to use setMin on a Size object to enforce a minimum width and height when resizing.
Size Object Maximum Constraints
This example demonstrates how to use the setMax method on a Size object to enforce maximum width and height limits.
Size Object Min and Max Constraints
Demonstrates how to use the Size structure to manage dimensions while enforcing minimum and maximum width and height limits.
Snap Child Size
Demonstrates how to use the snap property on a Size object to force dimensions to align with a specific grid increment during resizing.