#version 330 core

uniform vec3 iResolution;
uniform float iTime;
uniform float uAlpha;

out vec4 FragColor;

// original shadertoy converted fragment

float tanh_f(float x){ return (exp(x)-exp(-x))/(exp(x)+exp(-x)); }

void mainImage(out vec4 O, vec2 I){
    vec2 J=I=3.*vec2(log(length(I=(I+I-iResolution.xy)/iResolution.y)),atan(I.y,I.x));
    for (float n=0.; n++<8.; I+=.8*tan(sin(I.yx*n+iTime*n))/n);
    O=tanh((1.+sin(I.x+vec4(0,2,3,0)))/abs(sin(iTime+2.*length(I-J)))/3.);
}

void main()
{
    vec4 o;
    mainImage(o, gl_FragCoord.xy);
    o.a *= uAlpha;
    FragColor = o;
}
