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 highp float iTime;
uniform highp vec2 iResolution;

uniform float count;
uniform float offset;
uniform float speedV;

float steppedVal(float v, float steps){
    return floor(v*steps)/steps;
}

float random1d(float n){
    return fract(sin(n) * 43758.5453);
}

float noise1d(float p){
    float fl = floor(p);
    float fc = fract(p);
    return mix(random1d(fl), random1d(fl + 1.0), fc);
}

const float TWO_PI = 6.283185307179586;

void main()
{
    vec2 uv = textureCoordinate;

    float time = iTime * 0.25;

    float n = noise1d(uv.y * count + time * speedV * 3.0);

    float ns = steppedVal(fract(n  ),count) + 2.0;

    float nsr = random1d(ns);

    highp vec2 uvn = uv;

    uvn.x += nsr * sin(time * TWO_PI + nsr * 20.0) * offset;

    fragColor = texture2D(iChannel0, uvn);
}