Repository navigation
入れ替えたパネルを描画の上で元の位置から滑らせ、1 フレームで 1 マス跳んで見えていたのを滑らかにする - #88
Merged
Merged
Conversation
…えていたのを滑らかにする。tick は handleInput のあと updateCells なので swapping の状態は draw から一度も見えず、timer から横ずれを出す式は常に 0 だった。swap のイベントに左の列と行を足し、BoardView が [行][列] の残りのずれ(px)に来た向きの 1 マスを積んで、毎フレーム時定数 SWAP_SLIDE_MS(20ms。1 フレーム後 43%、4 フレーム後 3%)で指数的に減らす。論理は今までどおり 1 tick で確定するので決定論と GAME_VERSION は変えない。残りのずれをセルの object でなく位置に持つのは、オンラインの予測が確定盤面を複製するたびにセルを作り直すため。せり上がりで行がずれたら一緒にずらし、タッチの白枠も同じずれで動かす。実機で長さを試せるよう ?slide=<ms> で変えられる Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
プレビュー: https://swaprise-pr-88.uphy.workers.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
何をなぜ
#87 で入れ替えを 1 フレームにしてから、パネルが 1 フレームで 1 マス跳んで見えていた。tick は handleInput → updateCells の順なので
swappingの状態は draw から一度も見えず、timer から横ずれを出していた式が常に 0 になっていたのが原因。SWAP_SLIDE_MS(20ms)で指数的に減らす。1 フレーム後 43%、2 フレーム後 19%、4 フレーム後 3% で、原作の 4 フレームの滑りと同じ長さに見える。120Hz の端末では中間の絵が自然に 2 枚出る?slide=<ms>で変えられる(?slide=0で今までどおり跳ぶ)素早くなぞると見た目は論理より時定数ぶん遅れる(1 マス 50ms の速さで約 0.4 マス)。#86 で問題だった「入れ替えが始まるまでの 80ms」は戻らない。
確認したこと
pnpm typecheck・pnpm test(256 件)pnpm e2e e2e/swap-slide.spec.ts e2e/touch.spec.ts e2e/game.spec.ts(17 件)。新しい spec は入れ替え直後のパネルの絵の x が途中にあり、次のフレームで近づき、やがて揃うことを確かめる🤖 Generated with Claude Code