#version 330 core
in vec2 vTex;
out vec4 FragColor;
uniform sampler2D iChannel0;
uniform vec3 iResolution;
uniform float iTime;
uniform float uAlpha;
uniform float uStartDelay;

float rand(vec2 co)
{
    return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord.xy / iResolution.xy;
    
    float rnd = rand(vec2(iTime)) * 4.0;
    
    if (mod(fragCoord.y, rnd) > rnd / 8.0)
    {
        float of = sin(fragCoord.y / rnd * iTime) * rnd * 2.0;
        uv = vec2(fragCoord.x + of, fragCoord.y + of / 2.0) / iResolution.xy;
        fragColor = texture(iChannel0, uv);
        fragColor.r *= texture(iChannel0, uv + of * rnd * vec2(0.005, 0.0)).r;
        fragColor.g *= texture(iChannel0, uv).g;
        fragColor.b *= texture(iChannel0, uv - of * rnd * vec2(0.005, 0.0)).b;
        fragColor *= 1.5;
    } else
    {
        uv = vec2(fragCoord.x - rnd * 4.0, fragCoord.y + rnd / 2.0) / iResolution.xy;
        fragColor = texture(iChannel0, uv);
        fragColor.r *= texture(iChannel0, uv + rnd * vec2(0.05, 0.0)).r;
        fragColor.g *= texture(iChannel0, uv).g;
        fragColor.b *= texture(iChannel0, uv - rnd * vec2(0.05, 0.0)).b;
        fragColor *= 1.5;
    }
}

void main(){ mainImage(FragColor, gl_FragCoord.xy); }
