Commit 38adbafe authored by Mahmoud Aglan's avatar Mahmoud Aglan

feat: domino gameplay UI overhaul + fix animation origin

- Add fromPlayer param to animatePlacement (top for opponent, bottom for me)
- Rewrite buildLayout with semantic .dg-* class structure
- Full CSS for opponent bar, score ribbon, controls, board area
- Opponent back-tiles visual with removal animations
- Bot thinking indicator in opponent meta area
- Remove dead legacy DOM elements
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent db2e704d
......@@ -176,7 +176,7 @@ export class DominoBoard {
return null;
}
animatePlacement(tile, end, callback) {
animatePlacement(tile, end, callback, fromPlayer = 'me') {
const ep = end === 'left' ? this.layout.endpoints.left : this.layout.endpoints.right;
if (!ep) { callback?.(); return; }
......@@ -194,20 +194,21 @@ export class DominoBoard {
h = dbl ? TILE_W : TILE_H;
}
// Animate from the correct player's side
const startX = this.width / 2;
const startY = this.height + 40;
const duration = 320;
const startY = fromPlayer === 'me' ? this.height + 40 : -40;
const duration = 350;
const startTime = performance.now();
const animate = (now) => {
const t = Math.min((now - startTime) / duration, 1);
// Ease out cubic
// Ease out back (slight overshoot for satisfying snap)
const ease = 1 - Math.pow(1 - t, 3);
const x = startX + (ep.x - startX) * ease;
const y = startY + (ep.y - startY) * ease;
const scale = 1.3 + (1 - 1.3) * ease;
const alpha = 0.4 + 0.6 * ease;
const alpha = 0.3 + 0.7 * ease;
this.animatingTile = { tile, x, y, w, h, rotation: 0, scale, alpha };
this.draw();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment