Skip to content

feat(engine): camera focal point and multi-plane parallax#97

Merged
LeadcodeDev merged 1 commit into
mainfrom
feat/dynamic-camera
Jul 19, 2026
Merged

feat(engine): camera focal point and multi-plane parallax#97
LeadcodeDev merged 1 commit into
mainfrom
feat/dynamic-camera

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #89. Closes #90. Second PR of the dynamic-videos wave (#95), rebuilt cleanly on main after the foundations squash.

#89 — camera focal point: camera.origin {x, y} (frame px; absent = centre, byte-identical), keyframable as origin.x/origin.y (dotted, matching the component convention). Translate/rotate/zoom pivot around the resolved origin at all four call sites (render, hit-map, world per-scene, incremental fg) — "zoom onto this element, then pan the focal point" is now one keyframe track. Documented footgun: a partial origin defaults the missing axis to 0.

#90 — multi-plane parallax: style.depth (default 1.0). Planes are the scene's direct children; with a camera and any explicit depth, rendering switches to per-plane camera application (pan·d, zoom' = 1+(zoom−1)·d, rotation·d around the origin, content-space clip) carried via PaintFrame. Depth 0 locks a background; >1 amplifies foregrounds; nested depths have no camera effect in v1 (documented). No depth anywhere → the untouched global path, and the depth-1 invariant is byte-identity-tested against it. Hit-map follows each plane's matrix (tested); geometry validate is layout-space (unaffected); world views stay global; incremental hashing follows.

Tests: 8 new (exact predicted centroids for corner-origin zoom, keyframed origin travel, locked/2×/identity planes, plane-aware hit rects). 448 total on the rebuilt branch, all green; 3 example scenarios validate unchanged.

Verify: cargo test --workspace → 448 passed ✓ · cargo fmt --check ✓ · clippy gated ≤1 ✓

- Camera gains origin {x, y} (frame px, absent = centre, keyframable
  as origin.x/origin.y following the component dotted convention):
  translate/rotate/zoom pivot around the resolved origin at all four
  call sites — zoom onto an element, pan the focal point between
  keyframes
- CssStyle gains depth (default 1.0): planes are the scene's direct
  children; with a camera and any explicit depth, rendering switches
  to per-plane camera application (pan*d, zoom'=1+(zoom-1)*d,
  rotation*d around the origin, content-space clip) carried through
  PaintFrame; depth 0 locks a background, >1 amplifies foregrounds;
  no depth declared anywhere keeps the global path untouched and the
  depth-1 invariant is byte-identity-tested against it
- hit-map follows each plane's matrix (tested), geometry validate is
  layout-space (unaffected), world views stay on the global path,
  incremental hashing follows automatically; dynamic-depth skill rule
  gains the real-parallax mechanism
@LeadcodeDev
LeadcodeDev merged commit 11bd69e into main Jul 19, 2026
3 checks passed
@LeadcodeDev
LeadcodeDev deleted the feat/dynamic-camera branch July 19, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(engine): multi-plane camera parallax via element depth feat(engine): camera focal point (zoom-to origin)

1 participant