Laser Engraver
by MusicBar, progress bar
A violet laser fires down from above the taskbar and engraves glowing orange circuitry into brushed titanium as the song plays, spraying sparks onto the desktop.
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.
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 c88a9566835e5b312ecdf07a55aef1ef5bd9e593c2f563512f156293535f94e1
//! name: Laser Engraver
//! author: MusicBar
//! kind: progress
//! headroom: 120
//! description: Tia laser tím từ trên trời bắn xuống taskbar, khắc mạch điện cam rực lên thanh titan xước theo bài hát, tia lửa bắn tung lên màn hình nền
// A violet laser comes down out of the sky onto a strip of brushed titanium lying on the taskbar and engraves a
// circuit into it as the song plays. The traces behind the head are white-hot, cool to orange and keep glowing; data
// pulses run along them with the music. Sparks fly up onto the desktop, a burst on every beat, smoke curls up the
// beam and dust glints in it. The beam shows only a short way above the taskbar, fading in as if from far off. It
// asks for 120 DIPs of headroom; while that is hidden (a window there, a preview tile) headroom() is 0 and the beam
// comes in from the bar's top edge instead.
// Hash and noise follow docs/skin-art/toolbox.hlsl (Hash without Sine, Dave Hoskins, MIT); the drawing 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);
}
float fbm3(float2 p)
{
float s = 0.0, a = 0.5;
for (int k = 0; k < 3; k++) { s += a * vnoise(p); p = p * 2.03 + 17.1; a *= 0.5; }
return s;
}
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)); }
// A tone map that keeps the hue (orange stays orange, it doesn't slide to yellow as per-channel curves do); only
// the brightest light (the beam's core, the hot spot) goes to white.
float3 toneHue(float3 c)
{
float m = max(max(c.r, c.g), max(c.b, 1e-4));
float mt = 1.0 - exp(-1.15 * m);
float3 o = c * (mt / m);
return lerp(o, float3(mt, mt, mt), saturate((m - 1.6) / 2.4) * 0.85);
}
float sdBox(float2 p, float2 b) { float2 d = abs(p) - b; return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0); }
float sdSegment(float2 p, float2 a, float2 b) { float2 pa = p - a, ba = b - a; float h = saturate(dot(pa, ba) / max(dot(ba, ba), 1e-8)); return length(pa - ba * h); }
// Hot metal by temperature k: 0 a dull red-orange, 0.35 orange, 0.7 amber, 1 white-hot.
float3 heatRamp(float k)
{
k = saturate(k);
float3 c0 = float3(0.60, 0.13, 0.02);
float3 c1 = float3(1.00, 0.40, 0.05);
float3 c2 = float3(1.00, 0.68, 0.26);
float3 c3 = float3(1.00, 0.96, 0.88);
return k < 0.35 ? lerp(c0, c1, k / 0.35) : (k < 0.7 ? lerp(c1, c2, (k - 0.35) / 0.35) : lerp(c2, c3, (k - 0.7) / 0.3));
}
// Whether trace k of a bundle runs through cell j: in runs of two to three cells, a few gaps.
float traceOn(float j, float key, float k)
{
float run = floor((j + floor(hash11(key * 1.9) * 3.0)) / (2.0 + step(0.5, hash11(key * 4.1))));
return step(0.20 + 0.08 * k, hash12(float2(run, key)));
}
// One side's bundle of nT traces (side +1 above the groove, -1 below). Lanes counted from the groove out: lane n
// at yBase + side * n * pitch. Per cell the bundle sits in lanes 0..nT-1 or 1..nT and jogs between them at 45
// degrees, all together (they never cross). A trace can be missing for a run of cells; where it starts or stops it
// ends in a pad. A via sits in the lane the bundle leaves free. x: distance (px) to the nearest trace, y: to a pad
// ring, z: that trace's number, w: to a via ring.
float4 traces(float x, float y, float yBase, float side, float pitch, float cw, float seed, float nT)
{
float j = floor(x / cw);
float fx = x - j * cw;
float sPrev = step(0.5, hash11(j - 1.0 + seed));
float sCur = step(0.5, hash11(j + seed));
float jog = (0.12 + 0.30 * hash11(j * 3.7 + seed * 1.3)) * cw;
float ramp = saturate((fx - jog) / pitch);
float shift = lerp(sPrev, sCur, ramp);
float inRamp = step(jog, fx) * step(fx, jog + pitch) * abs(sCur - sPrev);
float corr = lerp(1.0, 0.7071, inRamp);
float dT = 1e4, dP = 1e4, id = 0.0;
float pr = 0.62 * pitch;
for (int k = 0; k < 5; k++)
{
float kk = k;
float key = kk * 7.13 + seed;
float real = step(kk + 0.5, nT);
float onC = traceOn(j, key, kk) * real;
float onL = traceOn(j - 1.0, key, kk) * real;
float onR = traceOn(j + 1.0, key, kk) * real;
float yk = yBase + side * (kk + shift) * pitch;
float d = onC > 0.5 ? abs(y - yk) * corr : 1e4;
if (d < dT) { dT = d; id = kk; }
float2 qL = float2(fx, y - (yBase + side * (kk + sPrev) * pitch));
float2 qR = float2(fx - cw, y - (yBase + side * (kk + sCur) * pitch));
float pL = abs(onC - onL) > 0.5 ? abs(length(qL) - pr) : 1e4;
float pR = abs(onC - onR) > 0.5 ? abs(length(qR) - pr) : 1e4;
dP = min(dP, min(pL, pR));
}
// the lane the bundle leaves free, after its jog: a short stub between two pads, or a via
float vLane = sCur > 0.5 ? 0.0 : nT;
float yv = yBase + side * vLane * pitch;
float pick = hash11(j * 9.7 + seed * 2.0);
float sa = (0.48 + 0.10 * hash11(j * 5.1 + seed)) * cw, sb = sa + (0.26 + 0.20 * hash11(j * 2.3 + seed)) * cw;
float dV = 1e4;
if (pick > 0.74)
{
float dS = abs(y - yv) + max(max(sa - fx, fx - sb), 0.0) * 4.0;
if (dS < dT) { dT = dS; id = 3.0; }
dP = min(dP, min(abs(length(float2(fx - sa, y - yv)) - pr), abs(length(float2(fx - sb, y - yv)) - pr)));
}
else if (pick > 0.50)
{
dV = abs(length(float2(fx - sa - 0.15 * cw, y - yv)) - 0.50 * pitch);
}
else if (pick > 0.34)
{
// a chip's row of pins: short upright bars
float pp = max(0.9 * pitch, 2.4);
float u = clamp(fx, sa, sb);
float pc = sa + (floor((u - sa) / pp) + 0.5) * pp;
float dPin = max(abs(fx - pc) - 0.20 * pitch, abs(y - yv) - 0.50 * pitch);
dPin = max(dPin, max(sa - fx, fx - sb));
if (dPin < dT) { dT = dPin; id = 2.0; }
}
return float4(dT, dP, id, dV);
}
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 top = H + room;
float s = H / 48.0;
float t = time;
float on = playing;
float age = beatAge();
float lv = lerp(0.25, 0.35 + 0.65 * level, on);
float kickB = exp(-age * 6.0) * on;
// ------------------------------------------------------------------ layout (px)
float y0 = 0.07 * H, y1 = 0.93 * H; // the titanium strip
float xL = 5.0 * s, xR = W - 5.0 * s;
float yg = 0.50 * H, gh = max(0.062 * H, 1.3); // the groove (the song's track)
float pitch = max(0.050 * H, 2.75);
float tw = max(0.017 * H, 0.95);
float gap = max(0.055 * H, 1.9);
float nL = clamp(floor((y1 - 1.6 * s - 1.0 - (yg + gh + gap)) / pitch) + 1.0, 2.0, 6.0); // lanes per side
float nT = nL - 1.0; // traces per bundle
float hx = lerp(xL + 16.0 * s, xR - 16.0 * s, saturate(progress));
float hy = yg;
float dx = hx - x; // > 0: engraved already
float2 q = float2(x - hx, y - hy);
float r = length(q);
float sv = up ? max(s, 0.75) : 0.28 * s; // how far sparks fly
float3 L = float3(0.0, 0.0, 0.0); // emitted light (HDR)
float smoke = 0.0;
float3 smokeC = float3(0.0, 0.0, 0.0);
// ------------------------------------------------------------------ the beam, from the sky down to the head
float bx = hx + 0.22 * s * sin(t * 41.0) * on;
float db = abs(x - bx);
// a short beam: full strength to ~20 DIPs over the taskbar, gone by ~80 (in units of the headroom asked for, so the
// gallery's taller clip keeps the same proportions)
float kr = room / 120.0;
float beamFade = 1.0 - smoothstep(H + 18.0 * kr, H + 80.0 * kr, y);
float beamMask = step(hy, y) * (up ? beamFade * beamFade : 1.0);
float pw = lerp(0.40, 1.0, on) * (0.85 + 0.30 * lv) * (1.0 + 0.55 * kickB);
float ripple = 0.86 + 0.14 * sin(y / (7.0 * s) + t * 46.0);
float flick = 0.93 + 0.07 * vnoise(float2(t * 31.0, 0.5));
float coreR = max(1.0, 1.35 * s + 0.35 * max(s - 1.0, 0.0)) * lerp(0.65, 1.0, on);
float core = exp(-(db * db) / (coreR * coreR));
float3 beamL = float3(1.00, 0.90, 1.00) * core * 3.2
+ float3(0.62, 0.20, 1.00) * exp(-db / (3.2 * s + 0.6)) * 1.25
+ float3(0.42, 0.12, 0.92) * exp(-db / (13.0 * s)) * 0.45
+ float3(0.26, 0.08, 0.62) * exp(-db / (46.0 * s)) * 0.11;
L += beamL * beamMask * pw * ripple * flick;
// dust in the air, glinting only inside the beam
if (up && y > H && db < 22.0 * s)
{
float cell = 7.0 * s;
float2 mp = float2(x - bx, y + t * 9.0 * s) / cell;
float2 mi = floor(mp);
float2 mr = hash22(mi + 3.7);
float2 md = (frac(mp) - 0.25 - 0.5 * mr) * cell;
float twinkle = 0.5 + 0.5 * sin(t * (5.0 + 6.0 * mr.x) + mr.y * 6.28);
float mote = exp(-dot(md, md) / (0.30 * s * s + 0.12)) * step(0.78, hash12(mi + 9.1)) * twinkle;
L += float3(0.90, 0.70, 1.0) * mote * exp(-db / (6.0 * s)) * 1.6 * beamMask * pw;
}
// ------------------------------------------------------------------ the hot spot where it lands
float hot = lerp(0.30, 1.0, on) * (0.80 + 0.30 * lv) * (1.0 + 0.9 * kickB);
L += float3(1.00, 0.97, 1.00) * exp(-(r * r) / (16.0 * s * s + 1.5)) * 4.0 * hot;
L += float3(1.00, 0.50, 0.24) * exp(-r / (7.0 * s + 0.5)) * 1.10 * hot;
L += float3(0.95, 0.40, 0.70) * exp(-r / (18.0 * s)) * 0.30 * hot;
L += float3(0.62, 0.26, 1.00) * exp(-r / (30.0 * s)) * 0.10 * hot;
L += float3(0.92, 0.66, 1.00) * exp(-abs(q.y) / (0.7 * s + 0.35)) * exp(-abs(q.x) / (80.0 * s)) * 0.60 * hot; // a flat streak
float ang = atan2(q.y, q.x);
float spin = floor(t * 18.0);
float rays = pow(abs(cos(ang * 3.0 + hash11(spin) * 3.0)), 70.0) + 0.7 * pow(abs(cos(ang * 5.0 + hash11(spin + 7.0) * 3.0)), 110.0);
L += float3(1.00, 0.80, 0.62) * rays * exp(-r / (9.0 * s)) * 1.6 * hot;
// a fine spray radiating from the hot spot: one spark per angle wedge, flying out, slowing, fading
float sprayR = (up ? 78.0 : 26.0) * s;
if (r < sprayR && r > 0.5)
{
float nb = 90.0;
float ab = (ang + 3.14159) / 6.28318 * nb;
float bi = floor(ab);
float fr = frac(ab) - 0.5;
float2 rb = hash22(float2(bi, 7.0));
float rate = 1.6 + 2.2 * rb.x;
float cyc = floor(t * rate + rb.y);
float ph = frac(t * rate + rb.y);
float alive = step(hash12(float2(bi, cyc)), 0.30 + 0.45 * lv) * on;
float reach = (0.30 + 0.70 * hash12(float2(cyc, bi + 3.0))) * sprayR;
float ease = 1.0 - (1.0 - ph) * (1.0 - ph);
float rs = ease * reach;
float len = (3.0 + 9.0 * (1.0 - ph)) * s;
float across = fr * (6.28318 / nb) * r;
float outA = max(max(r - rs, rs - len - r), 0.0);
float d = sqrt(across * across + outA * outA);
float w = 0.45 * max(s, 0.9);
float k = 1.0 - ph;
L += heatRamp(0.35 + 0.65 * k) * exp(-(d * d) / (w * w)) * k * alive * 2.2;
}
// ------------------------------------------------------------------ sparks: a steady spray and a burst on each beat
if (abs(q.x) < 300.0 * s && y > y0 - 2.0 && y < hy + 200.0 * s)
{
float2 o = float2(hx, hy);
float g = 640.0 * sv;
for (int i = 0; i < 40; i++)
{
float fi = i;
float life = 0.40 + 0.55 * hash11(fi * 1.31 + 0.2);
float tt = t + hash11(fi * 7.77) * life;
float cyc = floor(tt / life);
float a = frac(tt / life) * life;
float2 rnd = hash22(float2(fi, cyc));
float alive = step(hash12(float2(fi * 3.1, cyc + 0.5)), 0.35 + 0.55 * lv) * on;
float th = 1.5708 + (rnd.x - 0.5) * 2.7;
float spd = (70.0 + 250.0 * rnd.y * rnd.y) * sv;
float2 v = float2(cos(th), sin(th)) * spd;
float a0 = max(a - 0.040, 0.0);
float2 p1 = o + v * a - float2(0.0, 0.5 * g * a * a);
float2 p0 = o + v * a0 - float2(0.0, 0.5 * g * a0 * a0);
float d = sdSegment(float2(x, y), p0, p1);
float dh = length(float2(x, y) - p1);
float k = 1.0 - a / life;
float w = 0.55 * max(s, 0.85);
float headF = exp(-dh / (4.0 * s));
float spark = exp(-(d * d) / (w * w)) * (0.25 + 0.75 * headF) + exp(-dh / (2.0 * s)) * 0.22;
L += heatRamp(0.15 + 0.65 * k + 0.3 * headF) * spark * k * alive * 2.6 * step(y0, p1.y);
}
float bid = floor((t - age) * 3.0);
for (int b = 0; b < 26; b++)
{
float fb = b;
float2 rnd = hash22(float2(fb * 1.7 + 0.3, bid));
float life = 0.55 + 0.45 * hash11(fb + bid * 3.3);
float a = age;
float th = 1.5708 + (rnd.x - 0.5) * 2.9;
float spd = (120.0 + 240.0 * rnd.y) * sv;
float2 v = float2(cos(th), sin(th)) * spd;
float a0 = max(a - 0.035, 0.0);
float2 p1 = o + v * a - float2(0.0, 0.5 * g * a * a);
float2 p0 = o + v * a0 - float2(0.0, 0.5 * g * a0 * a0);
float d = sdSegment(float2(x, y), p0, p1);
float dh = length(float2(x, y) - p1);
float k = saturate(1.0 - a / life);
float w = 0.60 * max(s, 0.85);
float headF = exp(-dh / (4.5 * s));
float spark = exp(-(d * d) / (w * w)) * (0.25 + 0.75 * headF) + exp(-dh / (2.2 * s)) * 0.24;
L += heatRamp(0.20 + 0.65 * k + 0.3 * headF) * spark * k * on * 3.0 * step(y0, p1.y) * step(0.25, rnd.y + 0.3 * level);
}
}
// ------------------------------------------------------------------ smoke curling up the beam, drifting back
float hs = y - hy;
if (hs > 0.0 && abs(q.x) < 160.0 * s)
{
float drift = -hs * 0.30 - 5.0 * s * sin(hs / (26.0 * s) - t * 1.2);
float wpl = (2.5 + 0.20 * hs / s) * s;
float xs = x - hx - drift;
float m = exp(-(xs * xs) / (wpl * wpl)) * (1.0 - exp(-hs / (5.0 * s))) * exp(-hs / (95.0 * s));
float n = fbm3(float2(xs / (9.0 * s), hs / (13.0 * s) - t * 1.15));
smoke = saturate(m * (n * 2.2 - 0.40)) * lerp(0.35, 1.0, on) * (0.60 + 0.40 * lv);
float litS = exp(-abs(x - bx) / (9.0 * s));
smokeC = lerp(float3(0.36, 0.35, 0.40), float3(0.80, 0.55, 1.00), litS * 0.85);
smokeC += float3(0.40, 0.18, 0.06) * exp(-hs / (16.0 * s)); // lit orange from below
smoke *= up ? 0.70 : 0.30;
}
// ------------------------------------------------------------------ the titanium strip
float2 pc = float2(0.5 * (xL + xR), 0.5 * (y0 + y1));
float2 ph = float2(0.5 * (xR - xL), 0.5 * (y1 - y0));
float rr = 3.0 * s;
float dPlate = sdBox(float2(x, y) - pc, ph - rr) - rr;
float inPlate = fill(dPlate, 1.0);
float3 metal = float3(0.0, 0.0, 0.0);
if (dPlate < 2.0)
{
float v = saturate((y - y0) / (y1 - y0));
float br = vnoise(float2(x / (80.0 * s), y / (0.50 * s))) * 0.55 + vnoise(float2(x / (16.0 * s) + 7.0, y / (0.33 * s))) * 0.45;
metal = lerp(float3(0.150, 0.160, 0.185), float3(0.245, 0.260, 0.295), 0.25 + 0.75 * v) * (0.82 + 0.36 * br);
// light: violet from the beam spreading along the grain, warm close to the hot spot; darker far from it
float lx = exp(-abs(dx) / (170.0 * s));
float ln = exp(-abs(dx) / (34.0 * s));
metal *= lerp(0.70, 1.0, exp(-abs(dx) / (420.0 * s)));
metal += float3(0.08, 0.055, 0.13) * lx * (0.40 + 0.60 * br) * hot;
metal += float3(0.30, 0.16, 0.10) * ln * (0.55 + 0.45 * br) * hot;
// HUD marks scribed on the plate: crosses, ruler ticks, a barcode at the far end (they fade where engraved)
float cellX = 230.0 * s;
float cxp = (floor(x / cellX) + 0.5) * cellX + 31.0 * s;
float cyA = y0 + 0.20 * (y1 - y0), cyB = y1 - 0.20 * (y1 - y0);
float yCross = abs(y - cyA) < abs(y - cyB) ? cyA : cyB;
float arm = 3.6 * s + 1.0;
float crossD = min(max(abs(x - cxp) - 0.25, abs(y - yCross) - arm), max(abs(y - yCross) - 0.25, abs(x - cxp) - arm));
float tick = step(frac(x / (12.0 * s)), 0.09) * step(y, y0 + 1.4 * s + 1.0) * step(y0 + 0.6, y);
float bigTick = step(frac(x / (60.0 * s)), 0.02) * step(y, y0 + 3.2 * s + 1.0) * step(y0 + 0.6, y);
float bc = step(xR - 74.0 * s, x) * step(x, xR - 22.0 * s) * step(y1 - 0.34 * (y1 - y0), y) * step(y, y1 - 0.12 * (y1 - y0));
float bars = step(0.48, hash11(floor(x / max(1.1 * s, 1.0)) * 1.7)) * bc;
float marks = max(max(fill(crossD, 1.0) * 0.55, max(tick, bigTick) * 0.35), bars * 0.40);
float notYet = smoothstep(-6.0, 6.0, -dx);
metal = lerp(metal, float3(0.55, 0.57, 0.62), marks * lerp(0.25, 1.0, notYet));
// the groove: a dark cut, its far wall catching light
float dg = abs(y - yg) - gh;
float inG = fill(dg, 1.0);
float3 grooveC = float3(0.020, 0.021, 0.026) + float3(0.05, 0.05, 0.06) * saturate((yg + gh - y) / (2.0 * gh)) * 0.6;
metal = lerp(metal, grooveC, inG);
metal += float3(0.20, 0.21, 0.24) * fill(abs(y - (yg - gh - 0.55)) - 0.35, 1.0);
metal *= 1.0 - 0.45 * fill(abs(y - (yg + gh + 0.6)) - 0.4, 1.0);
// the rim: a dark edge, a bright top lip, a dark bottom lip
float edgeIn = -dPlate;
metal += float3(0.24, 0.25, 0.28) * fill(abs(edgeIn - 1.6) - 0.45, 1.0) * smoothstep(pc.y - ph.y * 0.2, pc.y + ph.y * 0.6, y);
metal = lerp(metal, float3(0.035, 0.036, 0.042), fill(edgeIn - 1.0, 1.0));
// the bar's ends fade
metal *= 0.80 + 0.20 * smoothstep(0.0, 0.10, uv.x) * (1.0 - smoothstep(0.90, 1.0, uv.x));
}
// ------------------------------------------------------------------ the circuit and the track, engraved behind the head
if (y > y0 - 4.0 && y < y1 + 4.0)
{
float4 tu = traces(x, y, yg + gh + gap, 1.0, pitch, 10.0 * pitch, 3.0, nT);
float4 td = traces(x + 37.0 * s, y, yg - gh - gap, -1.0, pitch, 8.5 * pitch, 11.0, nT);
bool upper = y > yg;
float dT = upper ? tu.x : td.x;
float dP = upper ? tu.y : td.y;
float dV = upper ? tu.w : td.w;
float id = upper ? tu.z : td.z;
float trc = fill(dT - 0.5 * tw, 1.0);
float pad = fill(dP - 0.5 * tw, 1.0);
float via = fill(dV - 0.42 * tw, 1.0);
float cut = max(trc, max(pad, via * 0.85));
float halo = exp(-max(min(dT, dP) - 0.5 * tw, 0.0) / (1.0 * s + 0.45));
// the molten edge where the beam is cutting now: a little ragged and alive
float jag = (hash12(float2(floor(y / max(s, 0.7)), floor(t * 24.0))) - 0.5) * 2.2 * s;
float eng = smoothstep(-0.6, 0.6, dx + jag);
float since = max(dx, 0.0);
float kHeat = exp(-since / (55.0 * s)) * lerp(0.45, 1.0, on);
float band = upper ? 0.46 + 0.16 * id : 0.04 + 0.13 * id;
float spB = spectrum(band);
float phase = frac(x / (95.0 * s) - t * 0.50 + id * 0.31 + (upper ? 0.5 : 0.0));
float packet = smoothstep(0.62, 0.97, phase) * (1.0 - smoothstep(0.97, 1.0, phase));
float glowAmt = (0.95 + 2.6 * kHeat) * (0.80 + 0.25 * lv) + packet * (0.15 + 1.9 * spB) * on;
// rare: a surge runs back through the whole circuit from the head every 41 s
float sg = frac(t / 41.0) * 41.0;
float xsur = hx - (sg / 1.4) * (hx - xL);
float surge = exp(-abs(x - xsur) / (28.0 * s)) * step(sg, 1.4);
float3 heatC = heatRamp(0.50 + 0.50 * kHeat + 0.25 * packet * spB);
L += heatC * (cut * 1.55 + halo * 0.30) * glowAmt * eng;
L += float3(1.0, 0.92, 0.75) * (cut + halo * 0.5) * surge * 2.2 * eng;
metal *= 1.0 - 0.55 * fill(min(dT, dP) - 0.5 * tw - 0.9, 1.0) * eng; // the cut's dark lips
// the track: molten in the groove behind the head, with a soft spill onto the metal
float played = smoothstep(-0.5, 0.5, dx) * step(xL + 8.0 * s, x + 0.0);
float dl = abs(y - yg);
float lineK = exp(-since / (70.0 * s));
float3 lineC = heatRamp(0.48 + 0.52 * lineK);
float tube = saturate(1.0 - dl / max(0.55 * gh, 0.6));
L += lineC * fill(dl - 0.55 * gh, 1.0) * (0.75 + 0.75 * tube * tube) * (1.25 + 2.2 * lineK) * played;
L += lineC * exp(-max(dl - 0.55 * gh, 0.0) / (2.4 * s + 0.6)) * 0.50 * played;
L += float3(1.0, 0.92, 0.75) * fill(dl - 0.55 * gh, 1.0) * surge * 2.0 * played;
}
// ------------------------------------------------------------------ put together
// nothing is cut off by the headroom's top edge: light and smoke fade out before it
float edgeFade = up ? 1.0 - smoothstep(top - 0.30 * room, top, y) : 1.0;
L *= edgeFade;
smoke *= edgeFade;
float3 lightD = toneHue(L);
float3 rgb = metal * inPlate + lightD;
float alpha = max(inPlate, max(lightD.r, max(lightD.g, lightD.b)));
// a soft shadow under the strip on the taskbar
float shadowA = exp(-max(dPlate, 0.0) / (2.2 * s)) * 0.40 * (1.0 - inPlate) * step(y, H);
alpha = max(alpha, shadowA);
// smoke over everything
rgb = lerp(rgb, smokeC, smoke);
alpha = max(alpha, smoke);
rgb += (hash12(uv * size + frac(t * 7.13) * 91.7) - 0.5) * 0.010;
float a = saturate(max(alpha, max(rgb.r, max(rgb.g, rgb.b))));
return paint(saturate(rgb) / max(a, 1e-3), a);
}