
// Custom parameters
float size = 0.04;
float zoom = 30.0;
float colorSeparation = 0.3;
 
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
  vec2 p = fragCoord / iResolution.xy;
  float inv = 1. - iProgress;
  vec2 disp = size*vec2(cos(zoom*p.x), sin(zoom*p.y));
  vec4 texTo = texture2D(iChannel[1], p + inv*disp);
  vec4 texFrom = vec4(
    texture2D(iChannel[0], p + iProgress*disp*(1.0 - colorSeparation)).r,
    texture2D(iChannel[0], p + iProgress*disp).g,
    texture2D(iChannel[0], p + iProgress*disp*(1.0 + colorSeparation)).b,
    1.0);
  fragColor = texTo*iProgress + texFrom*inv;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////

void main() {
    mainImage(gl_FragColor, gl_FragCoord.xy);
}
