19 lines
772 B
GLSL
19 lines
772 B
GLSL
// Trans flag, gently waving. The white stripe uses the white LEDs.
|
|
|
|
vec3 stripe(int k) {
|
|
if (k == 0 || k == 4) return vec3(0.25, 0.75, 1.0); // blue
|
|
if (k == 1 || k == 3) return vec3(1.0, 0.35, 0.55); // pink
|
|
return vec3(1.0); // white
|
|
}
|
|
|
|
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
float i = floor(fragCoord.x / iResolution.x * 16.0);
|
|
float x = (i + 0.5) / 13.0;
|
|
float p = x * 5.0 + 0.5 * sin(iTime * 0.3) + 0.25 * sin(x * 6.0 - iTime * 0.7);
|
|
p = clamp(p, 0.0, 4.999);
|
|
int k = int(floor(p));
|
|
float f = smoothstep(0.7, 1.0, fract(p));
|
|
vec3 col = mix(stripe(k), stripe(min(k + 1, 4)), f);
|
|
col *= 0.9 + 0.1 * sin(i * 0.5 - iTime * 0.8);
|
|
fragColor = vec4(col * 0.8, 1.0);
|
|
}
|