
precision lowp float;

uniform float iGlobalTime;
uniform vec2 iResolution;

void main()
{

	// square aspect ratio please..
	vec2 p = (gl_FragCoord.xy / (iResolution.x));
	// add an offset to center things
	p.y += .25;
	// define an origin
	vec3 c = vec3(0);

	// create a ring of blobs..
	for(int i = 0;i < 16;i++)
	{
		// in a circle..
		float x = (sin(iGlobalTime + float(i) * (sin(iGlobalTime) * .48)));
		float y = (cos(iGlobalTime + float(i) * .48));
		float temp;
		// then, expanding outward from each blob away from teh origin..
		for(int j = 1; j < 8; j++){
		  vec2 o = vec2(x * (float(j) * .04) +.5, y *(float(j) * sin(iGlobalTime) * .04) +.5);
		  float r =  clamp(x * 2., 0.2, 1.0);
		  float g =  y * 2.;
		   clamp(g, 0.4, 0.8);
		  c += 0.0008 / (length(p-o)) * vec3(r, g, x+y);
		// flip to alternate directions
		  temp = -y;
		  y = x;
		  x = temp;
		}

	}

	gl_FragColor = vec4(c * 1.3, 1);
}