From 2f4a89fd3f5a78645d8ebd635ab30d465c969619 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Tue, 23 Jun 2026 20:06:01 -0600 Subject: [PATCH] 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. --- public/src/games/paigow/PaiGowPokerGame.js | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/public/src/games/paigow/PaiGowPokerGame.js b/public/src/games/paigow/PaiGowPokerGame.js index 5c0f8de..f8432d0 100644 --- a/public/src/games/paigow/PaiGowPokerGame.js +++ b/public/src/games/paigow/PaiGowPokerGame.js @@ -426,14 +426,39 @@ export default class PaiGowPokerGame extends Phaser.Scene { showHandSetPanel() { this.panelVisible = true; + this.animating = 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 t of Object.values(this.nameTxts)) 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(); - this.updateHandSetUI(); + + // Grab the face-up seat cards that were just dealt + 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() {