aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/main.js
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-03 19:41:34 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-03 19:41:34 +0900
commit75796bb956d8aedc35e004f620f10ab137eb0216 (patch)
tree17ea2fb125c08cf0c379dad1b3e54eb0afc0682e /public/bluebey-studio/src/main.js
parente530565430622f7d1e824d27b6dc26d95024eb6f (diff)
public/bluebey-studio: ひげをテクスチャに、舌を外に出すを削除
ひげの種類に画像(assets/beards/<kind>.png)があれば、それを使って描くようにした。まず「ちょびひげ」を追加。画像が無い種類は今までどおり描画で出す。 「舌を外に出す」「外に出す舌の位置」を削除した。 「すべてをランダムに」は、スタイル(実写・フラット・線画)と左右反転を変えないようにし、後ろを向く・大きく傾くポーズは選ばないようにした。アイコンを「?!」に変更。
Diffstat (limited to 'public/bluebey-studio/src/main.js')
-rw-r--r--public/bluebey-studio/src/main.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js
index 051554d..b94fca0 100644
--- a/public/bluebey-studio/src/main.js
+++ b/public/bluebey-studio/src/main.js
@@ -50,6 +50,10 @@ function assetUrl(file, kind) {
const backdrops = globalThis.__BLUEBEY_BACKGROUNDS__ ?? {};
return backdrops[file] ?? `assets/backgrounds/${file}.webp`;
}
+ if (kind === 'beard') {
+ const beards = globalThis.__BLUEBEY_BEARDS__ ?? {};
+ return beards[file] ?? `assets/beards/${file}`;
+ }
return inlined[file] ?? `assets/fonts/${file}`;
}
@@ -385,6 +389,29 @@ async function init() {
});
const animator = new Animator({ state });
+ // Beard drawings supplied as files (`assets/beards/<kind>.png`): a kind that has
+ // one is drawn from the file instead of the built-in strokes. A missing file is
+ // skipped, so the app works before any are added.
+ void (async () => {
+ // Only the kinds that actually ship a drawing. Add a name here when its file is
+ // added to assets/beards/, so no 404s are logged for the ones without one.
+ const kinds = ['scotch'];
+ const loaded = {};
+ await Promise.all(kinds.map(async (kind) => {
+ try {
+ const response = await fetch(assetUrl(`${kind}.png`, 'beard'));
+ if (!response.ok) return;
+ loaded[kind] = await createImageBitmap(await response.blob());
+ } catch {
+ /* no drawing for this kind: the built-in one is used */
+ }
+ }));
+ if (Object.keys(loaded).length) {
+ face.setBeardImages(loaded);
+ app.needsRender = true;
+ }
+ })();
+
// ------------------------------------------------------------------- look
const look = createLook({
renderer,