mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-24 02:49:33 +00:00
blue fade shader
This commit is contained in:
parent
7d3d83b23c
commit
0d3fa41b29
51
source/funkin/graphics/shaders/BlueFade.hx
Normal file
51
source/funkin/graphics/shaders/BlueFade.hx
Normal file
|
@ -0,0 +1,51 @@
|
|||
package funkin.graphics.shaders;
|
||||
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
||||
class BlueFade extends FlxShader
|
||||
{
|
||||
public var fadeVal(default, set):Float;
|
||||
|
||||
function set_fadeVal(val:Float):Float
|
||||
{
|
||||
fadeAmt.value = [val];
|
||||
fadeVal = val;
|
||||
// trace(fadeVal);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public function fade(startAmt:Float = 0, targetAmt:Float = 1, duration:Float, _options:TweenOptions):Void
|
||||
{
|
||||
fadeVal = startAmt;
|
||||
FlxTween.tween(this, {fadeVal: targetAmt}, duration, _options);
|
||||
}
|
||||
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
// Value from (0, 1)
|
||||
uniform float fadeAmt;
|
||||
|
||||
// fade the image to blue as it fades to black
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tex = flixel_texture2D(bitmap, openfl_TextureCoordv);
|
||||
|
||||
vec4 finalColor = mix(vec4(vec4(0.0, 0.0, tex.b, tex.a) * fadeAmt), vec4(tex * fadeAmt), fadeAmt);
|
||||
|
||||
// Output to screen
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
|
||||
')
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
this.fadeVal = 1;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue