You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(engine): camera focal point and multi-plane parallax
- 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
Copy file name to clipboardExpand all lines: .claude/skills/rustmotion/rules/dynamic-depth.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,55 @@
2
2
3
3
Static depth (see [depth-layering.md](depth-layering.md)) places elements at different perceived distances. Dynamic depth *animates* each plane independently so the scene breathes and the spatial composition is felt over time, not just read visually.
4
4
5
-
Three independent mechanisms combine freely:
5
+
Four independent mechanisms combine freely:
6
6
7
7
| Mechanism | Scope | Best for |
8
8
|---|---|---|
9
9
|**A. Per-element wiggle seeds**| One element | Uncorrelated floating per card/icon |
10
10
|**B. `float_3d` preset**| One element | Hero card with gentle 3D tilt loop |
11
11
|**C. Camera keyframes**| Whole scene | Cinematic zoom-in / slow pan |
12
+
|**D. `style.depth` (vraie parallaxe)**| Plans top-level | Parallaxe multi-plans pilotée par la caméra |
13
+
14
+
---
15
+
16
+
## Mechanism D — Vraie parallaxe caméra : `style.depth`
17
+
18
+
Quand la scène a une `camera`, chaque **enfant direct** de la scène est un plan. `style.depth` met à l'échelle l'effet caméra sur ce plan (pan × depth, zoom' = 1 + (zoom−1)×depth, rotation × depth, autour de `camera.origin`) :
19
+
20
+
|`depth`| Effet |
21
+
|---|---|
22
+
|`0`| Plan verrouillé — la caméra ne le bouge jamais (HUD, watermark, fond fixe) |
23
+
|`0.2–0.5`| Arrière-plan lointain — bouge peu (blobs, textures) |
24
+
|`1.0`| Plan normal (défaut — comportement identique sans depth) |
25
+
|`1.5–2.5`| Avant-plan amplifié — bouge plus que la caméra (profondeur dramatique) |
Le fond (0.3) glisse lentement, la card suit la caméra, le badge file en avant-plan — parallaxe cinéma réelle, sans wiggle.
47
+
48
+
**Règles :**
49
+
-`depth` n'agit que sur les **enfants directs** de la scène (v1) ; il gouverne tout le sous-arbre du plan. Un `depth` sur un nœud imbriqué est sans effet caméra.
- Le point focal se règle avec `camera.origin` (`{ "x": px, "y": px }`, keyframable via `"origin.x"` / `"origin.y"`) — zoom vers un élément précis puis pan vers un autre.
53
+
- Combine avec le mécanisme A (wiggle) librement — la parallaxe caméra est déterministe, le wiggle ajoute la vie.
0 commit comments