glcanvas/shader/my.frag

16 lines
371 B
GLSL
Raw Normal View History

2024-09-17 21:45:26 -04:00
precision mediump float;
uniform float u_clock;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
float color = mod(u_clock, 4096.0) / 4096.0;
gl_FragColor = vec4(hsv2rgb(vec3(color, 0.8, 1.0)), 1.0);
}