precision highp float; varying vec2 uv0; uniform sampler2D inputImageTexture; uniform sampler2D inputImageTexture2; uniform int imageWidth; uniform int imageHeight; uniform float progress; uniform float count; // = 10.0 uniform float smoothness; // = 0.5 vec4 getFromColor(vec2 p) { return texture2D(inputImageTexture,p); } vec4 getToColor(vec2 p) { return texture2D(inputImageTexture2,p); } vec4 transition (vec2 p) { float pr = smoothstep(-smoothness, 0.0, p.x - progress * (1.0 + smoothness)); float s = step(pr, fract(count * p.x)); return mix(getFromColor(p), getToColor(p), s); } void main(void) { vec4 resultColor = transition(uv0); gl_FragColor=resultColor; }