Stage 4 builds on Stage 3a by adding the
ability to see each letter's bug trail — the path
the bug has actually traveled — drawn as a colored polyline
behind the letter glyph.
What's new in Stage 4
-
Show bug trails. When checked, each bug
records its last N positions and draws them as a polyline
in the same color as the letter. The line is drawn
under the glyph so the letter always appears
clearly at the tip of its own comet tail.
-
Trail length slider (10–200). Controls
how many past positions are kept. Short values give a
brief stub; long values create a sweeping comet tail.
Changes take effect immediately — the trail is trimmed or
allowed to grow to the new limit.
-
Wrap-break handling. When a letter crosses
an edge and wraps to the opposite side, a break is inserted
in the polyline so no line is drawn across the canvas.
Two independent trail systems
-
Letter echoes (canvas trail) — a translucent
background rectangle painted each frame instead of clearing.
This makes the entire glyph (including breathing/spinning)
leave a ghostly smear. Controlled by "Show letter echoes"
and the "Echo fade" slider.
-
Bug trails (path lines) — a precise polyline
tracing only the center point of each bug. This shows the
actual trajectory rather than an image smear. Controlled by
"Show bug trails" and the "Trail length" slider.
All Stage 3a features retained
- Grid hidden by default (G to toggle).
- Always wrap (Pac-Man torus).
- Random walk blended with Perlin noise (0–100 slider).
- Slow depth-breathe (5–12 s cycles).
- Letter color picker + Randomize switch.
- Space toggles Start / Stop.