Random Gray
Demonstrates how to generate random grayscale colors with a specified minimum brightness threshold.
800 × 600
class Example extends Phaser.Scene
{
constructor ()
{
super();
}
create ()
{
const color = new Phaser.Display.Color();
for (let i = 0; i < 100; i++)
{
color.randomGray(50);
this.add.rectangle(400, i * 6, 800, 6, color.color);
}
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
parent: 'game-container',
width: 800,
height: 600,
scene: Example
};
const game = new Phaser.Game(config);