precision highp float;
#define iChannel0 inputImageTexture
#define texture(a,b) texture2D(a,fract(b))
#define fragColor gl_FragColor
varying highp vec2 textureCoordinate;

uniform sampler2D inputImageTexture;

uniform float iTime;

const float PI = 3.1415927;

highp vec4 rgbShift(highp vec2 uv) {
    float amount = 0.01;

    float t = sin(iTime * 0.28) + cos(iTime * 0.52);
    t *= PI;

    highp vec2 d = vec2(amount * cos(t), amount * sin(t));


    float r = texture(iChannel0, uv - d).r;
    float g = texture(iChannel0, uv + 0.0).g;
    float b = texture(iChannel0, uv + d).b;

    return vec4(r,g,b,1.0);
}

void main() {
    highp vec2 uv = textureCoordinate;

    float line = 0.42;
    uv.y += line;

    uv.y = mix(uv.y - 0.1, uv.y + 0.1, step(1.0, uv.y));

    float a = abs(textureCoordinate.y - 1.0 + line);
    a = smoothstep(0.002, 0.010, a);

    fragColor = mix(vec4(vec3(0.0), 1.0), rgbShift(uv), a);
}