32 lines
762 B
GLSL
32 lines
762 B
GLSL
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
#define PI 3.14159265359
|
|
|
|
uniform vec2 u_resolution;
|
|
uniform float u_time;
|
|
|
|
float plot (vec2 st, float pct){
|
|
return smoothstep( pct-0.01, pct, st.y) -
|
|
smoothstep( pct, pct+0.01, st.y);
|
|
}
|
|
|
|
void main() {
|
|
vec2 st = gl_FragCoord.xy/u_resolution.xy;
|
|
vec3 color = vec3(0.0);
|
|
|
|
vec3 pct = vec3(st.x);
|
|
|
|
pct.r = smoothstep(0.0,1.0, st.x*abs(sin(u_time)));
|
|
pct.g = sin(st.x*PI*u_time);
|
|
pct.b = pow(st.x*abs(cos(u_time)),0.5);
|
|
|
|
// Plot transition lines for each channel
|
|
color = mix(vec3(0.0),vec3(1.0,0.0,0.0),plot(st,pct.r));
|
|
color = mix(color,vec3(0.0,1.0,0.0),plot(st,pct.g));
|
|
color = mix(color,vec3(0.0,0.0,1.0),plot(st,pct.b));
|
|
|
|
gl_FragColor = vec4(color,1.0);
|
|
}
|