#define PI 3.141592
#define BALLS 10.
#define zoom .2
#define contrast 1.5
#define ballSize 0.1
#define radius 5.
  
void mainImage( out vec4 O, vec2 u ) {
  vec2 R = iResolution.xy,
       U = zoom * abs( 2. * u - R) / R.y;

  U /= dot(U,U);
  float dist = length(U);
  O = vec4(0);

  U *= tan( log(U) + iTime );
  for (float i = 0.; i < BALLS; i++) {
      U.x -= cos( log( abs( abs(U.x*.1) -i-1. )) -iTime );
      float t = iTime/10. + i * PI / BALLS;
      vec2 p =   vec2(tan(t), sin(t)) * radius * tan(i);
      O.rgb += ( cos( + PI * (iTime/2. + i/5. +vec3(0, 2./2., -2./3.)) ) * .5 + .5)
              * dist*ballSize / length(U + p);
  }
  O = pow(O, vec4(contrast));
}

/*

#define PI 3.141592
#define BALLS 10
#define zoom .2
#define contrast 1.5
#define ballSize 0.1
#define radius 5.
  
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
  vec2 uv = 2. * fragCoord/iResolution.xy - 1.;
  uv.x *= iResolution.x / iResolution.y;
  uv *= zoom;
  fragColor = vec4(0);
  uv = normalize(uv) / length(uv);
  float dist = length(uv);
  uv = (abs(uv));
  uv *= tan(log(uv) + iTime/1.);
  for (int i = 0; i < BALLS; i++) {
		uv.x -= cos(log(abs(uv.x*.1)-float(i+1))-iTime);
    float t = iTime/10. + float(i) * PI / float(BALLS);
    vec2 p = vec2(tan(t), sin(t));
    p *= radius * tan(float(i) - PI);
    vec3 col = cos(vec3(0, 1, -1) * PI * 2. / 3. + 3.141925 * (iTime / 2. + float(i) / 5.)) * 0.5 + 0.5;
    fragColor += vec4(dist*ballSize / length(uv + p) * col, 1.0);
  }
  fragColor.xyz = pow((fragColor.xyz), vec3(contrast));
  fragColor.w = 1.0;
}
*/
