From: Benjamin Auder Date: Sun, 21 Nov 2021 16:11:56 +0000 (+0100) Subject: Attempt to fix Recycle animation X-Git-Url: https://git.auder.net/js/pieces/scripts/current/css/rpsls.css?a=commitdiff_plain;h=bc34b505e536fc0d66747197fbb62b5ea1f85721;p=xogo.git Attempt to fix Recycle animation --- diff --git a/TODO b/TODO index 80ad450..a70fd21 100644 --- a/TODO +++ b/TODO @@ -7,3 +7,6 @@ Checkered-Teleport ? add mode diagram --> use vchess rules (only english? only french?) add variants : Chakart first (dark,cylinder) + +Recycle : pawns fall out of board on 8th rank. +captureKing : property, == this.taking || this.options["dark"] diff --git a/base_rules.js b/base_rules.js index a39cc0a..6303060 100644 --- a/base_rules.js +++ b/base_rules.js @@ -2145,6 +2145,7 @@ export default class ChessRules { const maxDist = Math.sqrt((this.size.x - 1)** 2 + (this.size.y - 1) ** 2); const multFact = (distance - 1) / (maxDist - 1); //1 == minDist const duration = 0.2 + multFact * 0.3; + const initTransform = startPiece.style.transform; startPiece.style.transform = `translate(${arrival[0] + rs[0]}px, ${arrival[1] + rs[1]}px)`; startPiece.style.transitionDuration = duration + "s"; @@ -2154,6 +2155,10 @@ export default class ChessRules { if (this.options["rifle"]) startArray[i1][j1].style.opacity = "1"; startPiece.remove(); } + else { + startPiece.style.transform = initTransform; + startPiece.style.transitionDuration = "0s"; + } callback(); }, duration * 1000