diff options
Diffstat (limited to 'public/bluebey-studio/src/face.js')
| -rw-r--r-- | public/bluebey-studio/src/face.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/public/bluebey-studio/src/face.js b/public/bluebey-studio/src/face.js index c1a0c72..0813c54 100644 --- a/public/bluebey-studio/src/face.js +++ b/public/bluebey-studio/src/face.js @@ -38,6 +38,9 @@ export class Face { }; this.customNames = new Map(); + // Drawings supplied for a beard kind (assets/beards/<shape>.png). Loaded by the + // app; a kind without one falls back to the built-in drawing (see drawBeard). + this.beardImages = {}; this.eyeCanvas = makeCanvas(this.eyeLayout); this.mouthCanvas = makeCanvas(this.mouthLayout); this.eyeCtx = this.eyeCanvas.getContext('2d'); @@ -131,6 +134,16 @@ export class Face { return 'original'; } + /** + * Set the drawings used for the beards, keyed by beard kind (`scotch`, `kaiser`, + * `apron`, `cat`). Called by the app once the files are loaded; the next redraw + * picks them up. + */ + setBeardImages(map) { + this.beardImages = map ?? {}; + this.dirty = true; + } + /** `kind` is `'eyes'` or `'mouth'`; `source` is `'parametric'` or a variant key. */ setSource(kind, source) { if (kind === 'eyes') { @@ -201,6 +214,7 @@ export class Face { // ひげ is shared by the whole face as well. (鼻ちょうちん is a real 3D // object hung off the nose - see src/main.js - so it is not drawn here.) beard: p.eyes.beard, + beards: this.beardImages, // 眼鏡 / サングラス are shared by both eyes and drawn into this same // texture, so they travel with the other shared eye fields. glasses: p.eyes.glasses, |
