diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 14:36:10 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 14:36:10 +0900 |
| commit | c23c8fb5c547540c0705bef900340c9a6e358126 (patch) | |
| tree | abe4787077265e9d32690183900126fadbc81d4e /public/bluebey-studio/src/animation.js | |
| parent | a1337fab526a9babd5c492537bd7aee4cc5e7d26 (diff) | |
public/bluebey-studio: 鼻ちょうちんを球に、寝ている動きを追加、見出しにアイコン
- 鼻ちょうちんを単純な球にし、奥行き(おくゆき)も設定できるように
- 「ねている」の動きを追加。呼吸に合わせて鼻ちょうちんが膨らみ・縮む
- 各タブの見出し(メニュー一覧)にアイコンを追加
- 操作案内の文言を実態(ぶるべーをドラッグで移動)に合わせて更新
Diffstat (limited to 'public/bluebey-studio/src/animation.js')
| -rw-r--r-- | public/bluebey-studio/src/animation.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/public/bluebey-studio/src/animation.js b/public/bluebey-studio/src/animation.js index 3233e43..e569d12 100644 --- a/public/bluebey-studio/src/animation.js +++ b/public/bluebey-studio/src/animation.js @@ -17,6 +17,7 @@ export class Animator { this.eyeOpen = 1; this.look = { x: 0, y: 0 }; this.idleWeight = 0; + this.snotScale = 1; } reset() { @@ -25,6 +26,7 @@ export class Animator { this.blinkPhase = -1; this.blinkTimer = 2; this.time = 0; + this.snotScale = 1; } update(dt) { @@ -35,11 +37,24 @@ export class Animator { const moving = (this.state.anim.mode ?? 'off') !== 'off'; this.idleWeight += ((moving ? 1 : 0) - this.idleWeight) * Math.min(1, step * 4); + // 鼻ちょうちん: while sleeping, the bubble swells on the out-breath and shrinks + // again. It is a real object (see src/main.js), so the motion is published here + // as a plain multiplier the render loop applies to the bubble's scale. + this.snotScale = (this.state.anim.mode ?? 'off') === 'sleep' + ? 0.45 + 0.55 * (0.5 - 0.5 * Math.cos(this.time * 1.3)) + : 1; + this.updateBlink(step); this.updateLook(step); } updateBlink(dt) { + if ((this.state.anim.mode ?? 'off') === 'sleep') { + // Asleep: the eyes stay shut, whatever the blink setting says. + this.eyeOpen = 0; + this.blinkPhase = -1; + return; + } if (!this.state.anim.blink) { this.eyeOpen = 1; this.blinkPhase = -1; @@ -128,6 +143,17 @@ export class Animator { return { bones, root }; } + if (mode === 'sleep') { + // Slow breathing: the body rises and settles, the flippers drift, and the + // bubble swells and shrinks (that swell is `snotScale`, read by the loop). + const breath = 0.5 - 0.5 * Math.cos(t * 1.3); + add('master', Math.sin(t * 0.65) * 1.1, 0, 0); + add('arm.l', 0, 0, Math.sin(t * 0.9) * 2.5); + add('arm.r', 0, 0, -Math.sin(t * 0.9) * 2.5); + root[1] += breath * 0.03; + return { bones, root }; + } + // Default: gentle breathing, as if standing there alive. add('master', Math.sin(t * 1.5) * 1.3, 0, Math.sin(t * 0.81) * 1.6); add('arm.l', 0, 0, Math.sin(t * 1.28) * 4.5); |
