# Setting apha at the click of a button

**URL:** <https://forum.babylonjs.com/t/setting-apha-at-the-click-of-a-button/6693>\
**Category:** Questions\
**Tags:** documentation\
**Created:** [October 31, 2019, 9:13am UTC](https://forum.babylonjs.com/t/setting-apha-at-the-click-of-a-button/6693 "2019-10-31T09:13:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [October 31, 2019, 9:13am UTC](https://forum.babylonjs.com/t/setting-apha-at-the-click-of-a-button/6693/1 "2019-10-31T09:13:53Z")

</div>

```
this.shuffleButton.onPointerUpObservable.add(() => {
            //this.UI.disableControls([this.UI.getControlByName("shuffleBtn")]);
            this.shuffleButton.alpha = 0.7;
            //this.shuffle();
        });

```

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?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [October 31, 2019, 9:32am UTC](https://forum.babylonjs.com/t/setting-apha-at-the-click-of-a-button/6693/2 "2019-10-31T09:32:38Z")

</div>

A button has default events set - from [https://doc.babylonjs.com/how\_to/gui#button](https://doc.babylonjs.com/how_to/gui#button)

> 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:
> 
> ```
> pointerEnterAnimation
> pointerOutAnimation
> pointerDownAnimation
> pointerUpAnimation
> 
> ```

Remove the effects and you should be OK.

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#XCPP9Y%231527)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [October 31, 2019, 9:53am UTC](https://forum.babylonjs.com/t/setting-apha-at-the-click-of-a-button/6693/3 "2019-10-31T09:53:58Z")

</div>

Thank!🙂
