Search the Community
Showing results for tags 'change alpha'.
-
In the code below I create a graphics object with an alpha of 0. I then create a tween object using the graphics object as the target. In the update function I change the alpha value of the graphics object from 0 to 1 using the tween. This does not work. However, when I create the graphics object using an alpha value of 1 and change the value from 1 to 0, using the tween, it does work. Can someone explain this to me? var MyGame={}; MyGame.Test=function(){ this.rectangle; this.tweenRectangle; this.switch=true; }; MyGame.Test.prototype={ create:function(){ this.rectangle=this.add.graphics(); this.rectangle.lineStyle(0); this.rectangle.beginFill(0x992d2d,0); this.rectangle.drawRect(0,0,600,600); this.rectangle.endFill(); this.tweenRectangle=this.add.tween(this.rectangle); }, update:function(){ if(this.switch){ this.tweenRectangle.to({alpha:1},5000,"Linear",true); this.switch=false; } } };
- 6 replies
-
- tween
- change alpha
-
(and 1 more)
Tagged with: