병합: 움직임 더하기 2차(루미큐브·마피아·라이어·바둑·클루·오목·포커)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user