Files
imitator-case-y5/main_radial_gradient.gdshader
2025-12-18 22:33:11 +03:00

19 lines
742 B
Plaintext

shader_type canvas_item;
uniform float outerRadius : hint_range(0.0, 50.0) = 1.0;
uniform float MainAlpha : hint_range(0.0, 1.0) = 1.0;
uniform vec4 circle_color : source_color = vec4(1.0, 0.0, 0.0, 1.0);
uniform vec4 circle_color2 : source_color = vec4(0.0, 0.0, 1.0, 1.0);
void fragment() {
float x = abs(UV.x-.35)*2.0;
float y = abs(UV.y-.3)*2.0;
float v = (sqrt((x*x)+(y*y))/outerRadius);
// Плавный переход прозрачности
float alpha = 1.0 - smoothstep(0.0, 1.0, v);
// Создаем градиент от circle_color к circle_color2
vec4 gradient_color = mix(circle_color, circle_color2, v);
COLOR = vec4(gradient_color.rgb, alpha * MainAlpha * gradient_color.a);
}