ScrapExplorer - Colour_bars_fade.glsl
Home / misc / GLSL Lines: 1 | Size: 949 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* GLSL Examples 2 * A collection of GLSL examples for use with the Shader toy website and other 3 * GLSL environments. 4 * By: 0x4248 5 * 6 * Color Bars Fade 7 * Fades the color bars in and out using a sine wave saturation effect. 8 */ 9 10void mainImage(out vec4 fragColor, in vec2 fragCoord) { 11 vec2 uv = fragCoord.xy / iResolution.xy; 12 13 float barWidth = 1.0 / 8.0; 14 15 int barIndex = int(uv.x / barWidth); 16 17 vec3 colors[8]; 18 colors[0] = vec3(1.0, 0.0, 0.0); // Red 19 colors[1] = vec3(1.0, 0.5, 0.0); // Orange 20 colors[2] = vec3(1.0, 1.0, 0.0); // Yellow 21 colors[3] = vec3(0.0, 1.0, 0.0); // Green 22 colors[4] = vec3(0.0, 0.0, 1.0); // Blue 23 colors[5] = vec3(0.5, 0.0, 1.0); // Purple 24 colors[6] = vec3(1.0, 0.0, 1.0); // Magenta 25 colors[7] = vec3(1.0, 1.0, 1.0); // White 26 27 vec3 color = colors[barIndex]; 28 29 fragColor = vec4(color, 1.0); 30 31 float saturation = 0.5 + 0.5 * sin(iTime); 32 fragColor = vec4(mix(vec3(1.0), color, saturation), 1.0); 33} 34[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.