project-dung/shaders/circlewipe.gdshader
2022-08-21 11:16:53 -04:00

19 lines
410 B
Plaintext

shader_type canvas_item;
uniform float percent;
float atan2(in float y, in float x) {
bool s = (abs(x) > abs(y));
if (s) {
return 3.14159/2.0 - atan(x,y);
} else {
return atan(y,x);
}
}
void fragment() {
float angle = atan2((UV.y - 0.5) , (UV.x - 0.5));
float alpha = step(percent * 3.14159 * 2.25, angle + 3.14159);
vec4 color = texture(TEXTURE, UV);
COLOR = vec4(color.rgb, color.a * alpha);
}