Setting apha at the click of a button

this.shuffleButton.onPointerUpObservable.add(() => {
            this.shuffleButton.alpha = 0.7;

HI! Why, when I try to install alpha inside the handler for clicking on it, alpha is set for a second, then it is reset. If the same action is written in the handler of another button so that it makes changes to the transparency of the other button, everything works fine, but if the button needs to be set to transparency itself, does it not work?

A button has default events set - from Use the Babylon GUI - Babylon.js Documentation

Visual animations

By default a button will change its opacity on pointerOver and will change it scale when clicked. You can define your own animations with the following callbacks:


Remove the effects and you should be OK.

1 Like