festifun/plan/lane-J-ribbons.md
type-two 56e569fd7a Plan: Phase 6 spec + directives round 6 (M18-M24 Friend Tracks, lanes H/J/K)
Markers/badges -> detection -> cross-view triangulation -> track ribbons +
follow-a-friend + LED badge hardware kit. Coordinator-merges policy this phase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 18:28:21 +10:00

39 lines
2.4 KiB
Markdown

# Lane J — Ribbons & follow-a-friend (M21, M22)
You make tracks visible and rideable. Pure frontend — ONE file: `frontend/src/friendTracks.js`.
Spec: `30-phase6.md` M21/M22 + contract #2. Branch `lane/j-ribbons`, own worktree.
## What foundation3 gives you
- Your stub module imported from main.js with `init()` + per-frame `update(tGlobal)` already
called; hidden `#btn-friends` + `#friends-panel` in index.html; `state.tracks` loaded at
boot when `manifest.has_tracks`.
- Read-only building blocks you may CALL but never edit: `scene3d.addObject/removeObject`,
`registerHelper` (photo mode hides you for free), `enterPathMode`/`exitPathMode`/
`applyCameraPose` (the camPath.js pattern — read that file first), `focusOn`;
`PATCH/DELETE /api/tracks/{id}`. anchorPanel.js is your UX/style reference (inject your own
<style> tag; reuse the CSS vars). Mark mutating controls `write-ui`.
## M21 — ribbons + panel, the parts that bite
- Interpolate the moving marker between track points at the current tGlobal (linear is fine);
HIDE it outside the track's span — don't park it at the ends.
- Rebuild ribbons only on tracks-changed, not per frame; per-frame work = one position lerp
per visible track (fx.js shows the hot-path discipline).
- Empty tracks (solver not run) → panel says so, no errors; capsule mode: ribbons + follow
stay, write controls hidden.
## M22 — follow cam, the parts that bite
- Mirror camPath's contention handling EXACTLY: if `scene3d.pathMode` goes false under you
(snap-to-cam, Esc, free-roam), stop following without a fight (pitfall #4).
- Low-pass the camera position (e.g. lerp factor ~0.08/frame) so it glides; look at the
friend, offset ~4 units behind/above; scrubbing far must not whiplash (clamp the lerp on
big jumps: teleport if the target moved > ~5 units).
- Starting a camPath playback or clicking 🎬 must cleanly cancel follow mode (and vice versa).
## Acceptance (evidence in plan/status/lane-J.md — you likely can't drive a browser;
write defensively, list exactly what the coordinator must verify live)
- [ ] Ribbons + moving labels track the synthetic markers in play AND scrub
- [ ] Panel: rename/recolor (PATCH) + delete round-trip; `write-ui` on mutators
- [ ] Follow glides after a friend; clean handoffs with free-roam / snap / camPath / 🎬
- [ ] Photo mode hides ribbons (registerHelper); capsule keeps read-only features
- [ ] `npm run build` clean; backend suite unchanged and green