ControlMask.gdshader 572 B

1234567891011121314151617181920212223
  1. shader_type canvas_item;
  2. uniform float progress : hint_range(0.0, 1.0) = 1.0;
  3. uniform bool inverted = false;
  4. void fragment() {
  5. vec4 custom_color = texture(TEXTURE, UV);
  6. if (custom_color.a != 0.0)
  7. {
  8. // Convert UV coordinates to local coordinates within the TextureRect
  9. vec2 local_uv = vec2(mod(SCREEN_UV, 1.0));
  10. float oriented_UV = inverted ? 1.0 - local_uv.x : local_uv.x;
  11. if (progress == 0.0)
  12. {
  13. COLOR.a = 0.0;
  14. }
  15. else if (oriented_UV >= progress)
  16. {
  17. COLOR.a = custom_color.a * clamp(1.0 - (oriented_UV - progress) / progress, 0.0, 1.0);
  18. }
  19. }
  20. }