움직임 더하기 2차: 루미큐브·마피아·라이어·바둑·클루·오목·포커

- 루미큐브: 옮긴 타일이 원래 자리에서 미끄러져 가고, 남이 바닥에 낸 타일은 그 사람 칸에서 날아옴. 가져온 타일은 남은 타일 더미에서 받침대로 날아오고, 남이 가져가면 뒤집힌 타일이 그 사람 칸으로 날아감. 배너를 공통 useBanner로 바꾸고 "루미큐브!"·"판 끝"·승리 배너 추가
- 마피아: 밤에는 화면이 남색으로 어두워지며 달, 아침에는 해가 떠오름. 득표 막대가 한 줄씩 자라고, 탈락한 사람 칸이 뒤집히며 흐려짐. 탈락·살았다·버텼다·조용한 밤·이긴 팀 배너를 차례로
- 라이어: 득표가 한 줄씩 나온 뒤 지목된 사람에게 스포트라이트와 흔들림, "잡았다!"/"헛다리!"·동점·정답/땡·승리 배너
- 바둑: 패스·계가 배너, 계가 때 집 표시가 차례로 나타나고 결과 점수가 0부터 올라감, 승리 배너
- 클루: 말과 흉기가 새 자리로 튀어 오르며 미끄러져 감, 추리한 세 장이 사건 봉투로 날아가고, 보여 준 카드는 뒤집히며(남에게는 뒷면 카드가 날아감)
- 오목: 금수 자리를 누르면 빨간 ✕와 "금수" 글자, 판이 흔들림(키보드 Enter도 같은 안내). "오목!"·승패 배너
- 포커: 쇼다운·인디언 이마 카드가 뒷면이 돌아간 뒤 앞면이 돌아 나오는 진짜 뒤집기로
- 모두 누구의 행동이든 화면 변화에 반응하고, 클릭을 막지 않으며, 동작 줄이기 설정을 따름. 게임 문서 UI 절에 반영

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-13 22:36:44 +09:00
parent d35b7207a3
commit 843786f687
14 changed files with 539 additions and 83 deletions

View File

@@ -89,6 +89,9 @@ const CSS = `
.pk-slot { width: 44px; height: 62px; }
.pk-actions { grid-template-columns: repeat(2, 1fr); }
}
/* The face-down copy that turns away when a card is turned over (see turnOver). */
.pk-back { position: fixed; z-index: 60; pointer-events: none; box-sizing: border-box; border-radius: 9% / 6.4%; background: #1e3a8a; border: 2px solid #fff;
box-shadow: inset 0 0 0 3px #1e3a8a, inset 0 0 0 5px #93c5fd, 0 1px 3px rgba(0,0,0,.3); backface-visibility: hidden; }
`;
// ---------------------------------------------------------------- seats
@@ -320,6 +323,35 @@ function flipIn(el: Element | null | undefined, delay = 0): void {
);
}
/**
* A face-down card turned face up (showdown, 인디언 forehead): a face-down copy turns away on top of it, then the real
* (already face-up) card turns in. The copy is fixed-position, never takes clicks and is removed when done.
*/
function turnOver(el: Element | null | undefined, delay = 0): void {
if (!el || reducedMotion() || typeof (el as HTMLElement).animate !== 'function') return;
const r = el.getBoundingClientRect();
if (!r.width || !r.height) return;
const half = 180;
const back = document.createElement('div');
back.className = 'pk-back';
back.setAttribute('aria-hidden', 'true');
Object.assign(back.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });
document.body.appendChild(back);
const a = back.animate([{ transform: 'perspective(600px) rotateY(0deg)' }, { transform: 'perspective(600px) rotateY(-90deg)' }], { duration: half, delay, easing: 'ease-in', fill: 'both' });
const done = () => back.remove();
a.onfinish = done;
a.oncancel = done;
setTimeout(done, delay + half + 1500);
(el as HTMLElement).animate(
[
{ transform: 'perspective(600px) rotateY(90deg)' },
{ transform: 'perspective(600px) rotateY(-12deg)', offset: 0.65 },
{ transform: 'perspective(600px) rotateY(0deg)' },
],
{ duration: 300, delay: delay + half, easing: 'ease-out', fill: 'backwards', composite: 'add' },
);
}
/** The card elements of a seat on the table (forehead, hole, choice, up — same order as SeatCards). */
const seatCardEls = (id: string): Element[] => [...(seatEl(id)?.querySelector('[data-fx="seat-cards"]')?.children ?? [])];
const myCardEl = (slot: string) => document.querySelector(`[data-fx="poker-mine"] [data-slot="${cssEsc(slot)}"]`);
@@ -418,20 +450,20 @@ function usePokerFx(v: PokerView, me: string | null, players: Record<string, Pub
if (!s || s.id === me) continue;
const els = seatCardEls(s.id);
const off = s.forehead !== undefined ? 1 : 0;
const at = t + n * 160;
for (let i = 0; i < s.hole.length; i++) flipIn(els[off + i], at + i * 40);
later(at, sfx.cardFlip);
const at = t + n * 220;
for (let i = 0; i < s.hole.length; i++) turnOver(els[off + i], at + i * 60);
later(at + 120, sfx.cardFlip);
n++;
}
t += n * 160 + 100;
t += n * 220 + 200;
}
// 인디언: my own forehead card is shown at the end of the hand.
const myNow = v.seats.find((s) => s.id === me);
const myBefore = p.seats.find((s) => s.id === me);
if (myNow?.forehead && myBefore && !myBefore.forehead) {
flipIn(myCardEl('f'), t);
later(t, sfx.cardFlip);
t += 160;
turnOver(myCardEl('f'), t);
later(t + 120, sfx.cardFlip);
t += 300;
}
}