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/8608987 to your computer and use it in GitHub Desktop.
Save gre/8608987 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;
bool inHeart (vec2 p, vec2 center, float size) {
if (size == 0.0) return false;
vec2 o = (p-center)/(1.6*size);
return pow(o.x*o.x+o.y*o.y-0.3, 3.0) < o.x*o.x*pow(o.y, 3.0);
}
void main() {
vec2 p = gl_FragCoord.xy / resolution.xy;
float m = inHeart(p, vec2(0.5, 0.4), progress) ? 1.0 : 0.0;
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment