Basic Noise
Demonstrates how to create a Noise Game Object and modify its noiseOffset property over time to change the generated pattern.
1280 × 720
class Example extends Phaser.Scene
{
noise;
create()
{
const { width, height } = this.scale;
this.noise = this.add.noise({}, width / 2, height / 2, width, height);
this.time.addEvent(
{
delay: 1000,
loop: true,
callback: () => this.noise.noiseOffset = [
Math.random(),
Math.random()
]
}
);
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.WEBGL,
parent: 'game-container',
width: 1280,
height: 720,
scene: Example
};
const game = new Phaser.Game(config);