Flash effect with brightness preFX

https://phaser.io/sandbox/b4zjkBbv

const brightness = earth.preFX.addColorMatrix().brightness(2);

brightness.active = false;

this.input.on('pointerdown', () => {
  this.add.tween({
    targets: brightness,
    alpha: { from: 0, to: 1, yoyo: true, duration: 200, ease: 'Expo' },
    onStart: () => {
      brightness.active = true;
    },
    onComplete: () => {
      brightness.active = false;
    }
  });
});
1 Like