Iridescent Liquid Chrome

by MusicBar, progress bar

Iridescent mercury flows smoothly along a glass groove up to the playhead, thinning to a single chrome thread ahead, with chrome droplets leaping off the taskbar.

Needs MusicBar 2.0 or newer: this skin uses what older versions don't have (drawing above the taskbar, animations that come with it). Older versions don't list it; update the app to get it.

23 downloads Download file, 15.1 KB
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 774e54f8f4959e9cc1ce88b95b9bb4d7b565ea622bfa7e42545434ff4d93e81d

//! name: Iridescent Liquid Chrome
//! author: MusicBar
//! kind: progress
//! headroom: 90
//! description: Dòng thủy ngân ngũ sắc chảy mượt trong rãnh kính mờ tới chỗ đang phát, phía trước chỉ còn sợi chrome mảnh, giọt chrome bắn lên khỏi taskbar

// A stream of liquid chrome in a frosted-glass channel, its surface holographic. Behind the play head it runs thick,
// rolling and folding as it flows; ahead of it only a thin dark thread. At the head a crest rises and now and then
// flings chrome beads up over the taskbar (more on the beat).
// Everything on the surface flows to the right at one speed, so reflections slide smoothly along it. The surface is a
// tube profile across the stream, long rolling swells, and gradient noise with a quintic fade (smooth second
// derivatives: no grid creases in the highlights); it is lit as a mirror of a studio of soft light strips, a key light
// for crisp highlights, a Fresnel rim, darker folds, and a pale thin-film rainbow in drifting patches.
// Hash follows docs/skin-art/toolbox.hlsl (Hash without Sine, Dave Hoskins, MIT); the rest is original.

float hash11(float p) { p = frac(p * 0.1031); p *= p + 33.33; p *= p + p; return frac(p); }
float hash12(float2 p) { float3 q = frac(p.xyx * 0.1031); q += dot(q, q.yzx + 33.33); return frac((q.x + q.y) * q.z); }
float2 hash22(float2 p) { float3 q = frac(p.xyx * float3(0.1031, 0.1030, 0.0973)); q += dot(q, q.yzx + 33.33); return frac((q.xx + q.yz) * q.zy); }
float vnoise(float2 p)
{
    float2 i = floor(p), f = frac(p);
    float2 u = f * f * (3.0 - 2.0 * f);
    float a = hash12(i), b = hash12(i + float2(1.0, 0.0)), c = hash12(i + float2(0.0, 1.0)), d = hash12(i + 1.0);
    return lerp(lerp(a, b, u.x), lerp(c, d, u.x), u.y);
}
// Gradient noise with its gradient, quintic fade: x the value (about -0.7..0.7), yz d/dp.
float3 gnoiseD(float2 p)
{
    float2 i = floor(p), f = frac(p);
    float2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
    float2 du = 30.0 * f * f * (f * (f - 2.0) + 1.0);
    float2 ga = hash22(i) * 2.0 - 1.0;
    float2 gb = hash22(i + float2(1.0, 0.0)) * 2.0 - 1.0;
    float2 gc = hash22(i + float2(0.0, 1.0)) * 2.0 - 1.0;
    float2 gd = hash22(i + float2(1.0, 1.0)) * 2.0 - 1.0;
    float va = dot(ga, f), vb = dot(gb, f - float2(1.0, 0.0)), vc = dot(gc, f - float2(0.0, 1.0)), vd = dot(gd, f - float2(1.0, 1.0));
    float k = va - vb - vc + vd;
    float v = va + u.x * (vb - va) + u.y * (vc - va) + u.x * u.y * k;
    float2 g = ga + u.x * (gb - ga) + u.y * (gc - ga) + u.x * u.y * (ga - gb - gc + gd) + du * (u.yx * k + float2(vb - va, vc - va));
    return float3(v, g);
}
float fill(float d, float w) { return saturate(0.5 - d / w); }
float beatAge() { return -0.12 * log(max(beat, 1e-4)); }
float luma(float3 c) { return dot(c, float3(0.299, 0.587, 0.114)); }

// The studio the chrome mirrors (r: the reflected direction, y up the screen, z toward the viewer): a grey room darker
// below, soft light strips all round (each swell turns through several: the banded contours of mercury), a narrow
// panel overhead, a light behind the viewer, faint cyan and magenta strips at the sides.
float3 studio(float3 r)
{
    float up = r.y;
    // a bright silver room (the mockup's chrome sits mostly at 0.55 to 0.9), a little brighter above
    float3 c = lerp(float3(0.46, 0.47, 0.51), float3(0.70, 0.71, 0.75), saturate(up * 0.5 + 0.55));
    // narrow dark gaps and soft bright strips going round it: each strand turns through them, drawing the contours
    float ph = up * 7.0 + r.x * 1.8;
    float darkB = 0.5 + 0.5 * cos(ph + 3.14159);
    float d2 = darkB * darkB, d4 = d2 * d2;
    c *= 1.0 - 0.72 * d4 * d4;
    float lightB = 0.5 + 0.5 * cos(ph);
    c += float3(0.30, 0.31, 0.33) * lightB * lightB * lightB * lightB;
    c += float3(0.25, 0.25, 0.27) * smoothstep(0.80, 0.97, up);
    c += float3(0.12, 0.12, 0.14) * pow(saturate(r.z), 4.0);
    c *= 0.88 + 0.12 * smoothstep(-0.95, -0.35, up);
    c += float3(0.20, 0.55, 0.62) * exp(-(r.x + 0.70) * (r.x + 0.70) / 0.04) * 0.14;
    c += float3(0.60, 0.25, 0.58) * exp(-(r.x - 0.70) * (r.x - 0.70) / 0.04) * 0.10;
    return c;
}

// Thin-film colour: the pale rainbow an oil film gives, by its phase (cyan, lavender, pink, peach, mint: never olive).
float3 film(float f) { return 0.62 + 0.38 * cos(6.2831853 * (f + float3(0.0, 0.33, 0.67))); }

// Chrome with normal n: the studio mirrored, a key light's crisp highlight, a Fresnel rim, the folds (ao) darker, then a
// pale thin-film tint on the mid tones in fringes along the contours. irid: how holographic; phase: where in the
// rainbow; dim: darker for the thin thread.
float3 chrome(float3 n, float irid, float phase, float dim, float ao)
{
    float3 r = float3(2.0 * n.z * n.x, 2.0 * n.z * n.y, 2.0 * n.z * n.z - 1.0);
    float3 c = studio(r) * dim * ao;
    float3 kl = normalize(float3(-0.35, 0.80, 0.50));
    float nh = saturate(dot(n, normalize(kl + float3(0.0, 0.0, 1.0))));
    float nh2 = nh * nh, nh4 = nh2 * nh2, nh16 = nh4 * nh4 * nh4 * nh4;
    c += float3(1.00, 1.00, 1.00) * (nh16 * nh16 * nh16 * 1.10 + nh16 * 0.18) * dim;
    float rim = 1.0 - saturate(n.z);
    c += float3(0.55, 0.58, 0.66) * rim * rim * rim * 0.35 * dim;
    // a pastel rainbow on the bright faces (like light on an oil film), fringes along the contours; the dark folds stay
    // neutral grey, never neon
    float l = luma(c);
    float ph = r.y * 7.0 + r.x * 1.8;
    float lb = 0.5 + 0.5 * cos(ph);
    float fringe = 4.0 * lb * (1.0 - lb);                                       // strongest between a light and a gap
    float k = irid * smoothstep(0.25, 0.60, l) * (0.30 + 0.70 * fringe);
    float f = phase + 1.3 * r.y + 0.7 * (1.0 - n.z);
    float3 fc = film(f);
    c = lerp(c, lerp(c, l * fc * 1.25, 0.70) + (fc - 0.62) * 0.10, k);
    return c / (1.0 + 0.22 * c);                                                // highlights roll off, never flat white
}

float4 main(float2 uv : TEXCOORD) : COLOR
{
    float W = size.x, H = size.y;
    float room = headroom();                                  // on screen above the taskbar now (0: hidden)
    bool up = room > 1.0;
    float x = uv.x * W, y = rise(uv) * H;                     // px; y > H in the headroom
    float s = H / 48.0;
    float t = time;
    float on = playing;
    float age = beatAge();
    float kickB = exp(-age * 4.5) * on;

    // ------------------------------------------------------------------ the glass channel
    float xL = 4.0 * s, xR = W - 4.0 * s, y0 = 0.06 * H, y1 = 0.94 * H;
    float rr = 0.24 * H;
    float2 cen = float2(0.5 * (xL + xR), 0.5 * (y0 + y1));
    float dGlass = length(max(abs(float2(x, y) - cen) - float2(0.5 * (xR - xL), 0.5 * (y1 - y0)) + rr, 0.0)) - rr;
    float inGlass = fill(dGlass, 1.0);
    float3 col = float3(0.0, 0.0, 0.0);
    float cover = 0.0;
    float3 L = float3(0.0, 0.0, 0.0);
    if (dGlass < 2.0)
    {
        // dark frosted glass: a faint vertical sheen, grain, a light rim on top, the channel a shade darker
        float vg = saturate((y - y0) / (y1 - y0));
        float3 g = lerp(float3(0.050, 0.055, 0.062), float3(0.085, 0.090, 0.100), vg);
        g *= 0.95 + 0.10 * vnoise(float2(x / (3.0 * s), y / (3.0 * s)));
        float dIn = -dGlass;
        g += float3(0.30, 0.32, 0.36) * fill(abs(dIn - 1.2) - 0.5, 1.0) * smoothstep(0.3, 0.9, vg) * 0.6;
        g = lerp(g, float3(0.025, 0.027, 0.032), smoothstep(0.08 * H, 0.12 * H, dIn) * 0.55);
        col = g;
        cover = inGlass * 0.92;
    }

    // ------------------------------------------------------------------ the stream
    // it flows right at one speed: the surface pattern, its edges and its bends all ride on xf
    float speed = 0.32 * H * lerp(0.35, 1.0, on);
    float xf = x - t * speed;
    float xs = lerp(xL + 1.0 * H, xR - 0.9 * H, saturate(progress));          // the play head
    float behind = 1.0 - smoothstep(xs - 0.9 * H, xs + 0.5 * H, x);
    float th = lerp(0.050, 0.285, behind) * H;
    // the stream bends gently, the bends travelling with it
    float yc = 0.50 * H + 0.070 * H * sin(xf / (1.10 * H)) + 0.030 * H * sin(xf / (0.47 * H) + 1.7);
    float dycdx = 0.070 / 1.10 * cos(xf / (1.10 * H)) + 0.030 / 0.47 * cos(xf / (0.47 * H) + 1.7);
    // soft, wavy edges, travelling with it
    float e1 = gnoiseD(float2(xf / (0.75 * H), 1.3)).x;
    float e2 = gnoiseD(float2(xf / (0.75 * H), 7.9)).x;
    float topE = th * (1.0 + 0.55 * e1);
    float botE = min(th * (1.0 + 0.55 * e2), yc - 0.10 * H);
    // the crest at the head: a swell leaning forward, a little higher on the beat; it rises over the taskbar
    float cx = (x - xs) / (0.50 * H);
    float lean = cx < 0.0 ? cx * 0.70 : cx * 1.45;
    float crest = (0.22 + 0.10 * sin(t * 1.7) + 0.35 * kickB) * H * exp(-lean * lean) * (up ? 1.0 : 0.35);
    topE += crest;
    float dy = y - yc;
    float inside = min(topE - dy, dy + botE);                 // > 0 inside (px to the nearer edge)
    // it starts in the channel with a rounded end
    float2 endC = float2(xL + 0.30 * H + 0.5 * (topE + botE), yc + 0.5 * (topE - botE));
    float endD = 0.5 * (topE + botE) - length(float2(min(x - endC.x, 0.0), (y - endC.y) * 0.9));
    inside = min(inside, endD);
    float cS = fill(-inside, 1.0);
    if (inside > -6.0 * s && dGlass < 0.5 * room + 2.0)
    {
        float ext = dy > 0.0 ? topE : botE;
        float u = clamp(dy / max(ext, 0.5), -0.999, 0.999);
        float rad = sqrt(1.0 - u * u);
        float thick = 0.5 * (topE + botE);
        // the tube across the stream (flattened: a ribbon of liquid, not a pipe)
        float dzdy = -u / rad * thick / max(ext, 0.5) * 0.45;
        // the strands, as in the mockup: two families of rounded ridges running along the flow, each wavering up and
        // down on its own slow curve; where they cross they weave into long eye shapes. Their wobble rides on the
        // flow (xf), warped a little by smooth noise so it never repeats.
        // across the stream the strands keep their count: where it swells (the crest) they spread out with it
        float sq = th / max(0.5 * (topE + botE), 1.0);
        float dys = dy * sq;
        float3 n1 = gnoiseD(float2(xf / (1.40 * H), dys / (0.40 * H)));
        float p1 = max(0.20 * H, 6.5), p2 = max(0.27 * H, 8.0);
        float a1 = 0.22 * H, a2 = 0.17 * H;
        float L1 = 1.15 * H, L2 = 0.80 * H;
        float s1 = sin(xf / L1), s2 = sin(xf / L2 + 2.4);
        float w1 = (dys + a1 * s1) / p1 + 0.30 * n1.x;
        float w2 = (dys - a2 * s2) / p2 - 0.25 * n1.x + 0.37;
        float dw1x = a1 * cos(xf / L1) / L1 / p1 + 0.30 * n1.y / (1.40 * H);
        float dw1y = (1.0 / p1 + 0.30 * n1.z / (0.40 * H)) * sq;
        float dw2x = -a2 * cos(xf / L2 + 2.4) / L2 / p2 - 0.25 * n1.y / (1.40 * H);
        float dw2y = (1.0 / p2 - 0.25 * n1.z / (0.40 * H)) * sq;
        float c1 = cos(6.2831853 * w1), c2 = cos(6.2831853 * w2);
        float sn1 = sin(6.2831853 * w1), sn2 = sin(6.2831853 * w2);
        // height of the weave and its slope (px of height per px), a little less near the edges and ahead of the head
        // the crest is one smooth swell (stacked strands on it read as zebra stripes); a low taskbar gets calmer strands
        float crestF = crest / (crest + th + 1.0);
        float wA = lerp(0.35, 1.0, behind) * (0.45 + 0.55 * rad) * (1.0 - 0.50 * crestF) * lerp(0.70, 1.0, saturate((H - 32.0) / 30.0));
        float k1 = 0.125 * p1 * wA, k2 = 0.100 * p2 * wA;
        float hgt = (c1 * k1 + c2 * k2) / (k1 + k2 + 1e-3);
        float2 gW = -6.2831853 * (k1 * sn1 * float2(dw1x, dw1y) + k2 * sn2 * float2(dw2x, dw2y));
        float2 grad = float2(-dycdx * dzdy, dzdy) + gW;
        float3 n = normalize(float3(-grad, 1.0));
        float n2x = n1.x;
        // the valleys between strands a little darker
        float ao = 0.84 + 0.16 * saturate(hgt * 0.5 + 0.5);
        float patch = smoothstep(0.30, 0.68, vnoise(float2(xf / (2.4 * H), dys / (0.5 * H) + 4.0)));
        float irid = lerp(0.15, 0.85, behind) * (0.15 + 0.85 * patch);
        float phase = 0.35 * n2x + 0.15 * sin(xf / (2.3 * H));
        float dim = lerp(0.42, 1.00, behind);
        float3 cc = chrome(n, irid, phase, dim, ao);
        cc *= 0.60 + 0.40 * smoothstep(0.0, 0.22, rad);                            // a dark line where it turns away
        col = lerp(col, cc, cS);
        cover = max(cover, cS);
        // its light on the glass round it: a soft holographic glow; a shadow under it
        float outD = max(-inside, 0.0);
        float3 avg = film(phase + 0.3) * 0.5 + 0.35;
        L += avg * exp(-outD / (0.10 * H)) * (1.0 - cS) * 0.10 * lerp(0.4, 1.0, behind) * inGlass;
        col *= 1.0 - 0.45 * exp(-outD / (0.06 * H)) * step(dy, 0.0) * (1.0 - cS);
    }

    // ------------------------------------------------------------------ beads flung off the crest
    {
        float sv = up ? max(s, 0.75) : 0.30 * s;
        float g = 520.0 * sv;
        float2 o = float2(xs + 0.15 * H, yc + th + 0.20 * H * (up ? 1.0 : 0.35));
        float bid = floor((t - age) * 3.0);
        for (int i = 0; i < 10; i++)
        {
            float fi = i;
            // a few spit on their own clock all the time; on a beat a small burst
            float per = 1.1 + 0.7 * hash11(fi * 3.3);
            float a = frac(t / per + hash11(fi)) * per;
            float2 rnd = hash22(float2(fi * 2.7, floor(t / per + hash11(fi))));
            float live = on * step(0.45, rnd.y);
            if (fi > 5.5)
            {
                a = age;
                rnd = hash22(float2(fi * 1.9 + 0.5, bid));
                live = on * step(0.35, rnd.y);
            }
            float th2 = 1.5708 + (rnd.x - 0.5) * 1.5;
            float spd = (80.0 + 150.0 * rnd.y) * sv;
            float2 v = float2(cos(th2), sin(th2)) * spd + float2(35.0 * sv, 0.0);
            float2 pos = o + float2(0.20 * H * (rnd.x - 0.5), 0.0) + v * a - float2(0.0, 0.5 * g * a * a);
            float2 vel = v - float2(0.0, g * a);
            float rb = max((0.035 + 0.050 * hash11(fi * 5.1 + bid)) * H, 1.3);
            float2 dir = normalize(vel + float2(1e-3, 0.0));
            float stretch = 1.0 + saturate(length(vel) / (400.0 * sv)) * 0.8;
            float2 d = float2(x, y) - pos;
            float2 lq = float2(dot(d, dir) / stretch, dot(d, float2(-dir.y, dir.x))) / rb;
            float lr = length(lq);
            float cb = fill((lr - 1.0) * rb, 1.0) * live * step(a, 1.6) * step(yc + 0.2 * H, pos.y + rb);
            if (cb > 0.001)
            {
                float zb = sqrt(saturate(1.0 - lr * lr));
                float3 nb = normalize(float3(lq.y * -dir.y + lq.x * dir.x, lq.x * dir.y + lq.y * dir.x, zb + 0.05));
                float3 bc = chrome(nb, 0.8, rnd.x * 2.0 + t * 0.05, 1.0, 1.0);
                col = lerp(col, bc, cb);
                cover = max(cover, cb);
            }
        }
    }

    // ------------------------------------------------------------------ put together
    float3 lightD = L / (1.0 + L);
    float3 rgb = col + lightD;
    float alpha = max(cover, max(lightD.r, max(lightD.g, lightD.b)));
    float shadowA = exp(-max(dGlass, 0.0) / (2.0 * s)) * 0.35 * (1.0 - inGlass) * step(y, H + 0.5);
    alpha = max(alpha, shadowA);
    rgb += (hash12(uv * size + frac(t * 7.13) * 91.7) - 0.5) * 0.008;
    float aa = saturate(max(alpha, max(rgb.r, max(rgb.g, rgb.b))));
    return paint(saturate(rgb) / max(aa, 1e-3), aa);
}