miwale

Clay World — Game Art Style Spec

Stop-motion plasticine miniature set: soft gradient-built clay figures with fingerprints, warm studio light and 12 fps boil.

Everything looks hand-rolled from modelling clay and filmed on a tabletop miniature set (think Aardman / Clay Jam). Characters are stacks of soft lumpy balls and sausages with no outlines: each part is lit by a warm top-left key light, darkened by inner ambient occlusion along its bottom edge, caught by a warm rim light along its top edge, covered in faint thumbprints and topped with a broad, soft specular. The ground is a set of flat clay sheets — meadow, soil, purple clay, ochre paths and sunken glossy ponds — with raised bevelled edges and a lumpy hand-pressed surface. All animation steps at 12 fps and every frame is a slightly different "boil" of the same model. The examples below use the module's cast — a main character with a round orange gourd head and a carved glowing face, two-tone root-bulb creatures with googly eyes, a glossy white floating sheet creature and a lumpy root giant with glowing cracks — but everything applies to any subject.

At a glance

PropertyValue
FamilyClaymation · Stop-motion plasticine
Moodcozy, handmade, playful, tactile, warm
Best fortop-down action/arena, cozy adventure and farming, puzzle/party, casual mobile
RendererCanvas 2D, fully procedural, no image assets
Pixel artNo — native resolution, sprites baked at 3–5 px per world unit
Complexity5/10 — soft shapes are forgiving, but each new figure needs a few passes to read as plasticine
FontsChewy (titles, numbers), Baloo 2 500–800 (body)
Key coloursmeadow #76a454, purple clay #66507e, ochre path #d6a262, pond #7ebad2, pumpkin #ee7a22, candle #ffd458, plum shadow #401a34, panel cream #f5ddb8

When to use it

Color palette

Swatch nameHexRole
Meadow clay#76a454Default ground (~40% of screen); canvas clear colour #78a854
Meadow light#8cac5aSecond meadow tone blended in large noise patches
Purple clay#66507eRaised dark sheets, graveyard zones
Soil#986c4aRaised brown fields
Ochre path#d6a262Raised winding paths and clearings
Pond#7ebad2Sunken glossy water sheets
Pumpkin orange#ee7a22Main character's round gourd head, main accent; HUD numbers #f07a24
Overall blue#3c62a6Main character's body; pants #344c80
Scarf green#68ae48Main character's scarf; leaves #60a246; foliage #609e4a
Skin cream#f8e0baHands; shoes #6c422a
Bulb purple#8650acTop layer of the small root-bulb creatures (variants #b24c8e, #685cbe)
Bulb cream#f4e8ccBody of the small root-bulb creatures (variants #f6e2ce, #eee8c6)
Brow plum#4a2852Eyebrows, dark accents
Ghost white#eaf0fcFloating sheet creature; shaded to #96a4ce
Giant mauve#7e5a68Large root giant; lumps #6c4a5c, #946c76; roots #a07660
Candle ramp#fff7c4 → #ffd458 → #ff8f22All glow: carved faces, cracks, cores, lanterns
Cavity#4e1606Inside of carved holes; cracks #2c1218 + #ff9a3a
Plum shadow#401a34Shadow tint target; AO rgba(58,20,40), contact rgba(52,22,24), ground shadow rgba(44,24,16)
Warm white#fffbf0Highlight target; rim light rgba(255,247,230)
Panel cream#f5ddb8UI slabs (#fff5e2 → #f5ddb8 → #e0b98a), base #b98654
Seed gold#ffca40Small collectibles; large collectibles #ff7c34

Palette rules

Typography

Chewy (400) — titles, HUD numbers, card names, floating numbers. <https://fonts.google.com/specimen/Chewy>

font: 400 40px/1.1 'Chewy', 'Baloo 2', system-ui, sans-serif; letter-spacing: 2px; color: #f07a24;
text-shadow: 0 2px 0 #c85e1a, 0 4px 0 #a84a12, 0 5px 0 #8c3c0e, 0 9px 10px rgba(40,18,6,.45);

Baloo 2 (500, 600, 700, 800) — labels, descriptions, hints. <https://fonts.google.com/specimen/Baloo+2>

font: 800 12px/1.2 'Baloo 2', system-ui, sans-serif; letter-spacing: 2px; color: #9a6a44;

Text effects:

Rendering technique

  1. Init: choose sprite resolution K = clamp(round(screenPxPerUnit * 1.2), 3, 5) px per world unit (360 world units are visible vertically).
  2. Build the fingerprint tile (192×192 px, tileable via 9 offset draws): 7 thumbprints of 5–8 concentric partial ellipses (radius 9–18 px, aspect 1.25, sweep π–1.9π) plus 12 curved tool smears. Every stroke is drawn twice: dark rgba(70,28,20,0.1) (0.9 px), then light rgba(255,246,232,0.09) 0.9 px lower.
  3. Build the ground height texture (256×256, 2 texels per unit, tileable fBm) and convert it to a lighting modulator MOD = (h[x-1,y-1] - h[x+1,y+1]) * 2.4 + (h - 0.5) * 0.08 + hashNoise * 0.008 — a diagonal derivative = light from the top-left.
  4. Bake every sprite into its own canvas at K px/unit: the main character (1 idle + 4 walk frames, normal + squeezed face), each creature type × 4 frames (× 3 colour variants), props (2–4 variants each), collectibles, projectile, 14 crumb balls, 14 splats, the rising mound. Each frame gets its own RNG seed (100 + frame, 200 + variant*10 + frame, ...) so lumps and fingerprint offsets differ — this is the boil. A cream-tinted copy (#fff8ec, source-atop) and mirrored copies are stored next to each frame.
  5. Ground chunks (256 units, ≤ 2.5 px/unit) are rendered lazily by a generator that yields every few rows: sample material fields on a 4-unit grid, per pixel compute signed distance + lit bevel/shadow, multiply by MOD, putImageData, then stamp decals with canvas paths.
  6. Per frame draw order: ground chunks → ground overlay (additive light pool under the main character, collectible glows, splats, rising mounds) → collectibles → soft shadows of all figures/props → y-sorted props, creatures, main character (blits) → orbiting objects → projectiles → particles → floating numbers → screen overlay (vignette + top light).
  7. Sprites are drawn with drawImage at 1/K scale, optionally under a rotation transform. Smoothing stays ON (this is not pixel art).

World and ground

The floor is a tabletop of flat clay sheets laid on top of each other, all lit by the same top-left key light L = (-0.42, -0.907).

Characters

All figures are chunky toy assemblies of clay primitives painted back to front with the clay() painter (table below); each part casts a soft contact shadow onto the parts behind it. No outlines anywhere — silhouettes separate by value, bottom AO and the soft ground shadow.

Main character (~21 units wide, ~33 tall incl. stem, drawn at scale 1.06) is an assembly of ~20 clay parts painted back to front:

  1. Scarf tail (two capsules r 1.5, swinging angle per frame 0.22–0.58 rad).
  2. Back arm: capsule r 1.25 in body blue + cream hand ellipse 1.5 × 1.45.
  3. Legs: capsules r 1.4 in #344c80 + shoe ellipses 2.3 × 1.4 in #6c422a.
  4. Body: lumpy blob 4.7 × 4.4 (#3c62a6, amt 0.08) with two pressed fold grooves; a yellow button 0.75.
  5. Front arm, then the scarf ring (lump 6 × 2.3 with 4 vertical grooves).
  6. Stem capsule (r 1.35, #787434) and a leaf (#68a646) with a curly tendril stroke.
  7. Head: a round orange gourd — superellipse 10.2 × 8.4 (exponents 0.85/0.92, dents at top and bottom), spec 0.55, gloss 0.7, lit 0.24, ao 0.55, highlight at (-5.0, -4.6) radius 4.4; 4 curved rib grooves (width 0.75, alpha 0.3); carved face (two triangle eyes, a zig-zag grin) with candle light.

Proportions: head ≈ 55–60% of height, body tiny, limbs stubby (r 1.25–1.4). Feet at y = 0, origin bottom-centre.

Animation frames (back foot x/y, front foot x/y, back arm, front arm, body lift): idle [-2.1,0, 2.3,0, 0.18,-0.18, 0], walk [-3.5,0, 3.7,-0.2, 0.8,-0.75, 0], [-0.8,-1.7, 1.0,0, 0.25,-0.2, 0.9], [3.5,-0.2, -3.3,0, -0.7,0.8, 0], [1.0,0, -0.8,-1.7, -0.2,0.25, 0.9]. An alternative face swaps the carved face for squeezed slits and an "O" mouth. Facing = mirrored sprite.

Small creature (a two-tone root bulb, ~21 × 22 units, scale 0.92): three leaf blades (leafPath, length 8–10, width 2.5–2.9, centre groove), two root legs (capsules r 1.5, #e4caa0), a bulb body (cream base, spec 0.35, lit 0.12) with a second clay layer smeared on top — a wavy-bottomed purple shape painted inside the body's clip with its own AO and contact shadow. Two googly eyes (white clay balls 2.5 × 2.8 with black pupils #1e1420 and a white catch-light), angry brow capsules (#4a2852, r 0.75, cast 0.5), a pressed frown groove (width 0.7, alpha 0.55). Three colour variants: #8650ac, #b24c8e, #685cbe tops. Per-instance size 0.94 + seed * 0.12.

Fast floating creature (a glossy white sheet, ~20 × 24): one custom silhouette with a 3-scallop animated hem and a wispy tail, colour #eaf0fc shaded with dark: #96a4ce (cool shadow for a cool material), spec 0.55, gloss 0.5, lit 0.3, rim 0.3. Sad dark sockets #3a3c62, tiny white catch-lights, an "O" mouth whose height pulses. Two stubby arm ellipses. Drawn at alpha 0.84, floating 5 units up.

Large creature (a lumpy root giant, ~37 × 64): a 14-point lumpy body (amt 0.12, narrowing toward the top), extra lumps on shoulders and hips, capsule arms r 4.4 with three root-finger capsules, glowing cracks (3 strokes: #2c1218 1.5 → #ff9a3a 0.65 → #ffe9a6 0.25), a carved glowing core (cavity #3a1410, candle gradient offset +0.9 down), eyes as dark sockets with yellow #ffc94a irises, a jagged mouth, and an additive pulsing glow on the core. Four leaves on top.

Readability: creatures are lighter/glossier than the ground and always carry eyes; small creatures sit at ~0.6× the main character's height, large ones ~2×.

The clay() painter — the material illusion, in order:

StepWhatNumbers
Contact shadowthe shape filled with source-atop + shadow, so it only darkens parts already painted behind itrgba(52,22,24,0.42), blur min(0.4R, 2.4) units, offset (min(0.06R,0.45), min(0.2R,1.4))
Baseflat fill in the base colour, then clip to the shape—
Key lightradial gradient from (cx-0.25rx, cy-0.5ry) r 0.04R to (cx+0.05rx, cy+0.05ry) r 1.22Rstops 0: lighten(col, 0.2), 0.5: col, 1: darken(col, 0.4)
Fingerprintsthe 192 px tile as pattern, random offset per part (seeded)alpha 1 (0.5–0.6 on eyes/collectibles, 0 on tiny glossy parts)
Inner AOfill "big rect minus shape" (even-odd) 3000 units away; only its shadow falls back inside the cliprgba(58,20,40,0.5), blur 0.6R, offset (-0.1R, -0.3R) → darkens the bottom inner edge
Rim lightsame trick with a warm shadowrgba(255,247,230,0.42), blur 0.26R, offset (+0.04R, +0.12R) → glows along the top inner edge
Detailgrooves, faces, carved holes, painted inside the clip—
Soft specularradial blob at (cx-0.3rx, cy-0.52ry) r 0.45R, rotated -0.45 rad, scaled 1.4 × 0.8stops 0: rgba(255,255,252,spec), 0.45: spec*0.38, 1: 0; default spec 0.3
Gloss dot (optional)small ellipse inside the spec0.32 × 0.17 of spec radius, alpha gloss (0.4–0.85)

Parameters per part: lit (key light strength), dark (override shadow colour), ao, rim, spec, gloss, fp, cast, hi (highlight position/radius).

Props

Props use the same clay() painter and back-to-front assembly as the characters (contact shadows between parts, pressed grooves for detail, broad soft spec, glossy dots only on berries). Each prop has a fixed soft plum-brown shadow ellipse and 2–4 baked variants.

Effects and particles

Atmosphere and lighting

UI

The HUD is made of the same clay: slabs with thickness. Panels use a cream radial gradient, an inner white top highlight, an inner brown bottom shadow, a solid 5–8 px darker base (0 5px 0 #b98654) for thickness and a soft drop shadow. Border radii are deliberately uneven (26px 30px 24px 28px / 28px 24px 30px 26px) so nothing is machine-perfect. Bars are pressed grooves (dark brown inset) with glossy pill fills and a blurred white highlight strip (red fill, or a gold variant #fff0a8 #ffd055 #f0a52c #c97c18). A faint thumbprint sits in a corner of each panel. Cards come in cream, green (#cde6ae) and lilac (#dcc6ee) clay; their icons are drawn with the same clay() painter at 48-unit icon space.

.clay-panel { position: relative; padding: 3px 30px 9px; border-radius: 26px 30px 24px 28px / 28px 24px 30px 26px;
  background: radial-gradient(120% 140% at 30% 18%, #fff5e2 0%, #f5ddb8 45%, #e0b98a 100%);
  box-shadow: inset 0 3px 3px rgba(255,255,255,.8), inset 0 -6px 10px rgba(150,88,40,.38),
    inset 4px 0 8px rgba(255,255,255,.25), 0 5px 0 #b98654, 0 13px 18px rgba(50,24,10,.38); }
.clay-panel::after { content: ''; position: absolute; right: 9px; bottom: 7px; width: 22px; height: 27px;
  border-radius: 50%; transform: rotate(-24deg); pointer-events: none;
  background: repeating-radial-gradient(ellipse at 50% 58%, rgba(120,66,26,.2) 0 1px, rgba(255,255,255,.22) 1px 2px, rgba(0,0,0,0) 2px 3.3px);
  -webkit-mask: radial-gradient(closest-side, #000 60%, transparent); mask: radial-gradient(closest-side, #000 60%, transparent); }
.clay-number { font-family: 'Chewy', 'Baloo 2', system-ui, sans-serif; font-size: 40px; letter-spacing: 2px; color: #f07a24;
  text-shadow: 0 2px 0 #c85e1a, 0 4px 0 #a84a12, 0 5px 0 #8c3c0e, 0 9px 10px rgba(40,18,6,.45); }
.clay-bar { position: relative; width: 250px; height: 30px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(180deg, #6a4430, #8a5c40 60%, #9f6e4e);
  box-shadow: inset 0 4px 7px rgba(30,12,4,.65), inset 0 -2px 2px rgba(255,220,180,.25),
    0 2px 0 rgba(255,236,210,.35), 0 8px 12px rgba(40,20,8,.32); }
.clay-bar > .fill { height: 100%; border-radius: 999px;
  background: linear-gradient(180deg, #ffab8f 0%, #f2613f 36%, #d23e26 72%, #a92c18 100%);   /* gold variant: #fff0a8 #ffd055 #f0a52c #c97c18 */
  box-shadow: inset 0 -4px 5px rgba(90,18,4,.45), inset 0 2px 2px rgba(255,220,200,.6); }
.clay-bar > .fill::after { content: ''; position: absolute; left: 12px; right: 16px; top: 5px; height: 5px;
  border-radius: 4px; background: rgba(255,255,255,.55); filter: blur(1px); }
.clay-button { border-radius: 999px; padding: 6px 26px 8px; color: #fff6e6; font-family: 'Chewy', sans-serif; font-size: 24px;
  background: radial-gradient(circle at 36% 30%, #ffc988, #f08a3a 60%, #c9621e); text-shadow: 0 2px 0 #9c4a16;
  box-shadow: inset 0 3px 3px rgba(255,255,255,.55), inset 0 -4px 6px rgba(120,40,0,.4), 0 5px 0 #9c4a16, 0 12px 16px rgba(20,8,2,.45); }
@keyframes clayWobble { 0%,100% { transform: none } 33% { transform: translate(-3px,1px) scale(1.04,.95) } 66% { transform: translate(3px,-1px) scale(.97,1.03) } }
@keyframes clayPop { 0% { transform: scale(.3,.1) rotate(-6deg); } 50% { transform: scale(1.15,.85) rotate(-1deg); }
  75% { transform: scale(.95,1.06) rotate(-3deg); } 100% { transform: scale(1) rotate(-2deg); } }
/* use with steps(): animation: clayPop .5s steps(6) backwards;  alert: clayWobble .26s steps(3) */

Motion and animation

Do and don't

Do

Don't

Implementation recipe

  1. Set a world unit scale: e.g. 360 units of screen height; main character ≈ 21 × 33 units with feet at the origin.
  2. Implement lighten, darken (toward #fffbf0 / #401a34), a seeded RNG and a 2D hash.
  3. Build the fingerprint tile (192 px) once.
  4. Implement the clay(ctx, shapeFn, colour, opts) painter exactly as in the table under Characters, with PK = px per unit of the target canvas.
  5. Add primitives: ellipse, capsule, lumpy blob (lumpPts 11 points, amt 0.06–0.25 + blobPath Catmull-Rom), and custom silhouettes; wrap them as cE, cCap, cLump.
  6. Add groove, eye and carve helpers.
  7. Design each character as an ordered list of parts (back limbs → body → front limbs → head → face). Give the head the strongest spec + gloss. Define 4 walk frames as small tables of foot/arm positions.
  8. Bake every frame of every figure to a canvas at K = clamp(round(pxPerUnit*1.2), 3, 5) with a unique seed; store mirrored and cream-flash copies.
  9. Build the ground: define material fields (noise or hand-painted masks), compute SDF bevel/shadow per pixel, multiply by the lumpy height modulator, then stamp decals. Cache in chunks.
  10. Per frame: ground → ground glows/splats → shadows → y-sorted sprites (with 12 fps boil transforms) → projectiles → particles → numbers → vignette overlay.
  11. Implement juice: crumbs, splats, squash on impacts and disappearing, cream flash, additive glows.
  12. Style the HTML UI with the clay-panel CSS, Chewy extruded numbers and steps() animations.

Code

The snippets below are the core techniques, ported from the module and runnable on their own. starter.js (next to this file) contains all of them wired together, plus the ground baker and a full preview scene; the complete reference module is ../../js/styles/clay.js.

// Shade helpers: highlights toward warm white, shadows toward plum.
const mix = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
const rgbS = (a, al) => al === undefined ? `rgb(${a[0] | 0},${a[1] | 0},${a[2] | 0})` : `rgba(${a[0] | 0},${a[1] | 0},${a[2] | 0},${al})`;
const lighten = (c, t) => mix(c, [255, 251, 240], t);
const darken = (c, t) => mix(c.map((v) => v * (1 - t)), [64, 26, 52], t * 0.3);
// The plasticine painter. PK = canvas px per world unit, FPC = fingerprint tile canvas, PR = seeded rng().
function clay(c, shape, col, o) {
  const [cx, cy, rx, ry] = o.b, R = Math.max(rx, ry), base = rgbS(col);
  if (o.cast !== 0) {                                   // soft contact shadow on parts already painted
    c.save(); c.globalCompositeOperation = 'source-atop';
    c.shadowColor = `rgba(52,22,24,${o.cast || 0.42})`; c.shadowBlur = Math.min(R * 0.4, 2.4) * PK;
    c.shadowOffsetX = Math.min(R * 0.06, 0.45) * PK; c.shadowOffsetY = Math.min(R * 0.2, 1.4) * PK;
    c.fillStyle = base; c.beginPath(); shape(c); c.fill(); c.restore();
  }
  c.save(); c.beginPath(); shape(c); c.fillStyle = base; c.fill(); c.clip();
  const g = c.createRadialGradient(cx - rx * 0.25, cy - ry * 0.5, R * 0.04, cx + rx * 0.05, cy + ry * 0.05, R * 1.22);
  g.addColorStop(0, rgbS(lighten(col, o.lit ?? 0.2))); g.addColorStop(0.5, base); g.addColorStop(1, rgbS(o.dark || darken(col, 0.4)));
  c.fillStyle = g; c.fillRect(cx - R * 2.5, cy - R * 2.5, R * 5, R * 5);
  if (o.fp !== 0 && FPC) {                              // fingerprints, random offset per part
    const pat = c.createPattern(FPC, 'repeat'); pat.setTransform(new DOMMatrix([1 / PK, 0, 0, 1 / PK, PR() * 60, PR() * 60]));
    c.globalAlpha = o.fp || 1; c.fillStyle = pat; c.fillRect(cx - R * 1.6, cy - R * 1.6, R * 3.2, R * 3.2); c.globalAlpha = 1;
  }
  const OFF = 3000;                                     // inner AO + rim: blurred shadows of the shape's OUTSIDE
  c.save(); c.beginPath(); c.rect(cx - R * 3 + OFF, cy - R * 3, R * 6, R * 6); c.translate(OFF, 0); shape(c); c.translate(-OFF, 0);
  c.fillStyle = '#000';
  c.shadowColor = `rgba(58,20,40,${o.ao ?? 0.5})`; c.shadowBlur = R * 0.6 * PK;
  c.shadowOffsetX = -OFF * PK - R * 0.1 * PK; c.shadowOffsetY = -R * 0.3 * PK; c.fill('evenodd');
  if (o.rim !== 0) {
    c.shadowColor = `rgba(255,247,230,${o.rim ?? 0.42})`; c.shadowBlur = R * 0.26 * PK;
    c.shadowOffsetX = -OFF * PK + R * 0.04 * PK; c.shadowOffsetY = R * 0.12 * PK; c.fill('evenodd');
  }
  c.restore();
  if (o.detail) { c.save(); o.detail(c); c.restore(); }
  const sp = o.spec ?? 0.3;
  if (sp > 0) {                                         // broad, tilted soft specular (+ optional gloss dot)
    const h = o.hi || [cx - rx * 0.3, cy - ry * 0.52, R * 0.45];
    c.save(); c.translate(h[0], h[1]); c.rotate(-0.45); c.scale(1.4, 0.8);
    const sg = c.createRadialGradient(0, 0, 0, 0, 0, h[2]);
    sg.addColorStop(0, `rgba(255,255,252,${sp})`); sg.addColorStop(0.45, `rgba(255,253,244,${sp * 0.38})`); sg.addColorStop(1, 'rgba(255,252,240,0)');
    c.fillStyle = sg; c.beginPath(); c.arc(0, 0, h[2], 0, Math.PI * 2); c.fill();
    if (o.gloss) { c.fillStyle = `rgba(255,255,255,${o.gloss})`; c.beginPath(); c.ellipse(-h[2] * 0.1, -h[2] * 0.06, h[2] * 0.32, h[2] * 0.17, 0, 0, Math.PI * 2); c.fill(); }
    c.restore();
  }
  c.restore();
}
// Lumpy hand-rolled ball: 11 jittered points joined by a closed Catmull-Rom spline.
function lumpPts(cx, cy, rx, ry, n, amt, r) {
  const pts = [], ph = r() * Math.PI * 2;
  for (let i = 0; i < n; i++) {
    const a = (i / n) * Math.PI * 2, k = 1 + (r() - 0.5) * amt + Math.sin(a * 3 + ph) * amt * 0.25;
    pts.push([cx + Math.cos(a) * rx * k, cy + Math.sin(a) * ry * k]);
  }
  return pts;
}
function blobPath(c, pts) {
  const n = pts.length; c.moveTo(pts[0][0], pts[0][1]);
  for (let i = 0; i < n; i++) {
    const p0 = pts[(i - 1 + n) % n], p1 = pts[i], p2 = pts[(i + 1) % n], p3 = pts[(i + 2) % n];
    c.bezierCurveTo(p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6, p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6, p2[0], p2[1]);
  }
  c.closePath();
}
// Pressed groove (ribs, folds, wood grain): dark furrow + light lip below.
function groove(c, path, w, a) {
  c.lineCap = 'round'; c.strokeStyle = `rgba(58,22,18,${a})`; c.lineWidth = w; c.beginPath(); path(c); c.stroke();
  c.save(); c.translate(0, w * 0.55); c.strokeStyle = `rgba(255,240,220,${a * 0.75})`; c.lineWidth = w * 0.5;
  c.beginPath(); path(c); c.stroke(); c.restore();
}
// Carved hole with candle light shifted down (wall thickness).
function carve(c, path, glow) {
  c.save(); c.beginPath(); path(c); c.fillStyle = '#4e1606'; c.fill(); c.clip();
  c.translate(0.15, 0.8); c.beginPath(); path(c); c.fillStyle = glow; c.fill(); c.restore();
}
// Raised clay sheet edge, per pixel. dist = signed distance in px (>0 inside), ld = edge facing light (-1..1),
// bwPx/swPx = bevel 3.0 and shadow 3.4 world units in px. Returns new [r,g,b] over the colour underneath.
function sheetPixel(under, layer, dist, ld, bwPx, swPx) {
  let [r, g, b] = under;
  if (dist < 0.5) {                                   // cast shadow just outside the sheet
    let sh = 1 + dist / swPx;
    if (sh > 0) { sh = Math.min(1, sh); const k = 0.4 * sh * sh * (0.35 + 0.65 * Math.max(0, -ld)); r *= 1 - k; g *= 1 - k; b *= 1 - k; }
  }
  if (dist > -0.5) {                                  // lit bevel + bright crest inside the edge
    const cov = Math.min(1, dist + 0.5), p = Math.max(0, Math.min(1, 1 - dist / bwPx)), cr = (p - 0.55) / 0.22;
    const f = 1 + ld * 0.42 * p * p + 0.09 * Math.exp(-cr * cr) - 0.03 * p * p * p;
    r += (layer[0] * f - r) * cov; g += (layer[1] * f - g) * cov; b += (layer[2] * f - b) * cov;
  }
  return [r, g, b];                                   // afterwards multiply by (1 + MOD * m) for the lumpy surface
}

Adapting it to your project

Performance notes

Copy-paste prompt

Use the Clay World art style for my project (stop-motion plasticine miniature set):
- Canvas 2D, procedural, no image assets, no outlines anywhere.
- Every body part goes through one clay() painter: flat base, radial key-light gradient from the upper-left
  (lighten 0.2 toward #fffbf0 -> base at 0.5 -> darken 0.4 toward plum #401a34 at 1.22R), a tiled faint fingerprint
  pattern, inner ambient occlusion rgba(58,20,40,0.5) along the bottom and a warm rim rgba(255,247,230,0.42) along the
  top (both made with blurred offset shadows of the shape's outside), then a broad soft specular tilted -0.45 rad.
- Characters are chunky toy assemblies of lumpy balls, capsules and blobs painted back to front; each part casts a
  soft contact shadow onto parts behind it. Big glossy heads, googly white-clay eyes or carved glowing faces.
- Details are pressed grooves (dark furrow + light lip below), never drawn lines. Props (trees, fences, rocks) the same way.
- Ground: flat clay sheets (meadow #76a454, purple #66507e, soil #986c4a, ochre path #d6a262, sunken pond #7ebad2)
  with raised bevelled edges (3 units), soft cast shadows (3.4 units), light from (-0.42,-0.907), a lumpy hand-pressed
  height texture, and imprinted decals (grass tool marks, flowers, pebbles, thumbprints, lily pads, glossy reflections).
- Warm studio lighting: soft plum-brown ellipse shadows under figures, additive candle glow (#fff7c4 -> #ffd458 -> #ff8f22),
  warm brown vignette.
- Bake all sprites once at 3-5 px per world unit, one seeded bake per animation frame (boil); animate at 12 fps steps
  with small hash jitter in scale/rotation; squash and stretch on steps and impacts; clay crumb particles and splats.
- UI: cream clay slabs with inner highlight/shadow, a solid darker base for thickness, uneven border radii, Chewy
  extruded numbers (#f07a24 with stacked darker text-shadows), Baloo 2 body text, steps() animations.