Rectangle Set Size

Demonstrates how to modify the width and height of a Rectangle geometry object using the setSize method.

Rectangle Set Size, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    create ()
    {
        const rect = new Phaser.Geom.Rectangle();

        const graphics = this.add.graphics({ lineStyle: { color: 0x0000ff } });

        for (let i = 0; i < 34; i++)
        {
            rect.setSize(i * 24, i * 18);

            graphics.strokeRectShape(rect);
        }
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    width: 800,
    height: 600,
    type: Phaser.AUTO,
    parent: 'game-container',
    scene: Example
};

const game = new Phaser.Game(config);

More in Rectangle46 examples