grumpygamer Posted April 9, 2015 Share Posted April 9, 2015 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 codevar 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 More sharing options...
BattyMilk Posted April 9, 2015 Share Posted April 9, 2015 You're almost there You just need .start()s.to({ alpha: 0 }, 500, null).start(); grumpygamer 1 Link to comment Share on other sites More sharing options...
grumpygamer Posted April 9, 2015 Author Share Posted April 9, 2015 That returns an error in the console: "object is not a function". I've logged the s variable and it seems to be there...c.Tween { game: c.Game, target: c.Graphics, manager: C.TweenManager, timeline: Array[0], reverse: false...} Link to comment Share on other sites More sharing options...
grumpygamer Posted April 9, 2015 Author Share Posted April 9, 2015 I've actually made it work by removing that null argument. Link to comment Share on other sites More sharing options...
Recommended Posts