
vec3 palette( float t ) {
    vec3 a = vec3(0.5, 0.5, 0.5);
    vec3 b = vec3(0.5, 0.5, 0.5);
    vec3 c = vec3(1.0, 1.0, 1.0);
    vec3 d = vec3(0.263,0.416,0.557);

    return a + b*cos( 6.28318*(c*t+d) );
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    
    vec2 uv = (fragCoord / iResolution.xy * 2.0 -1.0) ;
    uv.x *= iResolution.x / iResolution.y ;
    vec2 uv_0 = uv;
    vec3 _black = vec3(0.0); 
    
    for(float i = 0.0; i< 3.0;i++){
         uv *= 2.0 ; 


        uv = fract(uv);
        uv -= 0.5 ; 
        float _d  = length(uv) * exp(-length(uv_0));
    
        vec3 _col = palette(length(uv_0) + i*0.4 +  iTime*0.4);

        _d = sin(_d*8. + iTime)/8. ;

        _d = abs(_d);

        _d = pow(0.01/_d , 1.2) ;

        _col *= _d;

        _black += _col;
    
    }
    
    fragColor = vec4(_black,1.0);
    
} 
