// more fanny batter (deep computed) - disco
// http://glslsandbox.com/e#60757.2
// more fanny batter (deep computed) - disco


#define PI 3.1415926

vec3 pal(float x)
{
	return max(min(sin(vec3(x,x+PI*2.0/3.0,x+PI*4.0/3.0))+0.5,1.0),0.0);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
	float t = iTime*0.9;
	vec2 position = ( fragCoord.xy / iResolution.xy ) - 0.5;
	position *= 2.25;
	position.y *= dot(position,position);
	
	position.y *= 1.0+sin(position.x*3.0)*0.2;
	
	float foff = 0.3;
	float den = 0.05;
	float amp = iMouse.y/iResolution.y ;
	float freq = 5.0+iMouse.x/iResolution.x*10.0;
	float offset = 0.1-tan(position.x*0.5)*5.05;

    float modifer = 0.;
	
	for(float i = 0.0; i < 3.0; i+=1.0)
		modifer += 6.0/abs((position.y + (amp*sin(((position.x*4.0 + t) + offset) *freq+i*foff))))*den;;
	
	vec3 colour = pal(position.x*2.)*0.25* modifer;
	
	fragColor = vec4( colour, 1.0 );
	//fragColor = vec4( modifer,0, 0, 1.0 );
}