Jellyfish Drift
by MusicBar, visualizer
Glowing jellyfish drift along through dark water trailing long wavy tentacles, their bells pulsing and pushing upward on every beat among twinkling plankton.
How it installs, its SHA-256 and its code
Click Apply: MusicBar downloads it, checks its SHA-256 and puts it on the taskbar, or just puts it on if it already has it. Needs MusicBar 1.8 or newer.
SHA-256 8b47e22f68edce1edb39ab3bf07037565b3dce31dddf1cfd9cc422ae56b06ae6
//! name: Jellyfish Drift
//! author: MusicBar
//! kind: visualizer
//! description: Glowing jellyfish drift along through dark water trailing long wavy tentacles, their bells pulsing and pushing upward on every beat among twinkling plankton.
float hash2(float2 p)
{
float3 q = frac(float3(p.x, p.y, p.x) * 0.1031);
q += dot(q, q.yzx + 33.33);
return frac((q.x + q.y) * q.z);
}
// Lays a color over what is there (premultiplied light, and how much of the pixel it covers).
void layer(inout float3 acc, inout float cover, float3 rgb, float a)
{
a = saturate(a);
acc = rgb * a + acc * (1.0 - a);
cover = a + cover * (1.0 - a);
}
float2 rot(float2 p, float a)
{
float c = cos(a), s = sin(a);
return float2(c * p.x - s * p.y, s * p.x + c * p.y);
}
// The jellyfish of cell k: a see-through bell with a glowing rim, frilly oral arms and long tentacles.
// s scales it, a sets how bright it shines.
void jelly(inout float3 acc, inout float cover, float2 px, float cw, float seed, float s, float a, float H, float glow)
{
float k = floor(px.x / cw);
float h = hash2(float2(k, seed));
float h2 = frac((k + seed) / 3.0) * 3.0;
float3 col = h2 < 0.5 ? colorA.rgb : (h2 < 1.5 ? colorB.rgb : colorC.rgb);
a *= step(0.2, hash2(float2(k, seed + 2.0)));
// The swim stroke: a slow idle pulse, and a hard squeeze on the beat that lifts the bell.
float pump = saturate(pow(0.5 + 0.5 * sin(time * 1.7 + h * 6.28), 4.0) * 0.6 + beat);
float2 c = float2((k + 0.5) * cw + (h - 0.5) * (cw - 1.4 * H * s), H * (0.56 + 0.1 * sin(time * 0.35 + h * 9.0) + 0.07 * pump * s));
float2 q = rot(px - c, 0.2 * sin(time * 0.4 + h * 5.0));
float2 r = float2(0.25 * (1.0 - 0.2 * pump), 0.2 * (1.0 + 0.16 * pump)) * H * s;
float e = length(q / r);
float under = r.y * (0.12 - 0.32 * saturate(q.x * q.x / (r.x * r.x)));
float sd = max((e - 1.0) * r.y, under - q.y);
// Tentacles and two oral arms hang from the rim, waving and trailing behind the drift.
float tent = 0.0;
for (int i = 0; i < 8; i++)
{
float arm = step(5.5, i);
float x0 = lerp((i / 5.0 - 0.5) * 1.6 * r.x, (i - 6.5) * 0.3 * r.x, arm);
float len = H * s * lerp(0.95 + 0.2 * hash2(float2(k, i)), 0.5, arm);
float t = (r.y * 0.05 - q.y) / len;
float xc = x0 + (sin(t * lerp(9.0, 6.0, arm) - time * 2.6 + i * 1.3) * (0.05 + 0.1 * t) + 0.18 * t * t) * H * s;
float w = max(0.45, H * s * lerp(0.014, 0.05, arm) * (1.0 - 0.75 * t));
float d = abs(q.x - xc) - w;
tent = max(tent, smoothstep(0.5, -0.5, d) * step(0.0, t) * saturate(1.0 - t) * lerp(0.75, 1.0, arm));
}
// Glow in the water, the tentacles, then the bell, brightest at its edges like glass.
layer(acc, cover, col, exp(-max(sd, 0.0) / (0.14 * H * s)) * smoothstep(0.45 * H * s, 0.0, sd) * (0.22 + 0.3 * pump) * a * glow);
float pulseDown = 0.75 + 0.25 * sin(-q.y / (0.08 * H * s) + time * 5.0);
layer(acc, cover, lerp(col, float3(1, 1, 1), 0.12) * pulseDown, tent * 0.8 * a);
float fres = saturate(smoothstep(0.45, 1.0, e) + smoothstep(0.06 * H * s, 0.0, q.y - under));
float organ = exp(-dot((q - float2(0.0, 0.3 * r.y)) / r, (q - float2(0.0, 0.3 * r.y)) / r) * 9.0);
float3 bell = col * (0.45 + 0.75 * fres) + float3(1, 1, 1) * (0.25 * fres * fres + 0.3 * organ);
layer(acc, cover, bell, smoothstep(0.5, -0.5, sd) * (0.2 + 0.6 * fres + 0.3 * organ) * a);
layer(acc, cover, col, smoothstep(1.2, 0.2, abs(sd + 0.6)) * 0.7 * a);
// Bioluminescent spots strung along the rim, flaring with the stroke.
float spots = smoothstep(0.3, 0.9, sin(q.x / r.x * 11.0 + time * 3.0)) * step(abs(q.x), r.x * 0.98);
float rim = smoothstep(max(1.0, 0.035 * H * s), 0.0, abs(q.y - under)) * spots;
layer(acc, cover, lerp(col, float3(1, 1, 1), 0.6), rim * (0.4 + 0.6 * pump) * a * glow);
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
// Pixels: along the bar, and up from the screen edge.
float H = size.y;
float2 px = float2(uv.x * size.x, rise(uv) * H);
float glow = 0.8 + 0.25 * level + 0.3 * spectrum(abs(uv.x - 0.5) * 2.0);
float3 acc = float3(0, 0, 0);
float cover = 0;
// Plankton specks rising slowly, twinkling, sparking up on the beat.
float2 pq = (px + float2(time * 0.1 * H, -time * 0.12 * H)) / (0.2 * H);
float2 pc = floor(pq);
float ph = hash2(pc + 31.0);
float pd = length(frac(pq) - 0.5 - (float2(hash2(pc + 5.0), hash2(pc + 9.0)) - 0.5) * 0.6) * 0.2 * H;
float tw = 0.5 + 0.5 * sin(time * (2.0 + 3.0 * ph) + ph * 30.0);
layer(acc, cover, lerp(colorC.rgb, float3(1, 1, 1), 0.5), smoothstep(max(0.8, 0.022 * H), 0.0, pd) * step(0.72, ph) * tw * (0.35 + 0.35 * level + 0.6 * beat));
// Small faint jellies far off, then the big ones close by, all drifting along.
jelly(acc, cover, px + float2(time * 0.07 * H, 0.0), 1.5 * H, 7.0, 0.6, 0.5, H, glow);
jelly(acc, cover, px + float2(time * 0.15 * H, 0.0), 2.3 * H, 5.0, 1.2, 1.0, H, glow);
return paint(acc / max(cover, 0.001), cover);
}