shader_type canvas_item;

uniform vec4 in_color:source_color;
uniform float position:hint_range(-2,1.) = 0.856;
uniform vec2 size = vec2(32., 32.);
uniform vec2 screen_size = vec2(640., 360.);

void fragment(){
	vec2 a = screen_size / size;
	
	vec2 uv=UV*a;
	
	vec2 i_uv = floor(uv);
	vec2 f_uv = fract(uv);
	
	float rate = (i_uv.x+i_uv.y)/(a.x+a.y) - position;
	rate = pow(rate,3);
	float wave = max(0.,rate);
	vec2 center = f_uv*2.-1.;
	float circle = abs(center.x)+abs(center.y);
	circle = 1. - step(wave,circle);
	
	COLOR=vec4(circle) * in_color;
}
