Created
July 18, 2017 19:59
-
-
Save TerryCavanagh/0fba766108375c95ac7a9a24614ca8dc to your computer and use it in GitHub Desktop.
Quickly hacked together fade thingy for something
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Quickly hacked together fade thingy for something | |
| import haxegon.*; | |
| import starling.display.*; | |
| import starling.textures.*; | |
| @:access(haxegon.Gfx) | |
| class ColourFade{ | |
| public static var level:Float = 0; | |
| public static var color:Int = 0x0; | |
| private static var attached:Bool = false; | |
| private static var img:Image; | |
| private static var rendertexture:RenderTexture; | |
| private static var tempquad:Quad = new Quad(1, 1); | |
| public static function render(newlevel:Float){ | |
| level = newlevel; | |
| if (!attached){ | |
| rendertexture = new RenderTexture(Gfx.screenwidth, Gfx.screenheight, true); | |
| img = new Image(rendertexture); | |
| img.touchable = false; | |
| Gfx.starstage.addChildAt(img, 1); | |
| attached = true; | |
| } | |
| if (level == 0){ | |
| rendertexture.clear(color); | |
| }else{ | |
| rendertexture.clear(color, level); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment