Back to shaders
Shader test bench
Heart
runnable transition
GLSL transition function. Stronghold supplies two demo textures and progress/time uniforms.
Code
// Author: gre
// License: MIT
float inHeart (vec2 p, vec2 center, float size) {
if (size==0.0) return 0.0;
vec2 o = (p-center)/(1.6*size);
float a = o.x*o.x+o.y*o.y-0.3;
return step(a*a*a, o.x*o.x*o.y*o.y*o.y);
}
vec4 transition (vec2 uv) {
return mix(
getFromColor(uv),
getToColor(uv),
inHeart(uv, vec2(0.5, 0.4), progress)
);
}