Scale Y
Demonstrates how to adjust the vertical scale of an image using the setScale method and the scaleY property.
1024 × 600
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
this.load.image('atari', 'assets/sprites/atari130xe.png');
}
create ()
{
// setScale sets the x and y scale values (1 = no scale)
this.add.image(100, 300, 'atari').setScale(1, 0.5);
this.add.image(400, 300, 'atari').setScale(1, 2);
const image2 = this.add.image(700, 300, 'atari');
// You can also set the scale via the scaleY property:
image2.scaleY = 4.5;
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
parent: 'game-container',
width: 1024,
height: 600,
pixelArt: true,
scene: Example
};
const game = new Phaser.Game(config);