diff options
Diffstat (limited to 'public/bluebey-studio/src/faceArt.js')
| -rw-r--r-- | public/bluebey-studio/src/faceArt.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/public/bluebey-studio/src/faceArt.js b/public/bluebey-studio/src/faceArt.js index 9d5e20d..671ed1d 100644 --- a/public/bluebey-studio/src/faceArt.js +++ b/public/bluebey-studio/src/faceArt.js @@ -679,6 +679,25 @@ function drawBrow(ctx, eye, spec, style, limits = WINDOW_LIMITS) { // one away from the nose. `layout.offsetX` is the resting inset from the // artwork (which the old code read off the wrong object, so it never applied). const cx = eye.cx + eye.towardNose * (layout.offsetX - (brow.spacing ?? 0)); + + // A supplied drawing (assets/brows/gol-right.png, the model's right brow only) + // replaces the strokes: like the textured ひげ it is drawn twice, mirrored, at + // `cx`, and tinted with the brow colour. + const entry = style.brows?.gol; + if (brow.image && entry?.image) { + const sprite = tintedSprite(entry.image, brow.color ?? '#2a1e33'); + const sw = sprite.width || 1; + const sh = sprite.height || 1; + const drawW = Math.max(4, length); + const drawH = drawW * (sh / sw); + ctx.save(); + ctx.translate(cx, cy); + // The drawing is the model's right brow, so the other eye gets it mirrored. + ctx.scale(eye.towardNose >= 0 ? 1 : -1, 1); + ctx.drawImage(sprite, -drawW / 2, -drawH / 2, drawW, drawH); + ctx.restore(); + return; + } const angle = (((brow.angle ?? 0) + (spec.browAngle ?? 0)) * eye.towardNose * Math.PI) / 180; const half = length / 2; const from = { x: cx - Math.cos(angle) * half, y: cy - Math.sin(angle) * half }; @@ -1486,7 +1505,7 @@ export function drawMouth(ctx, p) { // use the whole canvas: a very wide mouth used to smear sideways off the plate. const cornerReach = L.corner.toX * cornerAmount; const halfChord = Math.min( - L.halfChord * clamp(p.width ?? 1, 0.2, 1.6), + L.halfChord * clamp(p.width ?? 1, 0.2, 1.6) * clamp(p.length ?? 1, 0.2, 2.5), Math.min(L.centreX - (edgeLeft + cornerReach), (edgeRight - cornerReach) - L.centreX), ); |
