[SOLVED] Tween Opacity on Button Element

Hi @DampedFred,

If valueOpacity is a number then the tween won’t work, since numbers can’t be passed by reference. You need to use an object for that.

   var data = {
       value: 0
   };

   this.app.tween(data).to({value: 1.0}, 1, pc.Linear).on(‘update’, function(){
         inPocketAnimation.element.opacity = data.value;
   }).start();
1 Like