Jump to content

Alpha tweening not working


grumpygamer
 Share

Recommended Posts

Based on this post: http://www.html5gamedevs.com/topic/2016-rectangle-fade/

 

I've implemented a simple rectangle to cover up the menu before it fades in.

Here's the code

var spr_bg = game.add.graphics(0, 0);    spr_bg.beginFill(0x000000);    spr_bg.drawRect(0, 0, window.innerWidth, window.innerHeight);    spr_bg.alpha = 1;    spr_bg.endFill();    s = game.add.tween(spr_bg);    s.to({ alpha: 0 }, 500, null);

The rect is correctly drawn and filled it, but the fade is no no.

If I set the spr_bg.alpha to any value it works, so it seems the tweening is the only problem.

 

Any ideas? Excuse me for my noobiness.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...