#version 120

//uniform sampler2D sourcetexture1;
//uniform sampler2D sourcetexture2;

//uniform float blend_t;
varying vec2 texturecoordinate;
uniform float fadein;
uniform float time;

void main(void)
{
//	vec4 texel1 = texture2D(sourcetexture1, texturecoordinate);
//	vec4 texel2 = texture2D(sourcetexture2, texturecoordinate);
//	vec4 finalcolor = mix(texel1, texel2, blend_t);
//	vec4 fc = mix(vec4(1.0, 1.0, 1.0, 1.0), finalcolor, 0.15);

	vec2 center = vec2(1.0, 0.0);
	float dx = (texturecoordinate.x - center.x);
	float dy = (texturecoordinate.y - center.y); 
	
	float a = atan(dy / dx);
	
	dx = 0.9 * dx + 0.01 * sin(a*16.0 + time*1.0);
	dy = 0.8 * dy + 0.01 * cos(a*16.0 + time*1.0);
	
	float d = sqrt(dx*dx + dy*dy);
	
	d = clamp(d, 0.0, 1.0);
	d = pow(sin(d*3.1415*0.5),  8.0);
	
	gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0) * (1.0 - d) * fadein;
}