treppe-gl/shaders/heartbeat.glsl
April John cebb41dbc7 Add fire, ocean, heartbeat, bounce, trans and storm shaders
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 15:03:47 +02:00

19 lines
648 B
GLSL

// A slow lub-dub travelling up the stairs
float bump(float x, float c, float w) {
float d = (x - c) / w;
return exp(-d * d);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
float i = floor(fragCoord.x / iResolution.x * 16.0);
float period = 3.2; // slow, ~19 bpm
float ph = fract((iTime - i * 0.15) / period) * period;
float beat = bump(ph, 0.50, 0.20) + 0.65 * bump(ph, 1.25, 0.26);
vec3 base = vec3(0.10, 0.0, 0.01);
vec3 col = base + vec3(1.0, 0.04, 0.06) * beat;
col += vec3(0.5) * bump(ph, 0.50, 0.08); // white-ish peak
fragColor = vec4(col, 1.0);
}