Hanoi Seasons
của MusicBar, thanh tiến trình
Cô bán hoa đạp xe tới chỗ đang phát, tô màu nước lên phố Hà Nội vẽ bằng nét mực: Hồ Gươm mùa xuân, phượng đỏ mùa hè, cầu Long Biên dưới trăng thu và mưa phùn mùa đô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 d16706ce518e165724462bb5cccdee6f2961359222d0d735157c78fc7a8961b5
//! name: Hanoi Seasons
//! author: MusicBar
//! kind: progress
//! description: The song paints a Hanoi street through the year: a flower seller on her bicycle washes watercolor over an ink sketch, past Hoan Kiem in spring, flame trees in summer, Long Bien under the autumn moon and winter drizzle.
// Scene units: one bar height. X runs along the bar, Y rises from the screen edge (0) to the desktop side (1).
float hash1(float n) { return frac(sin(n * 127.1) * 43758.5453); }
float hash2(float2 p) { return frac(sin(dot(p, float2(127.1, 311.7))) * 43758.5453); }
float noise1(float x)
{
float i = floor(x);
float f = frac(x);
f = f * f * (3.0 - 2.0 * f);
return lerp(hash1(i), hash1(i + 1.0), f);
}
float noise2(float2 p)
{
float2 i = floor(p);
float2 f = frac(p);
f = f * f * (3.0 - 2.0 * f);
float a = hash2(i), b = hash2(i + float2(1, 0)), c = hash2(i + float2(0, 1)), d = hash2(i + float2(1, 1));
return lerp(lerp(a, b, f.x), lerp(c, d, f.x), f.y);
}
float fbm(float2 p) { return 0.55 * noise2(p) + 0.3 * noise2(p * 2.07 + 5.3) + 0.15 * noise2(p * 4.13 + 1.7); }
// Spring, summer, autumn, winter: a quarter of the bar each, blending where they meet.
float4 seasonsAt(float u)
{
float a = smoothstep(0.19, 0.31, u), b = smoothstep(0.44, 0.56, u), c = smoothstep(0.69, 0.81, u);
return float4(1.0 - a, a - b, b - c, c);
}
float3 mix4(float4 w, float3 s0, float3 s1, float3 s2, float3 s3) { return w.x * s0 + w.y * s1 + w.z * s2 + w.w * s3; }
float seg(float2 p, float2 a, float2 b)
{
float2 pa = p - a, ba = b - a;
float h = saturate(dot(pa, ba) / dot(ba, ba));
return length(pa - ba * h);
}
// Red Thê Húc bridge: an arch from the shore out to the lake. Returns coverage.
float redBridge(float2 p, float x0, float x1)
{
float s = (p.x - x0) / (x1 - x0);
if (s < 0.0 || s > 1.0) return 0.0;
float deck = 0.24 + 0.22 * sin(3.14159 * s);
float body = smoothstep(0.03, 0.0, abs(p.y - deck) - 0.012);
float posts = step(abs(frac(s * 9.0) - 0.5), 0.09) * step(deck, p.y) * step(p.y, deck + 0.07);
float rail = smoothstep(0.012, 0.0, abs(p.y - deck - 0.07));
return saturate(body + posts + rail);
}
// Tháp Rùa on its islet: three tiers and a small roof.
float turtleTower(float2 p, float cx)
{
float x = abs(p.x - cx);
float islet = step(p.y, 0.25 + 0.05 * (1.0 - saturate(x / 0.5))) * step(x, 0.5) * step(0.2, p.y);
float t1 = step(x, 0.16) * step(p.y, 0.40) * step(0.24, p.y);
float t2 = step(x, 0.12) * step(p.y, 0.52) * step(0.40, p.y);
float t3 = step(x, 0.08) * step(p.y, 0.61) * step(0.52, p.y);
float roof = step(x, 0.12 - (p.y - 0.61) * 0.9) * step(0.61, p.y) * step(p.y, 0.70);
return saturate(islet + t1 + t2 + t3 + roof);
}
// Long Biên: a camelback steel truss on piers, its lattice crossing in Xs.
float longBien(float2 p)
{
float span = 2.6;
float s = frac(p.x / span);
float deck = 0.36;
float top = deck + 0.12 + 0.2 * (1.0 - pow(abs(2.0 * s - 1.0), 2.0));
float inside = step(deck, p.y) * step(p.y, top);
float h = p.y - deck;
// Distance to the nearest diagonal each way, in bar heights.
float d1 = (0.5 - abs(frac((p.x + h) / 0.32) - 0.5)) * 0.32 * 0.7;
float d2 = (0.5 - abs(frac((p.x - h) / 0.32) - 0.5)) * 0.32 * 0.7;
float lattice = smoothstep(0.022, 0.008, min(d1, d2)) * inside;
float chord = smoothstep(0.02, 0.0, abs(p.y - top) - 0.008) * step(deck, p.y);
float deckLine = smoothstep(0.02, 0.0, abs(p.y - deck) - 0.018);
float pier = step(abs(s - 0.0) * span, 0.07) + step(abs(s - 1.0) * span, 0.07);
pier *= step(p.y, deck);
return saturate(lattice + chord + deckLine + pier);
}
// One season's things in the air: a drift of flakes in cells, each moving at the season's own speed.
// Returns (color glow, speck coverage) packed as rgb + a.
float4 drift(float X, float Y, float t, float wind, float fall, float streak, float seed, float3 tint, float glowAmount)
{
float cs = 0.22;
float2 pp = float2(X + t * wind + seed, Y + t * fall + glowAmount * 0.06 * sin(t * 0.7 + X * 1.3)) / cs;
float2 pc = floor(pp);
float2 pf = frac(pp) - 0.5;
float pr = hash2(pc + seed);
float2 po = (float2(hash2(pc + 1.3), hash2(pc + 2.7)) - 0.5) * 0.6;
float2 pd = pf - po;
pd.x -= pd.y * streak * 0.3;
pd.x *= lerp(1.0, 2.4, streak);
pd.y *= lerp(1.0, 0.24, streak);
float pdist = length(pd);
float exists = step(pr, 0.2 + 0.3 * level);
float speck = smoothstep(0.12, 0.04, pdist) * exists;
float flicker = 0.6 + 0.4 * sin(t * 3.0 + pr * 40.0);
float glow = exp(-pdist * 8.0) * exists * glowAmount * (1.0 + beat);
return float4(tint * (speck * flicker * lerp(1.0, 0.32, streak) + glow), speck);
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
float aspect = size.x / size.y;
float X0 = uv.x * aspect;
float Y0 = rise(uv);
// A hand's wobble on every edge, the same in the sketch and in the paint.
float X = X0 + (noise2(float2(X0, Y0) * 11.0) - 0.5) * 0.035;
float Y = Y0 + (noise2(float2(X0, Y0) * 11.0 + 17.0) - 0.5) * 0.035;
float headX = progress * aspect;
float4 w = seasonsAt(uv.x);
float t = time;
// Where the lake (spring) and the Red River (autumn into winter) open up between the houses.
float lake = smoothstep(0.075, 0.085, uv.x) * smoothstep(0.235, 0.225, uv.x);
float river = smoothstep(0.615, 0.625, uv.x) * smoothstep(0.785, 0.775, uv.x);
float water = max(lake, river);
float waterLine = lerp(0.24, 0.2, river);
// ---------------------------------------------------------------- sky
float3 skyTop = mix4(w, float3(0.07, 0.06, 0.15), float3(0.04, 0.06, 0.16), float3(0.08, 0.05, 0.11), float3(0.06, 0.07, 0.09));
float3 skyLow = mix4(w, float3(0.46, 0.25, 0.38), float3(0.66, 0.31, 0.15), float3(0.55, 0.28, 0.12), float3(0.25, 0.28, 0.32));
// Over the river the view opens: the glow comes down to the water.
float3 col = lerp(skyLow, skyTop, smoothstep(0.2, 1.0 + 0.6 * river, Y));
col += colorA.rgb * 0.05 * (1.0 - Y);
float shapes = 0.0; // how much solid scenery is here (for the sketch's hatching)
float form = 0.0; // the outlines the sketch draws: each kind of thing at its own level
// ---------------------------------------------------------------- far city haze
float far = 0.34 + 0.22 * noise1(X * 1.1 + 3.0) + 0.08 * step(0.7, noise1(X * 4.0));
float farMask = step(Y, far) * step(waterLine * water, Y) * (1.0 - river);
col = lerp(col, lerp(skyLow, skyTop, 0.55) * 0.55, farMask * 0.6);
// ---------------------------------------------------------------- tube houses
// Narrow and tall, shoulder to shoulder: ochre, cream or pale green walls, a door-high window and a
// balcony rail on each floor, a tiled roof on some, a shop on the ground floor.
float cw = 0.62;
float cell = floor(X / cw);
float hx = frac(X / cw);
float r = hash1(cell * 3.1);
float hb = 0.44 + 0.42 * r;
float alley = step(hash1(cell * 7.7), 0.1);
float pitched = step(0.55, hash1(cell * 5.3));
float roofTop = hb + pitched * 0.1 * (1.0 - abs(hx - 0.5) * 2.0);
float house = step(Y, roofTop) * (1.0 - alley) * (1.0 - water) * step(0.025, hx) * step(hx, 0.975);
float hue = hash1(cell * 1.9);
float3 paintWall = hue < 0.45 ? float3(0.36, 0.26, 0.11) : (hue < 0.75 ? float3(0.3, 0.27, 0.22) : float3(0.2, 0.26, 0.21));
float3 wall = paintWall * mix4(w, float3(0.32, 0.28, 0.36), float3(0.34, 0.28, 0.26), float3(0.34, 0.27, 0.22), float3(0.26, 0.29, 0.33));
wall += skyLow * 0.07 * smoothstep(roofTop - 0.25, roofTop, Y);
float3 roofCol = float3(0.22, 0.09, 0.06) * 0.8;
wall = lerp(wall, roofCol, pitched * step(hb, Y));
// One tall window to a floor, its balcony rail across; which ones are lit follows the music.
float floors = 5.5;
float wy = frac(Y * floors);
float storey = floor(Y * floors);
float isWindow = step(0.3, hx) * step(hx, 0.7) * step(0.18, wy) * step(wy, 0.8) * step(0.2, Y) * step(Y, hb - 0.05);
float rail = step(abs(wy - 0.22), 0.04) * step(0.18, hx) * step(hx, 0.82) * step(0.2, Y) * step(Y, hb - 0.05) * step(0.5, hash1(cell + storey * 3.0));
float band = hash2(float2(cell, storey) * 1.7);
float lit = saturate(step(band, 0.2) * 0.7 + smoothstep(0.35, 0.8, spectrum(band)) * step(band, 0.8));
float3 lamp = lerp(float3(1.0, 0.72, 0.38), colorC.rgb, 0.3);
float shutter = step(abs(frac(hx * 9.0) - 0.5), 0.12) * 0.03; // louvred shutters when dark
float3 houseCol = wall + isWindow * lerp(float3(0.03, 0.025, 0.03) + shutter, lamp * (0.7 + 0.5 * beat), lit);
houseCol = lerp(houseCol, wall * 1.6 + 0.02, rail);
// Shops on the ground floor, open late.
float shop = step(Y, 0.16) * step(0.06, Y) * step(0.12, hx) * step(hx, 0.88) * step(0.3, hash1(cell * 2.3));
houseCol = lerp(houseCol, lamp * 0.85 * (0.85 + 0.15 * noise1(t * 3.0 + cell)), shop);
col = lerp(col, houseCol, house);
shapes = max(shapes, house);
form += house * (0.25 + 0.15 * hash1(cell * 8.3)) + isWindow * house * 0.12 + farMask * 0.12;
// ---------------------------------------------------------------- water: Hoàn Kiếm lake, the Red River
float inWater = water * step(Y, waterLine);
float ripple = sin(Y * 140.0 + t * 2.5 + noise1(X * 3.0) * 6.0) * 0.012;
float my = 2.0 * waterLine - Y; // mirrored height, for reflections
float3 waterCol = lerp(skyLow * 0.45, skyTop * 0.9, saturate((waterLine - Y) / waterLine)) + 0.03;
col = lerp(col, waterCol, inWater);
// Spring: the red bridge and the tower, with their reflections.
float bridgeX0 = 0.085 * aspect, bridgeX1 = 0.14 * aspect, towerX = 0.19 * aspect;
float red = redBridge(float2(X, Y), bridgeX0, bridgeX1) * step(waterLine - 0.02, Y);
float redRefl = redBridge(float2(X + ripple * 2.5, my), bridgeX0, bridgeX1) * inWater;
float3 redCol = float3(0.85, 0.12, 0.09) * (0.8 + 0.3 * beat);
col = lerp(col, redCol, red);
col = lerp(col, redCol * 0.4, redRefl * 0.35 * step(0.4, noise2(float2(X * 6.0, Y * 40.0 + t))));
float tower = turtleTower(float2(X, Y), towerX) * step(waterLine - 0.04, Y) * lake;
float towerRefl = turtleTower(float2(X + ripple, my), towerX) * inWater * lake;
float3 stone = float3(0.36, 0.28, 0.18) + lamp * 0.08;
float towerWin = step(abs(frac((X - towerX) * 12.0) - 0.5), 0.18) * step(0.3, Y) * step(Y, 0.36);
col = lerp(col, stone + towerWin * lamp * 0.6, tower);
col = lerp(col, stone * 0.5 + lamp * 0.15, towerRefl * 0.7);
shapes = max(shapes, max(red, tower));
form += red * 0.6 + tower * 0.5 + inWater * 0.15;
// Autumn: Long Biên over the river, its lamps doubled in the water.
float steel = longBien(float2(X, Y)) * river;
col = lerp(col, float3(0.025, 0.02, 0.025) + lamp * 0.04 * smoothstep(0.36, 0.7, Y), steel);
float lampRow = frac(X / 0.65);
float bridgeLamp = exp(-length(float2((lampRow - 0.5) * 0.65, Y - 0.4)) * 40.0) * river;
float lampRefl = exp(-abs((lampRow - 0.5) * 0.65 + ripple) * 60.0) * smoothstep(0.0, waterLine, Y) * inWater * river;
col += lamp * (bridgeLamp * 1.4 + lampRefl * 0.5) * (0.8 + 0.4 * level);
shapes = max(shapes, steel);
form += steel * 0.6;
// ---------------------------------------------------------------- street trees
float sp = 2.3;
float j = floor((X + 0.7) / sp);
float tx = (j + 0.5) * sp - 0.7 + (hash1(j * 9.1) - 0.5) * 0.6;
float onLand = 1.0 - river;
float sway = sin(t * 1.3 + j) * (0.015 + 0.03 * beat) * saturate(Y - 0.4);
float2 tp = float2(X - tx - sway, Y);
float trunk = step(abs(tp.x + (Y - 0.2) * 0.04), 0.03 + 0.02 * (0.45 - Y)) * step(Y, 0.5) * onLand;
float tr = 0.36 * (0.85 + 0.3 * hash1(j * 4.7));
float leafNoise = fbm(float2(X, Y) * 7.0 + j);
float canopyD = length(float2(tp.x, (Y - 0.63) * 1.25)) - tr + (leafNoise - 0.45) * 0.28;
float canopy = smoothstep(0.02, -0.02, canopyD) * onLand;
float bare = canopy * w.w;
canopy *= 1.0 - w.w * 0.85;
float3 leaf = mix4(w, float3(0.22, 0.38, 0.18), float3(0.08, 0.22, 0.09), float3(0.78, 0.50, 0.10), float3(0.3, 0.3, 0.3));
leaf *= 0.55 + 0.6 * saturate((Y - 0.45) * 2.5) * leafNoise;
float blossomSpot = smoothstep(0.6, 0.66, fbm(float2(X, Y) * 16.0 + j * 3.0));
float3 blossom = mix4(w, float3(1.0, 0.56, 0.68), float3(0.92, 0.16, 0.10), float3(0.95, 0.35, 0.08), float3(0.8, 0.8, 0.8));
leaf = lerp(leaf, blossom * (0.85 + 0.35 * beat), blossomSpot * (w.x + w.y + 0.6 * w.z));
float3 bark = float3(0.07, 0.05, 0.05);
col = lerp(col, bark, trunk);
col = lerp(col, leaf, canopy);
// Winter: bare branches instead of leaves.
float twig = smoothstep(0.07, 0.0, abs(noise2(float2(tp.x * 10.0, Y * 6.0) + j) - 0.5)) * bare;
col = lerp(col, float3(0.16, 0.16, 0.18), twig * 0.8);
shapes = max(shapes, max(trunk, canopy));
form += canopy * 0.5 + trunk * 0.6 + twig * 0.3;
// ---------------------------------------------------------------- street
float road = step(Y, 0.06) * (1.0 - water);
float3 asphalt = float3(0.04, 0.04, 0.05);
// Wet in winter: the shop lights smear across it.
float smear = noise1(X * 2.2) * (0.5 + 0.5 * sin(Y * 90.0 + t));
asphalt += lamp * smear * 0.18 * w.w + lamp * 0.03;
col = lerp(col, asphalt, road);
// Motorbikes: headlights coming one way, tail lights going the other.
float runA = (X - t * 0.9) / 1.3, runB = (X + t * 0.7) / 1.7;
float bikeA = exp(-abs(frac(runA) - 0.5) * 1.3 * 28.0) * step(0.35, hash1(floor(runA) * 4.1)) * exp(-abs(Y - 0.035) * 70.0);
float bikeB = exp(-abs(frac(runB) - 0.5) * 1.7 * 28.0) * step(0.35, hash1(floor(runB) * 6.3)) * exp(-abs(Y - 0.02) * 70.0);
col += (float3(1.0, 0.95, 0.8) * bikeA + float3(1.0, 0.15, 0.1) * bikeB) * (1.0 - water) * (0.7 + 0.3 * w.w);
shapes = max(shapes, road);
form += road * 0.2;
// Winter mist drifting low.
float mist = fbm(float2(X * 0.6 - t * 0.08, Y * 2.0)) * w.w * smoothstep(0.0, 0.5, Y);
col = lerp(col, float3(0.42, 0.45, 0.5), mist * 0.35);
// ---------------------------------------------------------------- what the season carries in the air
// Petals, fireflies, leaves, drizzle: each drifts at its own speed, faded in by where its season is.
float4 air4 = 0.0;
if (w.x > 0.001) air4 += w.x * drift(X, Y, t, 0.16, 0.06, 0.0, 0.0, float3(1.0, 0.65, 0.75), 0.0);
if (w.y > 0.001) air4 += w.y * drift(X, Y, t, 0.02, 0.0, 0.0, 11.0, float3(0.85, 1.0, 0.45), 0.6);
if (w.z > 0.001) air4 += w.z * drift(X, Y, t, 0.22, 0.11, 0.0, 23.0, float3(0.95, 0.55, 0.12), 0.0);
if (w.w > 0.001) air4 += w.w * drift(X, Y, t, 0.3, 1.5, 1.0, 37.0, float3(0.7, 0.78, 0.9), 0.0);
float3 air = air4.rgb;
float speck = air4.a;
// Autumn: the Mid-Autumn moon over the river.
float2 moonC = float2(0.7 * aspect, 0.74);
float moonD = length(float2(X, Y) - moonC);
float3 moonCol = float3(1.0, 0.9, 0.7) * (1.0 - 0.15 * noise2(float2(X, Y) * 18.0));
float moon = smoothstep(0.13, 0.12, moonD) * w.z * (1.0 - shapes);
col = lerp(col, moonCol, moon);
col += float3(1.0, 0.8, 0.55) * exp(-moonD * 5.0) * 0.18 * w.z * (1.0 - shapes);
// and its path on the water
float moonPath = exp(-abs(X - moonC.x + ripple * 3.0) * 6.0) * inWater * river * step(0.5, noise2(float2(X * 4.0, Y * 50.0 - t)));
col += moonCol * moonPath * 0.35;
// Glints on the lake.
float glint = step(0.93, noise2(float2(X * 2.5, Y * 70.0 + t * 0.6))) * inWater * lake;
col += lerp(skyLow, float3(1.0, 0.9, 0.8), 0.5) * glint * 0.5;
// ---------------------------------------------------------------- painted or still a sketch
float edge = headX - 0.12 + (fbm(float2(Y * 4.0, t * 0.12)) - 0.45) * 0.9 + (noise2(float2(Y * 14.0, X * 0.5)) - 0.5) * 0.16;
float painted = smoothstep(-0.05, 0.2, edge - X);
float wet = exp(-abs(X - edge) * 10.0);
float grain = noise2(float2(X, Y) * 70.0);
// Watercolor: the wash pools darker in places, with fine grain, and darkens at the wet edge.
float wash = 0.86 + 0.28 * fbm(float2(X * 1.4, Y * 3.0) + 9.0);
float3 paintCol = col * wash * (0.9 + 0.2 * grain) * (1.0 - 0.3 * wet * painted) + air;
paintCol += lamp * 0.06 * level;
// The sketch: pencil outlines of the things to come (not their windows), light hatching on the solid
// ones, on dark paper.
form += moon * 0.5;
float ink = saturate(fwidth(form) * 2.6);
float hatch = step(frac((uv.x * size.x + uv.y * size.y) / 4.0), 0.25) * shapes * 0.1;
float3 paper = float3(0.05, 0.055, 0.075) * (0.85 + 0.3 * grain);
float3 sketch = paper + float3(0.42, 0.46, 0.55) * (ink * 0.8 + hatch) + float3(0.5, 0.52, 0.6) * speck * 0.12;
float3 rgb = lerp(sketch, paintCol, painted);
float alpha = lerp(0.88, 0.96, painted);
// The brush's light at the wet edge, swelling with the music.
float brush = exp(-abs(X - edge) * 5.0) * (0.35 + 0.45 * level + 0.5 * beat) * (0.4 + 0.6 * Y);
rgb += lerp(float3(1.0, 0.78, 0.45), colorC.rgb, 0.35) * brush * 0.22;
// ---------------------------------------------------------------- the flower seller on her bicycle
// She rides at the playhead, never half off the bar at the start or the end of a song.
float riderX = clamp(headX, 0.5, aspect - 0.3);
float2 q = float2(X0 - riderX, Y0) / 1.12;
if (abs(q.x) < 0.9)
{
float4 wh = seasonsAt(progress);
float speed = (3.0 + 5.0 * level) * (0.25 + 0.75 * playing);
float a = t * speed;
q.y -= 0.035 + 0.008 * sin(a * 2.0) + 0.012 * beat;
float2 rear = float2(-0.24, 0.14), front = float2(0.24, 0.14), crank = float2(0.0, 0.15);
float2 seat = float2(-0.08, 0.38), head = float2(0.18, 0.4);
float wheelR = 0.14;
float rim = min(abs(length(q - rear) - wheelR), abs(length(q - front) - wheelR));
// Spokes turn with the pedals.
float2 dr = q - rear, df = q - front;
float sr = abs(sin(atan2(dr.y, dr.x) * 4.0 + a)) * length(dr);
float sf = abs(sin(atan2(df.y, df.x) * 4.0 + a)) * length(df);
float spokes = min(sr + step(wheelR, length(dr)), sf + step(wheelR, length(df)));
float frame = min(min(seg(q, rear, seat), seg(q, seat, crank)), min(seg(q, crank, rear), seg(q, crank, head)));
frame = min(frame, min(seg(q, seat, head), seg(q, head, front)));
frame = min(frame, seg(q, head, float2(0.15, 0.47)));
float bike = max(smoothstep(0.018, 0.008, rim), smoothstep(0.014, 0.006, frame));
bike = max(bike, smoothstep(0.006, 0.0, spokes) * 0.6);
// Rider: legs on the pedals, back, arm to the handlebar, and the nón lá.
float2 hip = float2(-0.07, 0.42);
float2 pedal = crank + 0.075 * float2(cos(a), sin(a));
float2 pedal2 = crank - 0.075 * float2(cos(a), sin(a));
float2 dk = pedal - hip;
float dl = length(dk);
float2 nk = float2(dk.y, -dk.x) / max(dl, 1e-3);
float kneeOut = sqrt(max(0.0, 0.19 * 0.19 - dl * dl * 0.25));
float2 knee = (hip + pedal) * 0.5 - nk * kneeOut;
float2 dk2 = pedal2 - hip;
float dl2 = length(dk2);
float2 nk2 = float2(dk2.y, -dk2.x) / max(dl2, 1e-3);
float2 knee2 = (hip + pedal2) * 0.5 - nk2 * sqrt(max(0.0, 0.19 * 0.19 - dl2 * dl2 * 0.25));
float leg = min(seg(q, hip, knee), seg(q, knee, pedal));
float leg2 = min(seg(q, hip, knee2), seg(q, knee2, pedal2));
float2 shoulder = float2(0.03, 0.63);
float torso = seg(q, hip, shoulder);
float arm = min(seg(q, shoulder, float2(0.12, 0.53)), seg(q, float2(0.12, 0.53), float2(0.16, 0.48)));
float headD = length(q - float2(0.06, 0.7)) - 0.05;
float hb2 = q.y - 0.72;
float hat = step(0.0, hb2) * step(hb2, 0.14) * step(abs(q.x - 0.06), 0.16 * (1.0 - hb2 / 0.14));
float body = max(max(smoothstep(0.04, 0.03, torso), smoothstep(0.03, 0.02, leg)), max(smoothstep(0.024, 0.016, arm), smoothstep(0.01, 0.0, headD)));
float far2 = smoothstep(0.028, 0.018, leg2);
// The flowers on the back: peach, lotus, golden chrysanthemum or daisies, as the season goes.
float2 bq = q - float2(-0.33, 0.43);
float bunchD = length(bq * float2(1.0, 1.15)) - 0.17 + (noise2(q * 22.0) - 0.5) * 0.08;
float bunch = smoothstep(0.01, -0.01, bunchD);
float twigs = smoothstep(0.012, 0.004, min(seg(q, float2(-0.30, 0.45), float2(-0.42, 0.78)), seg(q, float2(-0.34, 0.45), float2(-0.2, 0.74)))) * wh.x;
float2 bc = floor(q * 26.0);
float2 bj = (float2(hash2(bc + 5.1), hash2(bc + 9.7)) - 0.5) * 0.45;
float bloomDots = smoothstep(0.42, 0.22, length(frac(q * 26.0) - 0.5 - bj)) * step(0.12, hash2(bc));
float3 flower = mix4(wh, float3(1.0, 0.55, 0.7), float3(1.0, 0.72, 0.82), float3(1.0, 0.78, 0.18), float3(0.96, 0.96, 0.92));
float3 stem = mix4(wh, float3(0.3, 0.12, 0.1), float3(0.2, 0.5, 0.22), float3(0.25, 0.4, 0.15), float3(0.3, 0.45, 0.25));
float3 bunchCol = lerp(stem * 0.7, flower * (0.9 + 0.5 * beat), bloomDots);
float twigBloom = smoothstep(0.03, 0.0, length(frac(q * 30.0) - 0.5) - 0.18) * step(0.5, hash2(floor(q * 30.0) + 4.0));
float basket = step(abs(q.x + 0.31), 0.13) * step(abs(q.y - 0.3), 0.04);
float3 ink2 = float3(0.03, 0.03, 0.045);
float3 rimLight = lamp * 0.35 * smoothstep(0.1, -0.2, q.x);
float3 riderCol = float3(0.1, 0.12, 0.2) + rimLight * 1.4;
float3 strawCol = float3(0.86, 0.76, 0.5) * (0.75 + 0.35 * smoothstep(0.72, 0.86, q.y));
float3 c = rgb;
c = lerp(c, ink2 + 0.05, far2);
c = lerp(c, float3(0.14, 0.15, 0.17) + rimLight * 0.5, bike);
c = lerp(c, float3(0.25, 0.17, 0.1), basket);
c = lerp(c, bunchCol, bunch);
c = lerp(c, lerp(float3(0.22, 0.1, 0.08), flower, twigBloom), twigs);
c = lerp(c, riderCol, body);
c = lerp(c, strawCol, hat);
c += flower * 0.25 * exp(-max(bunchD, 0.0) * 18.0) * (0.6 + 0.8 * beat);
float cover = max(max(max(bike, body), max(hat, bunch)), max(max(twigs, basket), far2));
rgb = c;
alpha = max(alpha, cover);
}
return paint(rgb, alpha);
}