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 * 2.0 - iResolution.xy) / iResolution.y);
    vec2 pos = (uv.xy);
    vec2 cir = ((pos.xy * pos.xy + sin(uv.x*18.0+iTime) / 25.0 * sin(uv.y*7.0+iTime*1.5) / 1.0)+uv.x*sin(iTime)/16.0+uv.y*sin(iTime*1.2)/16.0);
    float circles = (sqrt(abs(cir.x+cir.y*0.5)*5.0)*5.0);

    vec2 uv0 = uv;

    vec3 finalColor = vec3(0.0);

    for (float i = 0.0; i < 4.0; i++) {
        uv = fract(uv * 1.5) - 0.5;

        float d = length(uv) * exp(-length(uv0));


        d = sin(d * 8.0 + iTime) / 8.0;
        d = abs(d);
        d = pow(0.01 / d, 1.2);

        vec3 color = palette(length(uv0) + i*0.4 + iTime*.5);

        finalColor += color * d;

    }



    // Output to screen
    fragColor = vec4(finalColor, 1.0) + vec4(sin(circles*1.25+2.0),abs(sin(circles*1.0-1.0)-sin(circles)),abs(sin(circles)*1.0), 1.0) / (cos(iTime) * 0.4 + 1.4);
}
