TV Static shader
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
CheckerBoardState
|
||||
InvertState
|
||||
MirroredOrnamentState
|
||||
ShadowState)
|
||||
ShadowState
|
||||
TVStaticState)
|
||||
|
||||
->choice (FlxG.switchState (Type.createInstance choice [])))))
|
22
shader-test/source/TVStaticState.kiss
Normal file
22
shader-test/source/TVStaticState.kiss
Normal file
@@ -0,0 +1,22 @@
|
||||
(import flixel.FlxState)
|
||||
(import flixel.FlxG)
|
||||
(import flixel.FlxSprite)
|
||||
(import flixel.util.FlxColor)
|
||||
(import flixel.math.FlxPoint)
|
||||
(import flixel.FlxCamera)
|
||||
(import openfl.filters.BitmapFilter)
|
||||
(import openfl.filters.ShaderFilter)
|
||||
(import flixel.system.FlxAssets.FlxShader)
|
||||
|
||||
(extends FlxState)
|
||||
|
||||
(prop &mut shader null)
|
||||
|
||||
(method &override :Void create []
|
||||
(super.create)
|
||||
|
||||
(set shader (new kiss_flixel.shaders.TVStatic))
|
||||
(kiss_flixel.CameraTools.addShaderFilter FlxG.camera (array FlxShader shader)))
|
||||
|
||||
(method &override :Void update [:Float elapsed]
|
||||
(super.update elapsed))
|
13
src/kiss_flixel/shaders/TVStatic.frag
Normal file
13
src/kiss_flixel/shaders/TVStatic.frag
Normal file
@@ -0,0 +1,13 @@
|
||||
// Based on https://www.youtube.com/watch?v=x_s0LmQgjfU
|
||||
// by June Rain
|
||||
// Ported to kiss-flixel by NQNStudios
|
||||
|
||||
uniform float amount = 40.0;
|
||||
uniform vec3 color = vec3(1.0);
|
||||
|
||||
void fragment() {
|
||||
float a = fract(sin(dot(UV, vec2(12.9898, 78.233) * TIME)) * 438.5453) * 1.9;
|
||||
vec4 col = vec4(color, 1.0);
|
||||
col.a *= pow(a, amount);
|
||||
COLOR = col;
|
||||
}
|
Reference in New Issue
Block a user