Strobe shapes
glint · Examples · Tutorials · Gallery
A different polygon on every beat, punched out and spun, with the colours inverting every fourth kick. Simple, loud, made for a big screen.
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;
uniform float barPhase;
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))); }
// Distance to a regular polygon with n sides.
float polygon(vec2 p, float n, float r) {
float seg = 6.28318 / n;
float a = mod(atan(p.y, p.x) + seg * 0.5, seg) - seg * 0.5;
return length(p) * cos(a) - r;
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
float id = kickId();
float k = kick();
float sides = 3.0 + mod(id, 5.0);
vec2 p = rot(id * 0.9 + time * 0.3) * uv;
float d = polygon(p, sides, 0.22 + 0.12 * k);
float ring = abs(polygon(p, sides, 0.34 + barPhase * 0.3)) - 0.006;
vec3 ink = pal(id * 0.13);
float m = smoothstep(0.004, -0.004, d) + smoothstep(0.004, -0.004, ring) * (1.0 - barPhase);
vec3 col = mix(vec3(0.02), ink, clamp(m, 0.0, 1.0));
// Every fourth kick: invert, briefly.
if (mod(id, 4.0) == 0.0 && k > 0.4) col = 1.0 - col;
fragColor = vec4(col, 1.0);
}More Audio-reactive examples
Spectrum city · Kick ripples · Beat kaleidoscope · Lissajous scope · LED meter · Bass blob · Vinyl · Sonar