Skip to content

Instantly share code, notes, and snippets.

@gre
Forked from gre/TEMPLATE.glsl
Created January 24, 2014 23:04
Show Gist options
  • Save gre/8608651 to your computer and use it in GitHub Desktop.
Save gre/8608651 to your computer and use it in GitHub Desktop.
#ifdef GL_ES
precision highp float;
#endif
// General parameters
uniform sampler2D from;
uniform sampler2D to;
uniform float progress;
uniform vec2 resolution;
uniform float amplitude;
uniform float speed;
void main()
{
vec2 p = gl_FragCoord.xy / resolution.xy;
vec2 dir = p - vec2(.5);
float dist = length(dir);
vec2 offset = dir * (sin(progress * dist * amplitude - progress * speed) + .5) / 30.;
gl_FragColor = mix(texture2D(from, p + offset), texture2D(to, p), smoothstep(0.2, 1.0, progress));
}
{ "amplitude": 100, "speed": 50 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment