games-arrows: end clear animation at the board edge
- Commit
666d10db7c07059c117f404ecc403cd48c3e8f45- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-07 20:08 UTC (29 days ago)
- Parents
04e30d5
A clearing arrow animated to advance + route.size cells. The route already includes the head's escape path, so that counted the path twice: after the arrow had visibly left, the move kept running (with taps locked out) for up to a whole extra board crossing at 45ms per cell before commitMove removed it. Animate to route.size instead - the advance at which the tail itself is one cell past the last route cell and off the board - and size the duration from the same distance.
Diff
games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/components/ArrowsBoard.kt
diff --git a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/components/ArrowsBoard.kt b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/components/ArrowsBoard.ktindex df33419e3f..d9466580bb 100644--- a/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/components/ArrowsBoard.kt+++ b/games/arrows/src/main/java/com/vayunmathur/games/arrows/ui/components/ArrowsBoard.kt@@ -81,9 +81,13 @@ fun ArrowsBoard( LaunchedEffect(move) { if (move == null) return@LaunchedEffect if (move.clears) {- // Past the end of the route, so the tail clears the edge too rather than winking out on it.- val target = (move.advance + move.route.size).toFloat()- advance.animateTo(target, tween(cellMillis(move.advance + move.route.size), easing = LinearEasing))+ // One past the end of the route, so the tail clears the edge too rather than winking+ // out on it. The route already ends with the head's escape path, so its size alone is+ // the distance that takes the tail out; adding `move.advance` counted that path twice+ // and kept the (by then invisible) arrow animating - and taps locked - for up to a+ // whole extra board crossing after it had left.+ val target = move.route.size.toFloat()+ advance.animateTo(target, tween(cellMillis(move.route.size), easing = LinearEasing)) } else { // Wedged arrows still get a nudge, or a tap on one reads as the game ignoring the input. val target = if (move.advance == 0) NUDGE_CELLS else move.advance.toFloat()