mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:50:43 +00:00
Refactor interpolation logic in TerritoryLayer for accurate animation timing
- Adjusted the denominator calculation for interpolation to use the actual tick interval, allowing animations to scale correctly with tick speed. - Removed the previous 250ms cap that caused early animation completion at slower tick speeds, improving visual fidelity during territory transitions.
This commit is contained in:
@@ -632,7 +632,9 @@ export class TerritoryLayer implements Layer {
|
||||
toTime = this.tickTimeMsPrev;
|
||||
}
|
||||
|
||||
const denom = Math.max(1, Math.min(250, toTime - fromTime));
|
||||
// Use the real tick interval so interpolation duration scales with tick speed.
|
||||
// The previous 250ms cap caused slow tick speeds (e.g. 0.5x) to finish animations early.
|
||||
const denom = Math.max(1, toTime - fromTime);
|
||||
const progress = Math.max(0, Math.min(1, (renderTime - fromTime) / denom));
|
||||
|
||||
this.lastInterpolationPair = pair;
|
||||
|
||||
Reference in New Issue
Block a user