Star Runner
của MusicBar, thanh tiến trình
Phi thuyền bay giữa bầu sao tới chỗ đang phát, nhạc lên cao là sao kéo thành vệt như đang nhảy warp, tới nhịp là bắn hai tia laser về phía trước.
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 e5ed96642b4051b9705166a3ff8eece41a89551aaab4f7add28bb6d395d71710
//! name: Star Runner
//! author: MusicBar
//! kind: progress
//! description: A starfighter flies to the playhead through drifting stars that stretch into warp streaks when the music is loud, firing twin bolts on every beat.
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); }
// Distance outside one edge of a counterclockwise polygon (negative inside), and a 4-sided one built from it.
float edge(float2 p, float2 a, float2 b) { float2 e = normalize(b - a); return e.y * (p.x - a.x) - e.x * (p.y - a.y); }
float quad(float2 p, float2 a, float2 b, float2 c, float2 d) { return max(max(edge(p, a, b), edge(p, b, c)), max(edge(p, c, d), edge(p, d, a))); }
float ellipse(float2 p, float2 r) { float k0 = length(p / r); return k0 * (k0 - 1.0) / max(length(p / (r * r)), 0.0001); }
// The hull's top and bottom edges along its length: a sharp nose, a thick middle, a squared tail.
float hullTop(float x) { return 0.11 * sqrt(saturate((0.3 - x) / 0.75)) + 0.02 * smoothstep(-0.6, -1.1, x) - 0.005; }
float hullBot(float x) { return -0.075 * sqrt(saturate((0.3 - x) / 0.6)) - 0.012 * smoothstep(-0.5, -1.0, x) - 0.005; }
// 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 px = float2(uv.x * size.x, uv.y * size.y);
float head = progress * size.x;
float aa = 1.0 / u;
float3 acc = float3(0, 0, 0);
float cover = 0;
float behind = smoothstep(head + 0.5 * u, head - 1.5 * u, px.x); // 1 over the played part
// Three layers of stars drifting left at different speeds; behind the ship they stretch into warp streaks when loud.
for (int i = 0; i < 3; i++)
{
float fi = i;
float2 cs = float2(0.8 + 0.4 * fi, 0.2 + 0.07 * fi) * u;
float2 sp = px + float2(time * (0.35 + 1.1 * fi * fi) * u, fi * 17.0 * u);
float2 cell = floor(sp / cs);
float h = hash2(cell + fi * 31.0);
float2 at = (cell + 0.2 + 0.6 * float2(hash2(cell + 5.3), hash2(cell + 9.1))) * cs;
float len = cs.x * 0.32 * pow(level, 1.5) * behind * (0.4 + 0.3 * fi);
float2 d = sp - at;
float tail = 1.0 - 0.85 * saturate(d.x / (2.0 * len + 0.001)); // bright head, fading tail
d.x = max(abs(d.x - len) - len, 0.0);
float star = exp(-length(d) / (0.006 * u * (1.0 + 0.5 * fi))) * step(0.55 - 0.1 * fi, h) * tail;
float tw = 0.6 + 0.4 * sin(time * 3.0 + h * 40.0);
float3 sc = lerp(lerp(float3(0.75, 0.85, 1.0), float3(1, 1, 1), fi * 0.5), lerp(colorB.rgb, float3(1, 1, 1), 0.5), saturate(len / (0.1 * u)) * 0.5);
layer(acc, cover, sc, star * tw * (0.4 + 0.3 * fi));
}
// Rocky asteroids drift in the part of the song still to come.
float ac = 1.3 * u;
float ax = px.x + time * 0.25 * u;
float acell = floor(ax / ac);
float h1 = hash2(float2(acell, 1.0)), h2 = hash2(float2(acell, 2.0)), h3 = hash2(float2(acell, 3.0));
float2 rc = float2((acell + 0.5 + (h2 - 0.5) * 0.3) * ac - time * 0.25 * u, (0.22 + 0.56 * h3) * u);
float2 rd = (px - rc) / u;
float rr = 0.06 + 0.08 * h1;
float th = atan2(rd.y, rd.x) + time * (h2 - 0.5) * 1.6;
float edgeR = rr * (1.0 + 0.16 * sin(3.0 * th + h1 * 20.0) + 0.09 * sin(7.0 * th + h3 * 9.0));
float dRock = length(rd) - edgeR;
float z = sqrt(saturate(1.0 - dot(rd, rd) / (rr * rr)));
float lit = saturate(dot(normalize(float3(rd / rr, z + 0.01)), normalize(float3(-0.6, 0.6, 0.55))));
float3 rock = float3(0.5, 0.44, 0.4) * (0.25 + 0.85 * lit) + colorB.rgb * 0.5 * pow(1.0 - z, 3.0) * step(0.0, rd.x);
float2 cr = rd - rr * 0.35 * float2(cos(th * 0.0 + h1 * 6.0), sin(h1 * 6.0));
rock *= 1.0 - 0.35 * smoothstep(rr * 0.28, rr * 0.18, length(cr));
float ahead = step(0.35, h1 + h3 * 0.4) * smoothstep(head + 0.6 * u, head + 1.6 * u, rc.x);
layer(acc, cover, float3(0.05, 0.04, 0.06), ahead * smoothstep(aa, -aa, dRock - 1.2 * aa));
layer(acc, cover, rock, ahead * smoothstep(aa, -aa, dRock));
// The ship's frame: q in bar heights, origin at the nose tip, gently bobbing.
float2 q = (px - float2(head, 0.5 * u + 0.03 * u * sin(time * 2.2))) / u;
q.y = -q.y; // up is up on screen
// The ion trail over the played part, and the engine plume whose length follows the loudness.
float back = max(-1.3 - q.x, 0.0);
layer(acc, cover, colorB.rgb, step(q.x, -1.3) * exp(-abs(q.y) / (0.015 + 0.01 * back)) * (0.12 + 0.45 * exp(-back / 2.5)));
float plen = 0.3 + 1.3 * level + 0.25 * beat;
float pt = (-1.28 - q.x) / plen;
float prad = 0.06 * pow(saturate(1.0 - pt), 0.7) * (1.0 + 0.12 * sin(time * 47.0 + pt * 18.0));
float plume = step(0.0, pt) * smoothstep(prad + aa, prad - aa, abs(q.y));
float pcore = step(0.0, pt) * smoothstep(prad * 0.5 + aa, prad * 0.5 - aa, abs(q.y));
layer(acc, cover, colorB.rgb, exp(-length(float2(max(pt, 0.0) * plen * 0.5, q.y)) / 0.07) * step(q.x, -1.2) * 0.6);
layer(acc, cover, lerp(colorB.rgb, float3(0.7, 0.85, 1.0), 0.3), plume * (1.0 - pt * 0.7));
layer(acc, cover, lerp(float3(1, 1, 1), float3(0.6, 0.85, 1.0), saturate(pt * 2.0)), pcore * (1.0 - pt));
// Twin bolts leave the nose on each beat and race ahead.
float bx = 0.35 + (1.0 - beat) * 4.5;
float2 bq = float2(clamp(q.x, bx - 0.32, bx), 0.0);
float bolt = min(length(q - float2(bq.x, 0.04)), length(q - float2(bq.x, -0.06)));
float bon = step(0.03, beat) * saturate(beat * 3.0);
layer(acc, cover, colorC.rgb, exp(-bolt / 0.035) * bon * 0.8);
layer(acc, cover, lerp(colorC.rgb, float3(1, 1, 1), 0.65), smoothstep(0.02 + aa, 0.02 - aa, bolt) * bon);
// The hull, a swept wing below, a tail fin above, the nozzle and a glass canopy.
float top = hullTop(q.x), bot = hullBot(q.x);
float dHull = max(max(q.y - top, bot - q.y), max(q.x - 0.3, -1.25 - q.x));
float dWing = quad(q, float2(-0.34, -0.04), float2(-0.95, -0.04), float2(-1.14, -0.25), float2(-0.86, -0.25));
float dFin = quad(q, float2(-1.18, 0.06), float2(-0.74, 0.06), float2(-1.02, 0.25), float2(-1.2, 0.25));
float dNoz = max(abs(q.x + 1.27) - 0.04, abs(q.y - 0.005) - 0.06);
float dCan = max(ellipse(q - float2(-0.2, 0.07), float2(0.2, 0.065)), 0.05 - q.y);
float dShip = min(min(min(dHull, dWing), min(dFin, dNoz)), dCan);
layer(acc, cover, colorA.rgb, exp(-max(dShip, 0.0) / 0.06) * 0.18);
layer(acc, cover, colorA.rgb * 0.12, smoothstep(aa, -aa, dShip - 1.2 * aa));
layer(acc, cover, float3(0.32, 0.33, 0.38) * (0.6 + 0.8 * saturate(q.y + 0.06)), smoothstep(aa, -aa, dNoz));
float wt = saturate((q.y + 0.25) / 0.21);
float3 wing = colorA.rgb * (0.38 + 0.4 * wt);
wing = lerp(wing, colorC.rgb, step(q.y, -0.215) * step(-1.13, q.x));
layer(acc, cover, wing, smoothstep(aa, -aa, dWing));
float3 fin = colorA.rgb * (0.5 + 0.4 * saturate((q.y - 0.06) / 0.19));
fin = lerp(fin, colorC.rgb, step(0.215, q.y));
layer(acc, cover, fin, smoothstep(aa, -aa, dFin));
float t = saturate((q.y - bot) / max(top - bot, 0.01));
float3 hull = colorA.rgb * (0.35 + 0.8 * t) + 0.45 * exp(-abs(q.y - top + 0.025) / 0.012) * step(q.x, 0.1);
hull = lerp(hull, colorC.rgb, smoothstep(aa, -aa, abs(q.y + 0.012) - 0.01) * step(q.x, -0.45));
hull *= 1.0 - 0.3 * smoothstep(aa * 1.5, 0.0, min(abs(q.x + 0.62), abs(q.x + 0.98))); // panel seams
float strip = smoothstep(aa, -aa, abs(q.y - bot - 0.022) - 0.007) * step(q.x, -0.25) * step(-1.15, q.x);
hull = lerp(hull, lerp(colorB.rgb, float3(1, 1, 1), 0.45 + 0.4 * beat), strip); // a glowing light strip
layer(acc, cover, hull, smoothstep(aa, -aa, dHull));
layer(acc, cover, lerp(colorB.rgb, float3(1, 1, 1), 0.6), smoothstep(aa, -aa, max(abs(q.x + 1.3) - 0.012, abs(q.y - 0.005) - 0.045)) * (0.7 + 0.3 * level));
float g = saturate((q.y - 0.05) / 0.08);
float3 glass = lerp(float3(0.05, 0.08, 0.16), lerp(colorB.rgb, float3(1, 1, 1), 0.5), g * g * 0.8);
glass += exp(-abs(q.x + 0.15 - 0.6 * (q.y - 0.08)) / 0.015) * 0.9 * step(0.07, q.y);
layer(acc, cover, glass, smoothstep(aa, -aa, dCan));
// A blinking light on the wing tip and a muzzle flash on the beat.
layer(acc, cover, lerp(colorC.rgb, float3(1, 1, 1), 0.5), exp(-length(q - float2(-1.13, -0.235)) / 0.015) * step(0.5, frac(time * 1.5)));
layer(acc, cover, lerp(colorC.rgb, float3(1, 1, 1), 0.5), exp(-length(q - float2(0.33, -0.01)) / (0.03 + 0.05 * beat)) * beat);
return paint(acc / max(cover, 0.001), cover);
}