xxxxxxxxxx
38
precision mediump float;
// grab texcoords from vert shader
varying vec2 vTexCoord;
// our texture coming from p5
uniform sampler2D tex0;
uniform float u_time;
float plot(vec2 st) {
return smoothstep(0.05, 1.0, abs(st.y - st.x));
}
void main() {
vec2 uv = vTexCoord;
uv.y = 1. - (sin(fract(uv.y)));
uv.x = 1. - (sin(fract(uv.x)));
vec3 color = vec3(1.0);
float pct = plot(uv);
color = sin((1.0-pct) + u_time/100.)*color+pct*vec3(0.0,1.0,0.0);
vec4 tex = texture2D(tex0, uv);
float gray = (tex.r + tex.g + tex.b) / 3.0;
float res = 20.0;
float scl = res / (10.0);
vec3 thresh = vec3(fract(cos(color.r)), fract(cos(color.g)), fract(cos(tex.b)));
// render the output
gl_FragColor = vec4(thresh, 1.0);
}