Vinyl
glint · Examples · Tutorials · Gallery
A record turning at 33⅓ with grooves catching the light, a tonearm, and a ring of spectrum bars around the platter. The label pulses with 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 segment(vec2 p, vec2 a, vec2 b) {
vec2 pa = p - a, ba = b - a;
return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));
}
void main() {
vec2 uv = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
vec2 c = uv + vec2(0.12, 0.0);
float r = length(c);
float spin = time * 3.49; // 33 1/3 rpm in radians a second
float a = atan(c.y, c.x);
vec3 col = vec3(0.08, 0.06, 0.05) + 0.03 * sin(uv.y * 80.0 + sin(uv.x * 3.0) * 4.0); // a wooden desk
// Spectrum ring around the platter.
float ang = fract(a / 6.28318 + 0.5);
float lv = bin(0.01 + ang * 0.4);
float ringD = abs(r - 0.47 - lv * 0.08 * 0.5) - lv * 0.04 - 0.002;
col = mix(col, pal(ang + time * 0.05), smoothstep(0.004, 0.0, ringD) * step(0.5, fract(ang * 64.0 + 0.25)));
// Platter and record.
col = mix(col, vec3(0.2), smoothstep(0.455, 0.45, r));
if (r < 0.43) {
float groove = 0.5 + 0.5 * sin(r * 900.0);
// The sheen: grooves light up across from the light.
float sheen = pow(abs(cos(a - 0.8)), 30.0) + pow(abs(cos(a + 2.3)), 60.0) * 0.6;
col = vec3(0.03) + vec3(0.25) * sheen * (0.4 + 0.6 * groove) * smoothstep(0.15, 0.2, r);
// Label, spinning (a stripe so you can see it turn), pulsing with the kick.
if (r < 0.14) {
float la = a - spin;
col = pal(0.95) * (0.6 + 0.4 * kick()) * (0.85 + 0.15 * step(0.0, sin(la * 2.0)));
col = mix(col, vec3(0.9), smoothstep(0.004, 0.0, abs(r - 0.09)) * step(0.0, sin(la)));
col = mix(col, vec3(0.05), smoothstep(0.012, 0.009, r));
}
}
// Tonearm: from a pivot to the needle in the grooves.
vec2 pivot = vec2(0.45, 0.33);
vec2 needle = vec2(0.1 + 0.02 * sin(time * 0.3), 0.18);
float arm = segment(c, pivot, needle) - 0.008;
col = mix(col, col * 0.3, smoothstep(0.03, 0.0, segment(c + vec2(0.015, 0.02), pivot, needle))); // its shadow
col = mix(col, vec3(0.75), smoothstep(0.003, 0.0, arm));
col = mix(col, vec3(0.5), smoothstep(0.035, 0.03, length(c - pivot)));
fragColor = vec4(col, 1.0);
}More Audio-reactive examples
Lissajous scope · Strobe shapes · LED meter · Bass blob · Sonar · Neon runner · Hex pulse · Spectrum flower