Neon runner
glint · Examples · Tutorials · Gallery
Synthwave: a striped sun sinking behind mountains, a grid floor racing towards you faster with the bass, flashing on the kick.
Audio-reactive: it moves with music from a microphone, line-in or a file.

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.
The code
One pass, in GLSL.
fragment shader
#version 300 es
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform vec3 spectrum;
uniform float beat;
uniform float beatTime;
uniform int beatCount;
uniform sampler2D fft;
in vec2 v_texcoord;
out vec4 fragColor;
// 1 on each kick, fading; without audio, a steady pulse twice a second.
float kick() { return beatCount > 0 ? beat : pow(1.0 - fract(time * 2.0), 4.0); }
// Seconds since the last kick, and which kick it was (the same fallback).
float sinceKick() { return beatCount > 0 ? beatTime : fract(time * 2.0) / 2.0; }
float kickId() { return beatCount > 0 ? float(beatCount) : floor(time * 2.0); }
// One FFT bin, 0..1 across the spectrum (bass on the left).
float bin(float x) { return texture(fft, vec2(x, 0.25)).r; }
float hash(float n) { return fract(sin(n * 127.1) * 43758.5453); }
float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
vec2 hash2(float n) { return fract(sin(vec2(n * 127.1, n * 269.5)) * 43758.5453); }
mat2 rot(float a) { float c = cos(a), s = sin(a); return mat2(c, s, -s, c); }
vec3 pal(float t) { return 0.5 + 0.5 * cos(6.28318 * (t + vec3(0.0, 0.33, 0.67))); }
float noise(float x) { float i = floor(x), f = fract(x); return mix(hash(i), hash(i + 1.0), f * f * (3.0 - 2.0 * f)); }
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
float horizon = -0.02;
vec3 col;
if (uv.y < horizon) {
// The floor: perspective from 1/distance; lines where x or z is a whole number.
float z = 0.35 / (horizon - uv.y);
vec2 g = vec2(uv.x * z, z + time * (2.0 + spectrum.x * 6.0));
vec2 w = abs(fract(g) - 0.5) / fwidth(g);
float line = 1.0 - min(min(w.x, w.y), 1.0);
col = vec3(0.05, 0.0, 0.1) + vec3(1.0, 0.2, 0.9) * line * (1.0 + 2.0 * kick()) * exp(-z * 0.08);
col += vec3(0.6, 0.1, 0.5) * exp(-(horizon - uv.y) * 30.0) * 0.5;
} else {
col = mix(vec3(0.9, 0.3, 0.5), vec3(0.08, 0.02, 0.2), pow(uv.y - horizon, 0.5) * 1.6);
// The sun, with stripes cut through its lower half.
vec2 sp = uv - vec2(0.0, 0.17);
float sun = smoothstep(0.26, 0.255, length(sp));
float cut = step(0.5, fract((sp.y + time * 0.03) * 22.0)) * step(sp.y, 0.02) + step(0.02, sp.y);
col = mix(col, mix(vec3(1.0, 0.25, 0.5), vec3(1.0, 0.9, 0.3), clamp(sp.y * 3.0 + 0.6, 0.0, 1.0)), sun * cut);
col += vec3(1.0, 0.4, 0.6) * 0.25 * exp(-length(sp) * 3.0);
// Mountains.
float m = horizon + 0.08 * noise(uv.x * 6.0 + 3.0) + 0.05 * noise(uv.x * 14.0);
col = mix(col, vec3(0.1, 0.02, 0.15), step(uv.y, m));
col += vec3(0.8, 0.2, 1.0) * smoothstep(0.004, 0.0, abs(uv.y - m)) * step(horizon, uv.y) * 0.8;
// Stars.
col += step(0.996, hash(floor(gl_FragCoord.xy / 2.0))) * step(0.2, uv.y) * 0.8;
}
fragColor = vec4(col, 1.0);
}More Audio-reactive examples
LED meter · Bass blob · Vinyl · Sonar · Hex pulse · Spectrum flower · Starburst · Mirror bars