uniform sampler2D tex0;
uniform int time;
uniform int offset;

void main(void)
{
	float twoPi = 2.0 * 3.141592654;

	vec2 uv = gl_TexCoord[0].st;

	float period = 0.7;
	float amplitude = 0.07;
	float phase = mod(time + offset, 2000) / 2000.0;
	float thick = 1.0 + sin(phase * twoPi + uv.t * twoPi * period) * amplitude;

	float period2 = 0.7;
	float amplitude2 = 0.03;
	float phase2 = mod(time + offset, 3000) / 3000.0;
	float squash = 1.0 + sin(phase2 * twoPi + uv.t * twoPi * period2) * amplitude2;

	uv.t = uv.t * squash;
	uv.s = ((-1.0 + 2.0 * uv.s) * thick) * 0.5 + 0.5;

	vec4 color = texture2D(tex0, uv);

	gl_FragData[0] = color * gl_Color;
}
