refactor(onitama): extract tweens into factory functions

Centralize Onitama animation logic by moving inline Phaser tweens
into a dedicated `tweens.ts` configuration file. This improves
reusability and cleans up spawners and renderers.

Also updated documentation to warn against adding interruptions to
looped tweens to prevent game logic hangs.
This commit is contained in:
2026-04-19 12:45:05 +08:00
parent 3568d99e6e
commit c25759d147
9 changed files with 440 additions and 179 deletions
@@ -9,11 +9,11 @@ import type Phaser from "phaser";
import {
COLORS,
FONTS,
ANIMATIONS,
MENU_BUTTON,
getBoardCenter,
getCardLabelPosition,
colorToStr,
createWinnerPulseTween,
} from "@/config";
import { prompts } from "@/game/onitama";
import {
@@ -304,12 +304,6 @@ export class OnitamaScene extends GameHostScene<OnitamaState> {
this.winnerOverlay.add(winText);
this.tweens.add({
targets: winText,
scale: 1.2,
duration: ANIMATIONS.winnerPulse,
yoyo: true,
repeat: 1,
});
createWinnerPulseTween(this, winText);
}
}