Penguin Slide
của MusicBar, thanh tiến trình
Chú chim cánh cụt quàng khăn len trượt bụng trên băng tới chỗ đang phát, dang cánh giữ thăng bằng, để lại vệt xước với bụi lấp lánh phía sau giữa tuyết bay, tới nhịp là vọt lên một cái tung bọt băng.
Cách cài, mã SHA-256 và mã nguồn
Bấm Áp dụng: MusicBar tự tải về, kiểm tra mã SHA-256 rồi mặc lên taskbar; có rồi thì mặc luôn. Cần MusicBar 1.8 trở lên.
SHA-256 acb5eb006f378bf0d3c37b10a6b4ceb6bbff973978d4310c63276947028abc25
//! name: Penguin Slide
//! author: MusicBar
//! kind: progress
//! description: A little penguin in a knitted scarf belly-slides across the ice to the playhead with its flippers out, leaving scratch marks and a sparkle trail in the snow flurries, and shoots ahead in a spray of ice on every beat.
float hash1(float n) { return frac(sin(n * 127.1 + 311.7) * 43758.5453); }
float hash2(float2 p) { return frac(sin(dot(p, float2(127.1, 311.7))) * 43758.5453); }
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); }
// Signed distance to an ellipse with radii r (close enough near the edge).
float ellipse(float2 p, float2 r) { float k0 = length(p / r); return k0 * (k0 - 1.0) / max(length(p / (r * r)), 0.0001); }
float smin(float a, float b, float k) { float h = saturate(0.5 + 0.5 * (b - a) / k); return lerp(b, a, h) - k * h * (1.0 - h); }
// A four-point twinkle: a bright core with a cross of rays.
float twinkle(float2 d, float r) { d = abs(d) / r; return exp(-length(d) * 2.5) + exp(-d.x * 0.9 - d.y * 7.0) + exp(-d.y * 0.9 - d.x * 7.0); }
// 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);
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
float u = size.y;
float2 p = float2(uv.x * size.x, (1.0 - uv.y) * u) / u; // bar heights, up the screen so the penguin stays upright
float hx = progress * size.x / u;
float aa = 1.0 / u;
float back = hx - p.x;
float iceY = 0.1; // the ice surface
float3 acc = float3(0, 0, 0);
float cover = 0;
float3 iceC = lerp(float3(0.75, 0.93, 1.0), colorB.rgb, 0.35);
// Snow flurries drifting down over the whole bar, a little thicker when the song is loud.
float2 sp = p + float2(time * 0.15, time * 0.3);
float2 sc = floor(sp / 0.26);
float sh = hash2(sc);
float2 so = (float2(hash2(sc + 3.1), hash2(sc + 7.7)) - 0.5) * 0.14 + float2(0.03 * sin(time * 2.0 + sh * 30.0), 0.0);
float fr = 0.014 + 0.012 * hash2(sc + 1.7);
float flake = smoothstep(fr + aa, fr - aa, length(frac(sp / 0.26) * 0.26 - 0.13 - so));
layer(acc, cover, float3(0.92, 0.96, 1.0), flake * step(sh, 0.1 + 0.2 * level) * 0.5);
// The ice: a glassy sheet over the played part, only a faint line ahead.
float played = smoothstep(-0.3, 0.1, back);
float ice = smoothstep(aa, -aa, p.y - iceY);
float3 sheet = lerp(iceC * 0.45, iceC, smoothstep(0.0, iceY, p.y)) + 0.35 * smoothstep(0.02, 0.0, iceY - p.y);
layer(acc, cover, sheet, ice * lerp(0.15, 0.6, played) * lerp(1.0, 0.6, saturate(back / 30.0)));
layer(acc, cover, lerp(colorB.rgb, float3(0.1, 0.35, 0.6), 0.5), smoothstep(1.5 * aa, 0.5 * aa, abs(p.y - iceY + 0.5 * aa)) * lerp(0.15, 0.55, played));
// Scratch marks the belly left: two long grooves and broken dashes, fading far back.
float row = floor(p.y / 0.022);
float cx = p.x / 0.7 + hash1(row * 3.3) * 7.0;
float ch = hash2(float2(floor(cx), row));
float dash = step(0.45, ch) * step(abs(frac(cx) - 0.3 - 0.4 * frac(ch * 3.0)), 0.08 + 0.35 * frac(ch * 7.0));
float groove = smoothstep(1.2 * aa, 0.2 * aa, abs(p.y - 0.055)) + smoothstep(1.2 * aa, 0.2 * aa, abs(p.y - 0.075 - 0.004 * sin(p.x * 3.0)));
float scratch = max(groove, dash * smoothstep(1.0 * aa, 0.0, abs(frac(p.y / 0.022) - 0.5) * 0.022)) * ice;
layer(acc, cover, float3(1, 1, 1), scratch * smoothstep(0.2, 0.6, back) * lerp(0.75, 0.25, saturate(back / 25.0)));
// A sparkle trail glinting off the fresh ice behind, twinkling out as it gets older.
float2 tc = floor(float2(p.x / 0.24, p.y / 0.16));
float th = hash2(tc + 11.0);
float2 tp = (tc + 0.2 + 0.6 * float2(hash2(tc + 1.3), hash2(tc + 5.9))) * float2(0.24, 0.16);
float tw = saturate(sin(time * (3.0 + 4.0 * th) + th * 40.0));
float tb = exp(-max(hx - tp.x, 0.0) / 4.0) * step(tp.x, hx - 0.6) * step(0.4, th) * step(tp.y, 0.45 - 0.25 * saturate((hx - tp.x) / 6.0));
layer(acc, cover, lerp(lerp(iceC, colorC.rgb, 0.3), float3(1, 1, 1), 0.55), twinkle(p - tp, 0.022 + 0.018 * tw) * tw * tb * (0.7 + 0.5 * level));
// The penguin's frame: it lunges ahead on the beat and bumps a little over the ice.
float lunge = 0.7 * sqrt(beat) * (1.0 - sqrt(beat));
float S = 1.3;
float2 q = (p - float2(hx + lunge, iceY + 0.008 * sin(time * 11.0))) / S;
q = rot(q, -0.05);
// Speed streaks behind it and the ice spray of the burst.
float streak = step(frac(p.y / 0.07 + 0.5), 0.3) * smoothstep(-0.2, -0.5, q.x) * exp(-max(-q.x - 0.5, 0.0) / (0.3 + 0.8 * sqrt(beat))) * step(0.05, q.y) * step(q.y, 0.35);
layer(acc, cover, iceC, streak * (0.1 + 0.6 * sqrt(beat)));
// On the beat a rooster tail of ice chips kicks up behind the feet and falls back.
float spray = 0.0;
float sb = sqrt(beat); // a slower clock than the beat itself, so the spray hangs in the air
for (int i = 0; i < 12; i++)
{
float r1 = hash1(i * 4.1 + 1.0), r2 = hash1(i * 9.3 + 2.0);
float t = 1.0 - sb;
float2 v = float2(-0.4 - 1.3 * r1, 0.6 + 1.0 * r2);
float2 at = float2(-0.6, 0.04) + v * (0.12 + t) * 0.6 - float2(0.0, 1.5 * t * t);
float rr = 0.034 * (1.0 - 0.5 * t) * (0.5 + 0.7 * frac(r1 * 7.0));
spray = max(spray, smoothstep(rr + aa, rr - aa, length(q - at)) * step(0.02, beat));
}
float mist = exp(-length((q - float2(-0.8 + 0.3 * sb, 0.12)) / float2(0.4, 0.16))) * sb;
layer(acc, cover, iceC, mist * 0.4);
layer(acc, cover, float3(0.95, 0.98, 1.0), spray * saturate(sb * 2.0));
// Body parts, in penguin units: the body lies on the ice, the head lifted to look ahead.
float bodyD = smin(ellipse(q - float2(-0.2, 0.15), float2(0.42, 0.14)), ellipse(q - float2(0.2, 0.245), float2(0.14, 0.125)), 0.07);
float fa = 2.55 + 0.15 * sin(time * 9.0) - 0.35 * beat; // both flippers stick out back and up, balancing
float2 fq = rot(q - float2(0.02, 0.21), -fa);
float flipD = ellipse(float2(fq.x - 0.17, fq.y / lerp(1.15, 0.55, saturate(fq.x / 0.34))), float2(0.18, 0.042));
float2 gq = rot(q - float2(-0.04, 0.24), -(fa + 0.25 + 0.1 * sin(time * 9.0 + 1.0)));
float farD = ellipse(float2(gq.x - 0.15, gq.y / lerp(1.1, 0.55, saturate(gq.x / 0.3))), float2(0.16, 0.038));
float kick = sin(time * 7.0);
float feetD = min(ellipse(rot(q - float2(-0.64, 0.08), 0.3 + 0.25 * kick), float2(0.07, 0.028)), ellipse(rot(q - float2(-0.63, 0.13), 0.5 - 0.25 * kick), float2(0.065, 0.026)));
float beakD = ellipse(q - float2(0.345, 0.225), float2(0.07, 0.028));
float shape = min(min(min(bodyD, flipD), min(feetD, beakD)), farD);
// A cold rim light and a dark outline so it reads on both dark and light taskbars, and a shadow on the ice.
// The glow uses a capsule hull: stretched ellipse distances bulge far from their tips.
float2 hp = q - float2(clamp(q.x, -0.5, 0.2), 0.17 + 0.08 * saturate((q.x + 0.1) / 0.3));
float hull = length(hp) - 0.14;
layer(acc, cover, float3(0, 0, 0), smoothstep(0.03, -0.02, ellipse(q - float2(-0.15, 0.0), float2(0.5, 0.025))) * 0.4);
layer(acc, cover, iceC, exp(-max(hull, 0.0) * S / 0.07) * 0.35 * step(0.0, shape));
layer(acc, cover, float3(0.02, 0.03, 0.06), smoothstep(aa, -aa, shape * S - 1.3 * aa));
layer(acc, cover, lerp(float3(0.06, 0.07, 0.11), float3(0.2, 0.24, 0.34), saturate(gq.y / 0.04 + 0.5)), smoothstep(aa, -aa, farD * S));
layer(acc, cover, float3(1.0, 0.55, 0.12), smoothstep(aa, -aa, feetD * S));
// Black back, white belly and face patch, lit from above with a rim of ice light.
float split = q.y - (0.115 + 0.06 * smoothstep(-0.05, 0.28, q.x) + 0.01 * sin(q.x * 9.0));
float face = ellipse(q - float2(0.255, 0.235), float2(0.075, 0.065));
float white = max(smoothstep(0.012, -0.012, split), smoothstep(0.01, -0.01, face));
float lit = saturate((q.y - 0.05) / 0.3);
float3 coat = lerp(float3(0.1, 0.12, 0.18), float3(0.25, 0.3, 0.42), lit) + iceC * 0.5 * smoothstep(-0.03, 0.0, bodyD) * step(0.15, q.y);
float3 belly = lerp(float3(0.78, 0.84, 0.92), float3(1, 1, 1), saturate(q.y / 0.15 + 0.3));
layer(acc, cover, lerp(coat, belly, white), smoothstep(aa, -aa, bodyD * S));
// Eye, rosy cheek and beak.
float eyeD = length((q - float2(0.262, 0.262)) / float2(1.0, lerp(1.0, 0.15, step(0.95, frac(time * 0.27))))) - 0.026;
layer(acc, cover, float3(0.03, 0.03, 0.05), smoothstep(aa, -aa, eyeD * S));
layer(acc, cover, float3(1, 1, 1), smoothstep(aa, -aa, (length(q - float2(0.27, 0.272)) - 0.009) * S));
layer(acc, cover, lerp(colorC.rgb, float3(1, 0.55, 0.65), 0.5), smoothstep(0.035, 0.0, length(q - float2(0.255, 0.2))) * 0.6);
layer(acc, cover, lerp(float3(1.0, 0.62, 0.15), float3(1.0, 0.85, 0.5), saturate((q.y - 0.21) / 0.03)), smoothstep(aa, -aa, beakD * S));
// The knitted scarf: a band around the neck and two ends streaming back, fluttering harder on the beat.
float tx = 0.06 - q.x;
float flut = sin(tx * 13.0 - time * 18.0) * (0.02 + 0.05 * beat) * saturate(tx * 2.0);
float tailY = 0.31 + 0.12 * tx + flut;
float tailW = 0.032 * (1.0 - 0.3 * saturate(tx / 0.5));
float len = 0.5 + 0.06 * sin(time * 3.0) + 0.1 * beat;
float tailD = max(abs(q.y - tailY) - tailW, max(-tx, tx - len));
float band = max(abs(q.x - 0.07 + 0.25 * (q.y - 0.25)) - 0.045, bodyD + 0.004);
float scarf = min(tailD, band);
float knit = step(0.5, frac((tx + 0.25 * q.y) / 0.08));
float3 wool = lerp(colorA.rgb, lerp(colorA.rgb, float3(1, 1, 1), 0.7), knit * step(0.0, tx - 0.04));
wool *= 0.8 + 0.25 * smoothstep(-0.02, 0.02, q.y - tailY + 0.01);
layer(acc, cover, colorA.rgb * 0.3, smoothstep(aa, -aa, scarf * S - 1.0 * aa));
layer(acc, cover, wool, smoothstep(aa, -aa, scarf * S));
float fringe = step(abs(frac((q.y - tailY) / 0.018) - 0.5), 0.25) * step(abs(q.y - tailY), tailW) * step(len, tx) * step(tx, len + 0.05);
layer(acc, cover, wool, fringe);
// The flipper over the body, dark with a light edge.
float3 fc = lerp(float3(0.08, 0.1, 0.15), float3(0.3, 0.36, 0.5), saturate(fq.y / 0.04 + 0.5));
layer(acc, cover, float3(0.02, 0.03, 0.06), smoothstep(aa, -aa, flipD * S - 1.0 * aa));
layer(acc, cover, fc, smoothstep(aa, -aa, flipD * S));
return paint(acc / max(cover, 0.001), cover);
}