diff options
Diffstat (limited to 'public/bluebey-studio/src/main.js')
| -rw-r--r-- | public/bluebey-studio/src/main.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js index 548be76..3f61ad5 100644 --- a/public/bluebey-studio/src/main.js +++ b/public/bluebey-studio/src/main.js @@ -54,6 +54,10 @@ function assetUrl(file, kind) { const beards = globalThis.__BLUEBEY_BEARDS__ ?? {}; return beards[file] ?? `assets/beards/${file}`; } + if (kind === 'brow') { + const brows = globalThis.__BLUEBEY_BROWS__ ?? {}; + return brows[file] ?? `assets/brows/${file}`; + } return inlined[file] ?? `assets/fonts/${file}`; } @@ -420,6 +424,30 @@ async function init() { } })(); + // Brow drawings supplied as files (`assets/brows/<kind>.png`). A file ending + // `-right.png` is one side; it is drawn twice (mirrored) at each eye. Missing + // files are skipped, so the built-in ゴル風 strokes are the fallback. + void (async () => { + const files = [{ kind: 'gol', file: 'gol-right.png' }]; + const loaded = {}; + await Promise.all(files.map(async ({ kind, file }) => { + try { + const response = await fetch(assetUrl(file, 'brow')); + if (!response.ok) return; + loaded[kind] = { + image: await createImageBitmap(await response.blob()), + half: file.endsWith('-right.png'), + }; + } catch { + /* a missing drawing falls back to the built-in strokes */ + } + })); + if (Object.keys(loaded).length) { + face.setBrowImages(loaded); + app.needsRender = true; + } + })(); + // ------------------------------------------------------------------- look const look = createLook({ renderer, |
