miwale

Starry Night — Game Art Style Spec

A living Van Gogh night painting: every surface is thick, swirling impasto brush strokes in ultramarine, viridian and cadmium yellow.

The whole scene looks like a freshly painted post-impressionist canvas at night (think The Starry Night and Café Terrace at Night). Meadows, wheat fields, paths and ponds are made of thousands of short, thick, directional dabs that follow swirling flow fields; characters are painted stroke by stroke with dark prussian-blue contours; every light source radiates concentric rings of glowing yellow strokes. The UI is a museum: gilded frames, brush-stroke bars and little framed paintings as cards. The module's main character has a round orange gourd head with a carved glowing face and an ultramarine coat; the creatures are violet-and-cream root bulbs with leafy tops, pale turquoise floating spirits and a large plum-and-umber colossus with glowing orange cracks.

At a glance

FamilyTraditional media · Impasto oil painting
Mooddreamy, vibrant, nocturnal, restless, artful
Best foratmospheric night adventures, top-down action with a free camera, art/museum themes, night exploration
RendererCanvas 2D, fully procedural, no image assets
Pixel artNo – smooth, native resolution; sprites baked at 3 px per world unit
Complexity8/10 – every new asset is built from many oriented brush strokes; keeping it readable against the busy ground takes tuning
FontsCinzel (600/800), Caveat Brush (400), Alegreya italic (500)
Key colours#141c30 night under-painting, #2e5944 viridian meadow, #866c2a wheat ochre, #3d4180 violet path, #26409a ultramarine, #ffd040 cadmium, #fff6c8 star white, #111733 prussian contour

When to use it

Color palette

SwatchHexRole
Night under-painting#141c30Clear colour, dark base behind ground strokes
Prussian contour#111733Outline strokes of the main character and many props
Meadow viridian#2e5944Meadow mid tone – the dominant ground colour
Meadow light#70944eBrightest meadow strokes
Forest black-green#142a20Forest / dark grass
Wheat ochre#866c2aWheat field mid tone
Wheat light#bc9a3eBrightest wheat strokes
Path violet#3d4180Roads and paths
Pond blue#26579cWater
Ultramarine coat#26409aMain character's clothing
Cobalt light#4a76ccCloth highlights, speed smear
Gourd orange#d86c1eMain character's head mid tone
Scarlet#c8341eScarf, red bar, alert vignette
Cadmium yellow#ffd040Eyes, impact dabs
Chrome yellow#ffe070Halo rings, stars, clock digits (#ffe27a)
Star white#fff6c8Hottest light centres
Root violet#763896Small root creature, top half
Root cream#e2d09aSmall root creature, bottom half
Ghost turquoise#a2d0d2Fast floating creature
Frame gold#d8aa48Gilded UI frames

Ground material ramps (6 steps dark → light, from the module's MATS):

MaterialRampAccents (12–14 % of pass-2 strokes)
Wheat#3c2e18 #54421e #6c5624 #866c2a #a08232 #bc9a3e#2e3e70 #a65e28 #4e5a28
Meadow#1a3430 #23463c #2e5944 #3c6a48 #527e4a #70944e#2e4a86 #8a8a3a #3a6a7a
Path#1c1e44 #262a5a #31356c #3d4180 #4c4f94 #6264a8#6a4f8e #2c4f72 #7a6a5a
Forest#08120f #0e1d18 #142a20 #1b3828 #24462f #305639#1a2650 #3a4a24 #0e2a36
Pond#10244e #163268 #1d4384 #26579c #3270ae #4a8fbc#78c0c0 #c6d2a0 #e8c850

Character ramps: coat #141d52 #1d2c78 #26409a #3157b4 #4a76cc #7aa0e0; gourd orange #8e3a12 #b8521a #d86c1e #ec8a28 #f6aa3c #fcd06a; leaf #163a2a #1f5a3a #2f7a4a #4a9a52 #80bc5c; root violet #34124c #55206f #763896 #985ab6 #c28cd8; cream #9c8656 #c4ad78 #e2d09a #f4e9c2 #fffbe8; ghost #3d64a6 #6e9ec8 #a2d0d2 #cbece4 #f2fbf4; colossus plum #1c1220 #2e1c30 #46284a #603a62 #7e5480 #a27aa4, umber #22160e #35231a #4c3322 #664630 #82603e #a07c52; carved glow #4a1206 #ffb52e #ffe070 #fff6c8.

Rules

Typography

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800&family=Caveat+Brush&family=Alegreya:ital,wght@1,500&display=swap');
.timer { font: 800 36px/1 'Cinzel', 'Trajan Pro', Georgia, serif; color: #ffe27a; letter-spacing: 2px; text-shadow: 0 2px 0 #3a2408, 0 0 14px rgba(255,200,80,.45); }
.label { font: 400 23px 'Caveat Brush', 'Segoe Print', cursive; color: #fff0c8; text-shadow: 0 2px 0 #0a0e24, 0 0 6px rgba(6,8,26,.9); }
.desc  { font: italic 500 18px 'Alegreya', Georgia, serif; color: #e6eefa; text-shadow: 0 1px 3px #000; }

In-world floating numbers (canvas): 400 12px "Caveat Brush" (emphasised 17 px), fill #f6c43a (emphasised #f6602a), outline strokeText #121838 with lineWidth 2.8 (emphasised 3.6), then a highlight pass in #fff4c0 (emphasised #ffd27a) at 75 % alpha offset by (−0.35, −0.45) units, rotated ±0.15 rad.

Rendering technique

The look rests on one primitive, stroke(ctx, x, y, angle, len, wid, col, rng, opts): an impasto dab drawn in local space as

  1. a filled body: blunt rounded start (quadraticCurveTo bulge of 1.15 × half-width behind the start), slightly bent sides (random bend ±0.18 × length), a pointed tip at len/2 + 0.35·halfWidth;
  2. a light ridge: a curve along the upper third, lineWidth 0.48 × half-width, colour mixed 30 % toward #fff6dc (opts.hi), alpha 0.8;
  3. a shadow edge: a curve along the lower side, lineWidth 0.32 × half-width, colour × 0.58, alpha 0.75;
  4. a bristle groove: a thin line (0.08 × width) at a random lateral offset, colour × 0.7, alpha 0.55.

Pipeline:

  1. Init (bake once):
    • Ground stroke atlas: for each of 5 materials, 6 ramp colours + 3 accents × 3 variants, plus gold and flower dabs, painted onto one 1024 × 320 sheet at 3 px/unit, each trimmed to its painted bounding box, read back once with getImageData.
    • Characters: every animation frame is a separate painting (main character 3 idle + 4 walk, small root creature 2 colour variants × 4, floating ghost 3, large colossus 4) via paint() into CPU canvases (willReadFrequently: true – thousands of tiny anti-aliased paths raster faster there), then copied into a normal canvas for fast blitting; mirrored copies prebuilt.
    • Props (cypress ×3 heights, olive ×2, hay ×2, house ×2 with light positions, lamp, sunflowers ×2), FX sprites (halos, glow, pool, swirls, dabs, shadow, star, smear, trail), UI textures (async, one per setTimeout task).
  2. Ground chunks (256 × 256 world units, generated incrementally): sample materials and flow vectors on a 5-unit grid, fill an ImageData with the bilinear under-painting × canvas weave, then splat ~6 000 atlas strokes in pure JS (rotated nearest-neighbour sampling with alpha-over), then decals, then putImageData in 160-px bands. The generator yields every 30 strokes so no frame hitches.
  3. Per frame, draw order: ground chunks → ground overlay (additive light pools, appear swirls) → collectibles → shadows → y-sorted props/creatures/main character → orbiting objects → projectiles → particles → floating numbers → fireflies (additive) → screen varnish vignette → UI (DOM).
  4. Resolution: not pixel art; ground at up to 2.5 px/unit (groundResMax), sprites at 3 px/unit (collectibles 6 px/unit) and scaled with smoothing.

World and ground

The ground is an endless painted night landscape of five materials – wheat, meadow, path, forest, pond – each a field of thick oil dabs over a dark under-painting, each with its own stroke direction so regions read by direction as much as by colour.

Characters

All characters are painted offscreen at 3 px/unit with paint(): a polygon gets a flat base fill, then a jittered grid of strokes (spacing 1.25–2.0 units, length 3.4–5.4, width 1.35–2.05) clipped to the shape, each stroke oriented by a form-describing angle function (meridians on round heads, vertical on cloth, tangential around blobs) and coloured by ramp picking with light from the upper left (base − dx·1.5 − dy·1.3 ± random jitter). A row of dark strokes forms the contour, 30–55 % thicker on the down-right shadow side. Limbs are single seg() strokes. Every animation frame is a separate painting with a new seed, so the strokes "boil" gently between frames.

Main character (34 × 42 unit canvas, anchor (17, 37) = feet; ≈18 wide × 30 tall) – a figure with a big round orange gourd head with a carved glowing face, a long ultramarine coat and a red scarf:

Small creature (root bulb, 30 × 34) – a violet-and-cream root bulb with a leafy top and angry yellow eyes:

Fast creature (floating ghost, 30 × 32) – a pale turquoise spirit with a wavy tail:

Large creature (colossus, 66 × 64) – a hulking plum-and-umber root giant with glowing orange cracks:

Readability against the busy ground: every character gets (1) a dark painted contour, (2) a painted shadow, (3) a colour family the ground does not use (violet, cream, pale turquoise, plum), (4) yellow eyes. Stroke direction always describes the form, never the ground flow.

Props

Props are y-sorted sprites painted once with the same paint() / seg() / stroke() tools as the characters, each standing on a painted shadow. They follow the ground materials: tall cypresses in forests (and rarely meadows), olives in meadows, haystacks and sunflowers in wheat, houses and lamps near paths.

Effects and particles

All effects are made of the same paint dabs and strokes, pre-baked as small sprites.

Atmosphere and lighting

The scene is a night painting: dark ultramarine under-painting, cool colours everywhere, and warm light that exists only as additive, slowly rotating rings of yellow strokes.

UI

The UI is a gallery: every panel and bar sits in a gilded frame, fills are brush-stroke textures, and cards are little framed night paintings.

.panel { background: #121a44; color: #f6e6b0; font-family: 'Cinzel', Georgia, serif;
  border: 9px solid #d8aa48; border-image: linear-gradient(#fbe7a0, #b8862c 40%, #6a4610 60%, #e6c068) 9;
  box-shadow: 0 6px 16px rgba(0,0,0,.5); }
.bar { position: relative; height: 20px; outline: 4px solid #d8aa48; box-shadow: 0 3px 10px rgba(0,0,0,.55);
  background: repeating-linear-gradient(90deg, #16224e 0 18px, #1d2c6a 18px 30px, #0e1638 30px 44px); }
.bar > .fill { height: 100%; transition: width .15s;
  background: repeating-linear-gradient(90deg, #d0401e 0 16px, #ea6028 16px 28px, #f6883a 28px 38px, #a8281a 38px 50px);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 30%, 100% 55%, calc(100% - 5px) 100%, 0 100%); }
.timer { font: 800 36px/1 'Cinzel', serif; color: #ffe27a; letter-spacing: 2px; text-shadow: 0 2px 0 #3a2408, 0 0 14px rgba(255,200,80,.45); }
.label { font: 400 23px 'Caveat Brush', cursive; color: #fff0c8; text-shadow: 0 2px 0 #0a0e24, 0 0 6px rgba(6,8,26,.9); }
.card  { width: 232px; min-height: 304px; padding: 36px 26px 30px; color: #f6e6b0; box-shadow: 0 12px 26px rgba(0,0,0,.65); }
.card:hover { transform: translateY(-8px) scale(1.02); }

For the real look, bake goldFrame() and strokeBar() into canvases at startup and use canvas.toDataURL() as border-image / background (that is what the module does).

Motion and animation

Do and don't

Do

Don't

Implementation recipe

  1. Set up a camera where the screen shows 360 world units vertically; scale = canvasHeight / 360.
  2. Implement stroke() exactly as in the Code section; test it on a dark canvas – it must look like a thick oil dab with a ridge.
  3. Implement paint(polygon, opts) (base fill → clipped jittered grid of strokes → contour()), seg() and polyStroke().
  4. Define 6-step ramps for each material and character; write rampPick(ramp, value).
  5. Paint each character frame into an offscreen canvas at 3 px/unit: limbs as seg(), bodies as paint() with a form-following angle function and a light term (base − dx·1.5 − dy·1.3), eyes as yellow dabs or carved() holes. Bake 3–4 frames per character with different seeds.
  6. Paint props the same way (cypress, olive, haystack, sunflowers, house, lamp) and record the light positions of windows and lamps.
  7. Build a ground stroke atlas (per material: 6 ramp colours + 3 accents × 2–3 variants).
  8. Write fieldAt(x, y) returning material weights and flow vectors (curl of fbm at 120 and 52 units, path tangent, macro brightness).
  9. For each ground chunk (or, for a fixed-size world, once): fill the under-painting, run pass 1 (cell 4.3) and pass 2 (cell 6.2) of atlas strokes along the material's flow, then decals. Do it in a generator spread across frames.
  10. Bake halo, glow, pool, shadow, star, dab, trail and swirl sprites.
  11. Per frame: blit ground, light pools, shadows, y-sorted characters and props, then additive halos for every light, projectiles, particles, numbers, fireflies, vignette.
  12. Build the UI: bake goldFrame() and strokeBar() to data URLs and use them in CSS; Cinzel for numbers, Caveat Brush for labels.
  13. Verify readability with a dense crowd of creatures on every ground material; boost contours or creature brightness where they sink in.

Code

The core techniques below are ported from the module and run stand-alone (Canvas 2D only). The complete runnable starter with main character, creatures, ground, halos and UI is starter.js; the full module is ../../js/styles/vangogh.js.

// Helpers
const TAU = Math.PI * 2;
const rng = (seed) => { let a = seed >>> 0; return { next() { a = (a + 0x6d2b79f5) | 0; let t = Math.imul(a ^ (a >>> 15), 1 | a); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; } }; };
const H = (h) => { const n = parseInt(h.slice(1), 16); return [(n >> 16) & 255, (n >> 8) & 255, n & 255]; };
const rgb = (c, a) => (a === undefined ? `rgb(${c[0] | 0},${c[1] | 0},${c[2] | 0})` : `rgba(${c[0] | 0},${c[1] | 0},${c[2] | 0},${a})`);
const mix = (a, b, t) => a.map((v, i) => v + (b[i] - v) * t);
const mul = (c, f) => c.map((v) => Math.min(255, v * f));

/** One impasto dab: body, light ridge, shadow edge, bristle groove. */
function stroke(ctx, x, y, ang, len, wid, col, r, o = {}) {
  const hl = len * 0.5, hw = wid * 0.5, b = (o.bend ?? (r.next() - 0.5) * 0.36) * len;
  ctx.save(); ctx.translate(x, y); ctx.rotate(ang);
  if (o.a !== undefined) ctx.globalAlpha = o.a;
  ctx.beginPath();
  ctx.moveTo(-hl, -hw * 0.85);
  ctx.quadraticCurveTo(0, -hw * 1.25 + b, hl, b * 0.12 - hw * 0.14);
  ctx.lineTo(hl + hw * 0.35, b * 0.12); ctx.lineTo(hl, b * 0.12 + hw * 0.14);
  ctx.quadraticCurveTo(0, hw * 1.25 + b, -hl, hw * 0.85);
  ctx.quadraticCurveTo(-hl - hw * 1.15, 0, -hl, -hw * 0.85);
  ctx.fillStyle = rgb(col); ctx.fill();
  ctx.lineCap = 'round';
  ctx.beginPath(); ctx.moveTo(-hl * 0.88, -hw * 0.32); ctx.quadraticCurveTo(0, -hw * 0.5 + b, hl * 0.72, b * 0.12 - hw * 0.08);
  ctx.lineWidth = hw * 0.48; ctx.strokeStyle = rgb(mix(col, [255, 246, 220], o.hi ?? 0.3), 0.8); ctx.stroke();
  ctx.beginPath(); ctx.moveTo(-hl * 0.95, hw * 0.6); ctx.quadraticCurveTo(0, hw * 0.86 + b, hl * 0.85, b * 0.12 + hw * 0.1);
  ctx.lineWidth = hw * 0.32; ctx.strokeStyle = rgb(mul(col, 0.58), 0.75); ctx.stroke();
  const v1 = (r.next() - 0.5) * hw * 0.9;
  ctx.beginPath(); ctx.moveTo(-hl * 0.55, v1); ctx.quadraticCurveTo(hl * 0.2, v1 * 0.8 + b * 0.9, hl * 0.95, b * 0.12 + v1 * 0.3);
  ctx.lineWidth = Math.max(0.05, wid * 0.08); ctx.lineCap = 'butt'; ctx.strokeStyle = rgb(mul(col, 0.7), 0.55); ctx.stroke();
  ctx.restore();
}
// Painting a region: base fill, clipped jittered grid of strokes, painted contour.
const pathOf = (P) => { const p = new Path2D(); p.moveTo(...P[0]); for (const q of P.slice(1)) p.lineTo(...q); p.closePath(); return p; };
function inPoly(P, x, y) { let ins = false; for (let i = 0, j = P.length - 1; i < P.length; j = i++) { const a = P[i], b = P[j]; if ((a[1] > y) !== (b[1] > y) && x < ((b[0] - a[0]) * (y - a[1])) / (b[1] - a[1]) + a[0]) ins = !ins; } return ins; }
const rampPick = (pal, v) => pal[Math.max(0, Math.min(pal.length - 1, Math.round(v)))];

function paint(ctx, P, r, o) { // o = { base, sp, len, wid, jit, col(x,y,r), ang(x,y,r), edge:{col,w,l} }
  const xs = P.map((p) => p[0]), ys = P.map((p) => p[1]);
  const path = pathOf(P), sp = o.sp, sy = sp * 0.75, jit = o.jit ?? 0.25;
  ctx.fillStyle = rgb(o.base); ctx.fill(path);
  ctx.save(); ctx.clip(path);
  for (let y = Math.min(...ys); y <= Math.max(...ys) + sy / 2; y += sy)
    for (let x = Math.min(...xs); x <= Math.max(...xs) + sp / 2; x += sp) {
      const px = x + (r.next() - 0.5) * sp, py = y + (r.next() - 0.5) * sy;
      if (!inPoly(P, px, py)) continue;
      stroke(ctx, px, py, o.ang(px, py, r) + (r.next() - 0.5) * jit * 2,
        o.len * (0.75 + r.next() * 0.5), o.wid * (0.8 + r.next() * 0.4), o.col(px, py, r), r);
    }
  ctx.restore();
  if (o.edge) contour(ctx, P, r, o.edge);
}
function contour(ctx, P, r, e) { // strokes along the edge, thicker on the down-right shadow side
  const cx = P.reduce((s, p) => s + p[0], 0) / P.length, cy = P.reduce((s, p) => s + p[1], 0) / P.length;
  const step = e.l * 0.6; let carry = r.next() * step;
  for (let i = 0; i < P.length; i++) {
    const a = P[i], b = P[(i + 1) % P.length], dx = b[0] - a[0], dy = b[1] - a[1], L = Math.hypot(dx, dy);
    if (L < 1e-6) continue;
    let d = carry;
    for (; d < L; d += step) {
      const x = a[0] + dx * d / L, y = a[1] + dy * d / L, ol = Math.hypot(x - cx, y - cy) || 1;
      const sh = ((x - cx) / ol) * 0.55 + ((y - cy) / ol) * 0.83;
      stroke(ctx, x, y, Math.atan2(dy, dx) + (r.next() - 0.5) * 0.2, e.l * (0.8 + r.next() * 0.4),
        e.w * (0.7 + 0.55 * Math.min(1, Math.max(0, sh * 0.5 + 0.5))), e.col, r, { hi: 0.16 });
    }
    carry = d - L;
  }
}

// Example: a round head with strokes following the sphere's meridians, lit from the upper left.
function paintHead(ctx, seed) {
  const r = rng(seed), cx = 0, cy = -22.6, rx = 8.8, ry = 7.4, head = [];
  const ORANGE = ['#8e3a12', '#b8521a', '#d86c1e', '#ec8a28', '#f6aa3c', '#fcd06a'].map(H);
  for (let i = 0; i < 44; i++) { const a = (i / 44) * TAU, k = 1 + 0.035 * Math.abs(Math.sin(a * 3.5)); head.push([cx + Math.cos(a) * rx * k, cy + Math.sin(a) * ry * k]); }
  const merid = (x, y) => { const dy = y - cy, q = Math.sqrt(Math.max(0.06, 1 - (dy / ry) ** 2)), kk = (x - cx) / (rx * q); return Math.atan2(1, (-kk * rx * dy) / (ry * ry * q)); };
  paint(ctx, head, r, { base: ORANGE[2], sp: 1.3, len: 3.6, wid: 1.45, jit: 0.12, ang: merid,
    col: (x, y, q) => rampPick(ORANGE, 2.6 - (x - cx) / rx * 1.5 - (y - cy) / ry * 1.3 + (q.next() - 0.5) * 1.3),
    edge: { col: H('#111733'), w: 1.1, l: 3.2 } });
}
// Ground: flow field from the curl of fbm + stamping pre-rendered stroke sprites along it (bake once).
const hashInt = (x, y, s) => { let h = (Math.imul(x | 0, 374761393) + Math.imul(y | 0, 668265263) + Math.imul(s | 0, 1442695041)) | 0; h = Math.imul(h ^ (h >>> 13), 1274126177); return (h ^ (h >>> 16)) >>> 0; };
function perlin(x, y, s) {
  const x0 = Math.floor(x), y0 = Math.floor(y), fx = x - x0, fy = y - y0, f = (t) => t * t * t * (t * (t * 6 - 15) + 10);
  const g = (ix, iy, dx, dy) => { const a = ((hashInt(ix, iy, s) & 15) / 16) * TAU; return Math.cos(a) * dx + Math.sin(a) * dy; };
  const u = f(fx), v = f(fy), a = g(x0, y0, fx, fy), b = g(x0 + 1, y0, fx - 1, fy), c = g(x0, y0 + 1, fx, fy - 1), d = g(x0 + 1, y0 + 1, fx - 1, fy - 1);
  return (a + u * (b - a) + v * (c + u * (d - c) - a - u * (b - a))) * 1.414;
}
function fbm(x, y, seed, oct) { let a = 1, f = 1, t = 0, n = 0; for (let i = 0; i < oct; i++) { t += a * perlin(x * f, y * f, seed + i * 101); n += a; a *= 0.5; f *= 2; } return Math.min(1, Math.max(0, (t / n) * 0.5 + 0.5)); }
function curl(x, y, scale, seed) {
  const s = 1 / scale, n = fbm(x * s, y * s, seed, 2);
  const gx = fbm((x + 2) * s, y * s, seed, 2) - n, gy = fbm(x * s, (y + 2) * s, seed, 2) - n, m = Math.hypot(gx, gy) + 1e-9;
  return [-gy / m, gx / m]; // gradient rotated 90°: strokes circle around noise blobs -> swirls
}
function strokeSprite(L, W, bend, hex, seed, k = 3) { // one dab baked at k px per world unit
  const r = rng(seed), w = (L + W * 2) * k, h = (W * 2.2 + L * bend * 0.5 + 1) * k;
  const c = document.createElement('canvas'); c.width = Math.ceil(w); c.height = Math.ceil(h);
  const g = c.getContext('2d'); g.translate(w / 2, h / 2); g.scale(k, k);
  stroke(g, 0, 0, 0, L, W, H(hex), r, { bend: (r.next() - 0.5) * bend });
  return c;
}
// Meadow: L 8, W 2.7, bend 0.45, ramp #1a3430 #23463c #2e5944 #3c6a48 #527e4a #70944e
function paintMeadow(g, wWorld, hWorld, s /* px per unit */) {
  const pal = ['#1a3430', '#23463c', '#2e5944', '#3c6a48', '#527e4a', '#70944e'];
  const SPR = pal.map((c, i) => [0, 1].map((v) => strokeSprite(8, 2.7, 0.45, c, 100 + i * 2 + v)));
  g.fillStyle = 'rgb(17,32,28)'; g.fillRect(0, 0, wWorld * s, hWorld * s); // under-painting
  for (const [cell, base, span, sc, keep] of [[4.3, -0.4, 4, 1.12, 1], [6.2, 2, 3, 1, 0.62]]) {
    for (let cy = 0; cy < hWorld / cell; cy++) for (let cx = 0; cx < wWorld / cell; cx++) {
      const r = rng((cx * 73856093) ^ (cy * 19349663) ^ (cell * 1000));
      const x = (cx + r.next()) * cell, y = (cy + r.next()) * cell;
      if (r.next() > keep) continue;
      const bias = (fbm(x / 250, y / 250, 61, 2) - 0.5) * 3.2;          // macro light/dark patches
      const idx = Math.max(0, Math.min(5, Math.floor(base + r.next() * span + bias)));
      const [vx, vy] = curl(x, y, 120, 51), ang = Math.atan2(vy, vx) + (r.next() - 0.5) * 0.3;
      const spr = SPR[idx][(r.next() * 2) | 0], k = (s / 3) * sc * (0.8 + r.next() * 0.4);
      const co = Math.cos(ang) * k, si = Math.sin(ang) * k;
      g.setTransform(co, si, -si, co, x * s, y * s);
      g.drawImage(spr, -spr.width / 2, -spr.height / 2);
    }
  }
  g.setTransform(1, 0, 0, 1, 0, 0);
}
// Light halo: concentric rings of tangential strokes; draw additively and rotate slowly every frame.
function haloSprite(px, cols, rings) { // rings: [radius, alpha, strokeLen, strokeWidth] as fractions of R
  const c = document.createElement('canvas'); c.width = c.height = px;
  const ctx = c.getContext('2d'), R = px / 2, r = rng(px * 7 + cols.length);
  const g = ctx.createRadialGradient(R, R, 0, R, R, R * 0.5);
  g.addColorStop(0, rgb(H(cols[0]), 0.55)); g.addColorStop(0.5, rgb(H(cols[1]), 0.18)); g.addColorStop(1, rgb(H(cols[1]), 0));
  ctx.fillStyle = g; ctx.fillRect(0, 0, px, px);
  rings.forEach(([rad, al, len, wid], i) => {
    const rr = rad * R, n = Math.max(6, Math.round((TAU * rr) / (len * R * 0.85))), off = r.next() * TAU;
    for (let k = 0; k < n; k++) {
      const a = off + (k / n) * TAU + (r.next() - 0.5) * 0.12;
      stroke(ctx, R + Math.cos(a) * rr, R + Math.sin(a) * rr, a + Math.PI / 2 + 0.12, len * R * (0.8 + r.next() * 0.4), wid * R,
        H(cols[Math.min(cols.length - 1, i + (r.next() < 0.3 ? 1 : 0))]), r, { a: al * (0.7 + r.next() * 0.3), bend: 0.12 });
    }
  });
  return c;
}
const GOLD_HALO = haloSprite(160, ['#fff6c8', '#ffe070', '#ffc83a', '#f0a030', '#d08a26'],
  [[0.2, 0.9, 0.14, 0.07], [0.34, 0.75, 0.15, 0.065], [0.5, 0.55, 0.15, 0.06], [0.66, 0.38, 0.15, 0.055], [0.84, 0.22, 0.14, 0.05]]);
function drawCharacterLight(ctx, x, y, t) { // light around the main character's face; ctx in world units
  const pulse = 0.85 + 0.15 * Math.sin(t * 2.2);
  ctx.globalCompositeOperation = 'lighter';
  for (const [size, alpha, spin] of [[44, 0.6, 0.6], [72, 0.34, -0.4]]) {
    ctx.save(); ctx.translate(x, y); ctx.rotate(t * spin); ctx.globalAlpha = alpha * pulse;
    ctx.drawImage(GOLD_HALO, -size / 2, -size / 2, size, size); ctx.restore();
  }
  ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 1;
}

Adapting it to your project

Performance notes

Copy-paste prompt

Use the Starry Night art style (Van Gogh impasto oil painting at night) for my project:
- Everything is made of one brush-stroke primitive: a thick dab with blunt start, tapered tip,
  a light ridge (colour mixed 30% to #fff6dc), a shadow edge (colour x0.58) and a bristle groove.
- Night palette: under-painting #141c30, meadow ramp #1a3430..#70944e, wheat #3c2e18..#bc9a3e,
  paths #1c1e44..#6264a8 (violet), ponds #10244e..#4a8fbc; warm #ffd040/#ffe070/#fff6c8 only for light,
  the main character and collectibles. Outlines are dark strokes (#111733), never black lines.
- World: two passes of 8x2.7-unit strokes (cells 4.3 and 6.2 world units) stamped from pre-baked sprites
  along per-material flow fields (curl of fbm at 120 and 52 units = swirls; wheat vertical; paths along tangent),
  12-14% complementary accent dabs, macro fbm (250 units) shifting ramp index. Bake it, never per frame.
- Characters: paint each frame offscreen at 3 px/unit: polygon base fill, clipped jittered grid of strokes
  (spacing ~1.3, length ~3.6, width ~1.45) oriented by the form, ramp-picked with light from the upper left,
  dark contour strokes thicker on the shadow side, yellow eyes / glowing carved faces. 3-4 frames each.
- Creatures use colours absent from the ground (violet/cream, pale turquoise, plum with glowing cracks).
- Props: flame-shaped cypresses, olive trees, haystacks, sunflowers, cream houses with lit windows, lamps.
- Atmosphere: additive halos of concentric tangential yellow strokes, slowly rotating, warm ground light pools,
  stroke shadows, dark varnish vignette band (13% of height), drifting firefly halos.
- Effects are paint dabs, 4-stroke stars and 3-arm paint swirls; impact flash is warm #ffc84a, never white.
- UI: gilded 9-band gold frames, brush-stroke bars, Cinzel 800 gold numbers, Caveat Brush labels,
  Alegreya italic descriptions, cards as small framed night paintings.
- Performance: bake strokes into canvases at init/chunk build; per frame only drawImage + a few additive halos.