Carte che volano: dalla mano al tavolo e, finita la presa, sul mucchietto di chi ha preso (briscola, tressette, scopa; Andrea: «non si capisce quando vengono buttate le carte»). Il valzer della balera ai tavoli da carte (tools/valzer_carte.py: fisarmonica musette, basso, melodia di mandolino col tremolo), musica per primo piano; video «Come si gioca»: cache del Chromium della VM spenta, narratore e personaggi a turno, musica di sottofondo, pronunce del narratore
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1dxvtsZx8NE9fwjXUNDBr
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import { canPlay, cardName, counted, countRows } from './briscola.js';
|
||||
import { canPlay, cardName, counted, countRows, PLAY_TIME, TRICK_HOLD, TRICK_TIME } from './briscola.js';
|
||||
import { text, panel } from './bocce-render.js';
|
||||
|
||||
// Una carta in volo da un rettangolo [x, y, w, h] a un altro, con k da 0 a 1 (parte svelta, arriva piano).
|
||||
// La usano anche tressette e scopa.
|
||||
export function flight(from, to, k) {
|
||||
const e = 1 - (1 - Math.min(1, Math.max(0, k))) ** 3;
|
||||
return from.map((v, i) => v + (to[i] - v) * e);
|
||||
}
|
||||
// Coordinate condivise da disegno e hit test: bersagli larghi anche sul telefono.
|
||||
export const HAND = { x: 176, y: 230, gap: 102, w: 84, h: 120 };
|
||||
export function cardAt(c, [x, y]) {
|
||||
@@ -285,9 +291,13 @@ export function drawBriscola(ctx, c, def) {
|
||||
text(ctx, 'Prese', 550, y + 72, 6, paper, 'center');
|
||||
}
|
||||
c.table.forEach((p, i) => {
|
||||
// Il brevissimo scorrimento precede il fermo della presa.
|
||||
const slide = i === c.table.length - 1 ? Math.max(0, 1 - c.t / 0.18) : 0;
|
||||
drawCard(ctx, p.card, 242 + i * 86, 130 + slide * (p.who === 'player' ? 60 : -40), 64, 92);
|
||||
// La carta vola dalla mano di chi la gioca; finita la presa, tutte e due volano sulle prese di chi ha preso.
|
||||
const spot = [242 + i * 86, 130, 64, 92];
|
||||
const hand = p.who === 'player' ? [HAND.x + (p.from ?? 1) * HAND.gap, HAND.y, HAND.w, HAND.h] : [229 + (p.from ?? 1) * 62, 49, 52, 74];
|
||||
let r = spot;
|
||||
if (i === c.table.length - 1 && c.step === 'play' || c.step === 'trick' && i === 1 && c.t < PLAY_TIME) r = flight(hand, spot, c.t / PLAY_TIME);
|
||||
if (c.step === 'trick' && c.t > TRICK_HOLD) r = flight(spot, [526, c.last.winner === 'cpu' ? 74 : 257, 42, 60], (c.t - TRICK_HOLD) / (TRICK_TIME - TRICK_HOLD - 0.05));
|
||||
drawCard(ctx, p.card, ...r);
|
||||
});
|
||||
c.hands.player.forEach((card, i) => {
|
||||
const x = HAND.x + i * HAND.gap;
|
||||
|
||||
Reference in New Issue
Block a user