varying vec2 v_texCoord;
varying vec4 v_fragmentColor;

uniform sampler2D u_texture;
uniform float r_start;
uniform float r_end;

uniform vec2 SIZE;

void main(void)
{
	vec2 uv = v_texCoord;
	vec4 color = vec4(0.0);

	color = texture2D( u_texture, v_texCoord);

  //if(color.a > 0.0)
  {
    float dist = distance(uv * SIZE, vec2(0.5,0.5) * SIZE);
    //if(dist >= r_start && dist <= r_end)
    {
      float delta = dist - r_start;
      float ratio = delta/(r_end - r_start);

      if(ratio > 1.0) ratio = 1.0;
      if(ratio < 0) ratio = 0;

      float a = color.a;
      color *= 0.5 + 0.5*ratio;
      color.a = a;
    }
  }

	gl_FragColor = color;
}