* Characters to advance per tick as a function of how far the reveal is behind. * Small backlogs trickle (2–8 chars); large backlogs accelerate but stay capped * so a burst is spread over several ticks rather than dumped at once.
(remaining: number)
| 18 | * so a burst is spread over several ticks rather than dumped at once. |
| 19 | */ |
| 20 | function step(remaining: number): number { |
| 21 | if (remaining <= 12) return 2 |
| 22 | if (remaining <= 48) return 4 |
| 23 | if (remaining <= 96) return 8 |
| 24 | return Math.min(24, Math.ceil(remaining / 8)) |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Advance from `start` by `step(...)`, then extend up to 8 more characters to |