Stage 5a fixes a drift bug from Stage 5:
after letters assembled at home, they continued to wander
due to the random-walk code still running each frame.
The bug (Stage 5)
Once assembly completed, assembling was reset to
false but running stayed
true. The old guard in
moveLetter() was:
if (assembling && s.isHome) return;
With assembling = false, the condition
was never true, so every home letter still ran the random-walk
branch and drifted away from its position.
The fix (Stage 5a)
The guard is now unconditional:
if (s.isHome) return;
Once s.isHome is set to true the
letter's position is never touched again — only
SWCharacter.update(dt) runs (for breathing).
The word stays perfectly in formation and breathes in
synchronized unison indefinitely.
All Stage 5 / Stage 4 features retained
- Assemble button — letters arc home with smooth steering.
- Unison breathe — phase reset + average speed applied on arrival.
- Letter echoes (canvas trail) + bug trail path polylines.
- Grid hidden by default (G to toggle).
- Random walk blended with Perlin noise (0–100 slider).
- Letter color picker + Randomize switch.
- Space toggles Start / Stop.