Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type canvas_item;
- uniform vec4 first_color : hint_color = vec4(1.0);
- uniform vec4 second_color : hint_color = vec4(0.0, 0.0, 0.0, 1.0);
- uniform float position : hint_range(-1, 1) = 0.0;
- uniform float shrink : hint_range(0.5, 8) = 4;
- uniform bool flipped = false;
- uniform float left_limit : hint_range(0.0, 1280.0) = 0.0;
- uniform float right_limit : hint_range(0.0, 1280.0) = 1280.0;
- uniform float ribbon_width : hint_range(0.0, 100.0) = 50.0;
- uniform float ribbon_angle : hint_range(0.0, 1.5) = 0.0;
- uniform vec2 ribbon_position = vec2(640, 360);
- varying vec2 world_pos;
- void vertex() {
- world_pos = VERTEX.xy;
- }
- void fragment() {
- if (world_pos.x < left_limit || world_pos.x > right_limit) {
- COLOR = vec4(0,0,0,0);
- }
- else if (world_pos.y < ribbon_position.y - ribbon_width - tan(ribbon_angle)*(world_pos.x - ribbon_position.x)) {
- COLOR = vec4(0,0,0,0);
- }
- else if (world_pos.y > ribbon_position.y - tan(ribbon_angle)*(world_pos.x - ribbon_position.x)) {
- COLOR = vec4(0,0,0,0);
- }
- else {
- float pivot = position + 0.5;
- vec2 uv = UV - pivot;
- if ((uv.x < 0.0 && !flipped) || (uv.x > 0.0 && flipped)) {
- COLOR = vec4(0,0,0,0);
- } else {
- float shift = abs(uv.x) * shrink;
- COLOR = mix(first_color, second_color, shift);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement