feat: animate cards from dealt position to hand-setting panel

Add a smooth tween animation when opening the hand-setting panel,
transitioning the 7 dealt cards from their seat positions to the
panel's source area instead of snapping them into place. This
improves the visual flow between the dealing and setting phases.
This commit is contained in:
Brian Fertig 2026-06-23 20:06:01 -06:00
parent 0435ad7c38
commit 2f4a89fd3f
1 changed files with 29 additions and 4 deletions

View File

@ -426,14 +426,39 @@ export default class PaiGowPokerGame extends Phaser.Scene {
showHandSetPanel() { showHandSetPanel() {
this.panelVisible = true; this.panelVisible = true;
this.animating = true;
for (const o of this.setPanelGroup) o.setVisible(true); for (const o of this.setPanelGroup) o.setVisible(true);
// Hide all portraits and their seat labels so they don't overlap the panel
for (const p of this.portraits) p?.hide?.(); for (const p of this.portraits) p?.hide?.();
for (const t of Object.values(this.nameTxts)) t.setVisible(false); for (const t of Object.values(this.nameTxts)) t.setVisible(false);
for (const t of Object.values(this.chipTxts)) t.setVisible(false); for (const t of Object.values(this.chipTxts)) t.setVisible(false);
// Build and place the 7 card containers in the source area
this.buildSetCardContainers(); // Grab the face-up seat cards that were just dealt
this.updateHandSetUI(); const seatCards = [...(this.seatCardGraphics[0] ?? [])];
const onAllArrived = () => {
// Swap animated seat cards for interactive panel cards
for (const c of seatCards) c.destroy();
this.seatCardGraphics[0] = [];
this.buildSetCardContainers();
this.updateHandSetUI();
this.animating = false;
};
if (!seatCards.length) { onAllArrived(); return; }
let done = 0;
seatCards.forEach((cont, i) => {
cont.setDepth(D.panel + 10);
this.tweens.add({
targets: cont,
x: this.sourceCardX(i),
y: SOURCE_Y,
duration: 380,
delay: i * 65,
ease: 'Back.easeOut',
onComplete: () => { if (++done === seatCards.length) onAllArrived(); },
});
});
} }
hideHandSetPanel() { hideHandSetPanel() {