// variant of https://shadertoy.com/view/4dcyzX

#define rot(a) mat2(cos(a),-sin(a),sin(a),cos(a))
#define SQR(v) ( (v) * (v) )

vec4 tex(float t, vec2 U) {             // ( how complicated it is to switch source... )
    return   t<1. ? texture( iChannel0, U )
           : t<2. ? texture( iChannel1, U )
           : t<3. ? texture( iChannel2, U )
           :        texture( iChannel3, U );
}
vec4 T(vec2 U) {
    float t = mod(iTime/3.-1., 4.);
  //return tex(t,U);                    // switch between textures
    return mix( tex(t,U), tex(mod(t+1.,4.),U), fract(t) ); // blend between textures
}

void mainImage( out vec4 O, vec2 U )
{
    vec2 R = iResolution.xy;
    U =  .8* (U+U-R)/R.y;
    O -= O;

    vec2  r = vec2(.5,.3);              // base ellipse aspect ration
    float a = -3.14/2.,                 // ellipse angle tilt per scaling length
          va, d,                        // scaling length
          e = .3;                       // thickness of each ellipse

    for (float l = .1,n=1.; l<2.; l+= .1,n++) {
     // r = .5*vec2( 1., .6+.4* (l/3.) );      // morphing to circle outside
        vec2 V = 1./vec2(r) * ( rot(a*l)* U ) ;
        d = dot (V, V ); // quadratic form of the ellipsoid U.R⁻¹.(1/d²).R.U = l²
        va = iTime;                            // angular velocity
      //va = iTime*(1./l-0.);                  // in galaxies, tangential velocity is constant !
        vec4 C = T( rot(va+n) * .5*V/l );      // noise in ellipse frame
        O += smoothstep(e,0.,abs(sqrt(d)-l) )  // ellipse shape
            * C*C*C;                           // texturing. opt: fading 1./l
    }
}

