revo-jailbreak/shaders/beam_of_sin.gdshader
2023-10-05 19:45:05 -04:00

16 lines
No EOL
450 B
Text

shader_type canvas_item;
uniform float speed = 1.0;
uniform float cycle_offset = 0.0;
uniform float wave_length = 1.0;
uniform float thickness = 0.05;
float plot(vec2 st, float pct) {
return step( pct - thickness, st.x) -
step( pct + thickness, st.x);
}
void fragment() {
float x = sin(UV.y * wave_length + TIME * speed + cycle_offset)*0.5+0.5;
COLOR = COLOR * vec4(1.0, 1.0, 1.0, plot(UV * vec2(1.2, 1.0) + vec2(-0.1, 0.0), x));
}