Skip to content

Instantly share code, notes, and snippets.

@gre
Created April 25, 2021 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gre/c7e8d1ceeae1bdf33961aa291a329d5e to your computer and use it in GitHub Desktop.
Save gre/c7e8d1ceeae1bdf33961aa291a329d5e to your computer and use it in GitHub Desktop.
precision highp float;
varying vec2 uv;
uniform float time;
uniform sampler2D img;
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d ) {
return a + b*cos( 6.28318*(c*t+d) );
}
vec3 color (float t) {
return palette(
t,
vec3(.5),
vec3(.6 + .1 * cos(.3 * time)),
vec3(1.),
vec3(0.22, 0.5, 0.77)
);
}
void main() {
float v = 1. - texture2D(img, uv).a;
v = max(-step(fract(time), 0.5), v);
gl_FragColor = vec4(
step(v, 0.) * color(1.6 * (uv.y + time)) +
step(0., v) * color(sqrt(max(v, 0.)) - 2. * time),
1.0);
}
@gre
Copy link
Author

gre commented Apr 25, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment