Skip to content

Instantly share code, notes, and snippets.

@gre
Forked from gre/TEMPLATE.glsl
Last active January 4, 2016 10:29
Show Gist options
  • Save gre/8609062 to your computer and use it in GitHub Desktop.
Save gre/8609062 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 vec3 color;
uniform float colorPhase; // if 0.0, there is no black phase, if 0.9, the black phase is very important
void main() {
vec2 p = gl_FragCoord.xy / resolution.xy;
gl_FragColor = mix(mix(vec4(color, 1.0), texture2D(from, p), smoothstep(1.0-colorPhase, 0.0, progress)),
mix(vec4(color, 1.0), texture2D(to, p), smoothstep( colorPhase, 1.0, progress)), progress);
}
{ "color": [0,0,0], "colorPhase": 0.5 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment