Image Rotation
Rotate an image by incrementing its rotation property inside the update loop.
800 × 600
class Example extends Phaser.Scene
{
image;
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
this.load.image('logo', 'assets/sprites/phaser3-logo.png');
}
create ()
{
this.image = this.add.image(400, 300, 'logo');
}
update ()
{
this.image.rotation += 0.01;
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);