feat(studio): mouse-driven camera parallax (C3) - #21
Conversation
…s-independence - extract PARALLAX_INTENSITY/PARALLAX_LAMBDA/DIAL_Z (DIAL_Z shared with the dial group) - pass state.pointer directly to drop a per-frame object alloc - test no-overshoot toward a negative target and frame-rate independence
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughA new parallax utility module provides ChangesPointer-driven camera parallax
Possibly related PRs
Poem
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
C3: Mouse → camera parallax (dependency-free)
Who is submitting this PR? (required)
claude-opus-4-8, 1M context). Implementation/review subagents: dispatched at theopustier; the harness does not surface the exact minor version and cannot pin 4.7, so workers most likely ran on Opus 4.8. Disclosed honestly.What problem are you trying to solve?
The 3D scene was static — no response to the cursor. The R3F plan's Phase 2·Step 4 (mouse-coordinate → camera parallax for "buttery smooth AAA interaction") was the last unchecked task. The spec named
framer-motion-3d, but it isn't installed and is largely unmaintained.What does this PR change?
Adds dependency-free mouse→camera parallax: a pure
parallax.ts(computeParallaxTargetscales the normalized pointer by an intensity;dampis frame-rate-independent exponential smoothing), applied in the existingMatrixSceneuseFrameto ease the camera toward the pointer andlookAtthe dial. No new dependency — a 5-lineuseFramerig replaces whatframer-motion-3dwould have added.Is this change appropriate for the core library?
No. Fork-specific studio UI. Internal fork PR only.
What alternatives did you consider?
framer-motion-3d(named in the spec) — rejected: not installed, largely unmaintained, and a heavier dependency than the one-functiondampneeded. The dependency-freeuseFramerig achieves the same parallax and is unit-testable.lerp) by a fixed factor — rejected: frame-rate-dependent (faster at high fps). Exponentialdamp(1 - e^(-λ·dt)) is fps-independent — verified by a test asserting onedtstep equals twodt/2steps.lookAt) — viable, butlookAtkeeps the namesake dial framed/centered as the camera drifts, which reads better for a focal object.Does this PR contain multiple unrelated changes?
No. One feature: camera parallax + its tested math.
Existing PRs
MatrixScenewith (branched after C2 merged to avoid conflict).Environment tested
npm test→ 16 passed (4 parallax incl. fps-independence + negative-target no-overshoot, plus C1's 5 store + C2's 5 dial, + 2 added in review).npm run build→ Compiled successfully;npx tsc --noEmit→ exit 0.Failed to load url ../parallax) before implementation.PARALLAX_INTENSITYis a named const (1.5) — trivially tunable lower if it reads too strong in-browser.New harness support
N/A.
Evaluation
N/A for skill evals — UI feature. Functional: red→green TDD on the damp/parallax math; two independent reviews — spec compliance (swept
lambda × dtto confirm no overshoot; verified C1+C2 byte-intact, no new deps) and code quality (confirmed the damp primitive matches three'sMathUtils.damp; flagged magic numbers + a per-frame allocation + a missing fps-independence test, all since fixed — consts extracted,state.pointerpassed directly, two invariants now tested).Rigor
Human review
Summary by CodeRabbit
Release Notes