@nakednous/tree 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,11 +58,14 @@ track.eval(out) // writes interpolated TRS into out
58
58
  Interpolation modes:
59
59
 
60
60
  ```js
61
- track.posInterp = 'catmullrom' // default — centripetal Catmull-Rom
61
+ track.posInterp = 'hermite' // default — cubic Hermite; auto-computes centripetal
62
+ // Catmull-Rom tangents when none are stored
62
63
  track.posInterp = 'linear'
64
+ track.posInterp = 'step' // snap to k0; useful for discrete state changes
63
65
 
64
- track.rotInterp = 'slerp' // default — constant angular velocity
65
- track.rotInterp = 'nlerp' // normalised lerp; cheaper, slightly non-constant
66
+ track.rotInterp = 'slerp' // default — constant angular velocity
67
+ track.rotInterp = 'nlerp' // normalised lerp; cheaper, slightly non-constant speed
68
+ track.rotInterp = 'step' // snap to k0 quaternion
66
69
  ```
67
70
 
68
71
  Playback features: signed `rate` (negative reverses), `loop`, `pingPong`, `seek(t)` scrubbing, and lifecycle hooks (`onPlay`, `onEnd`, `onStop`). `_onActivate` / `_onDeactivate` are lib-space hooks for the host layer's draw-loop registry — not for user code.
@@ -70,9 +73,19 @@ Playback features: signed `rate` (negative reverses), `loop`, `pingPong`, `seek(
70
73
  `add()` accepts flexible specs. Top-level forms:
71
74
 
72
75
  ```js
73
- track.add({ pos, rot, scl }) // explicit TRS — rot accepts any form below
74
- track.add({ mMatrix: mat4 }) // decompose a column-major model matrix into TRS
75
- track.add([ spec, spec, ... ]) // bulk
76
+ track.add({ pos, rot, scl }) // explicit TRS — rot accepts any form below
77
+ track.add({ pos, rot, scl, tanIn, tanOut }) // with Hermite tangents (vec3, optional)
78
+ track.add({ mMatrix: mat4 }) // decompose a column-major model matrix into TRS
79
+ track.add([ spec, spec, ... ]) // bulk
80
+ ```
81
+
82
+ `tanIn` is the incoming position tangent at this keyframe; `tanOut` is the outgoing tangent. When only one is given, the other mirrors it. When neither is given, centripetal Catmull-Rom tangents are auto-computed from neighboring keyframes — identical to prior default behavior.
83
+
84
+ ```js
85
+ track.add({ pos:[0,0,0] }) // auto tangents
86
+ track.add({ pos:[100,0,0], tanOut:[0,50,0] }) // leave heading +Y
87
+ track.add({ pos:[200,0,0], tanIn:[0,50,0], tanOut:[-30,0,0] }) // arrive from +Y, leave heading -X
88
+ track.add({ pos:[300,0,0] }) // auto tangents
76
89
  ```
77
90
 
78
91
  `rot` sub-forms — all normalised internally:
@@ -116,20 +129,25 @@ track.eval(out)
116
129
  Interpolation modes:
117
130
 
118
131
  ```js
119
- track.eyeInterp = 'catmullrom' // default
132
+ track.eyeInterp = 'hermite' // default — auto-CR tangents when none stored
120
133
  track.eyeInterp = 'linear'
134
+ track.eyeInterp = 'step'
121
135
 
122
- track.centerInterp = 'linear' // default — suits fixed lookat targets
123
- track.centerInterp = 'catmullrom' // smoother when center is also moving freely
136
+ track.centerInterp = 'linear' // default — suits fixed lookat targets
137
+ track.centerInterp = 'hermite' // smoother when center is also moving freely
138
+ track.centerInterp = 'step'
124
139
  ```
125
140
 
126
141
  `add()` accepts:
127
142
 
128
143
  ```js
129
- track.add({ eye, center?, up?, fov?, halfHeight? })
144
+ track.add({ eye, center?, up?, fov?, halfHeight?,
145
+ eyeTanIn?, eyeTanOut?, centerTanIn?, centerTanOut? })
130
146
  // fov — vertical fov (radians) for perspective
131
147
  // halfHeight — world-unit half-height for ortho
132
148
  // both nullable; omit to leave projection unchanged
149
+ // eyeTanIn/Out — Hermite tangents for eye path
150
+ // centerTanIn/Out — Hermite tangents for center path
133
151
  track.add({ vMatrix: mat4 }) // view matrix (world→eye); eye reconstructed
134
152
  track.add({ eMatrix: mat4 }) // eye matrix (eye→world); eye read from col3
135
153
  track.add([ spec, spec, ... ]) // bulk
@@ -137,9 +155,7 @@ track.add([ spec, spec, ... ]) // bulk
137
155
 
138
156
  Note: both matrix forms default `up` to `[0,1,0]`. The matrix col1 (up_ortho) is intentionally not used — it differs from the hint for upright cameras and would shift orbitControl's orbit reference. Use `capturePose()` (p5.tree bridge) when the real up hint is needed.
139
157
 
140
- `fov` and `halfHeight` are lerped between keyframes only when both adjacent
141
- keyframes carry a non-null value for that field. Mixed or null entries pass
142
- `null` through — the bridge leaves the projection unchanged.
158
+ `fov` and `halfHeight` are lerped between keyframes only when both adjacent keyframes carry a non-null value for that field. Mixed or null entries pass `null` through — the bridge leaves the projection unchanged.
143
159
 
144
160
  ---
145
161
 
@@ -241,7 +257,7 @@ qFromAxisAngle qFromLookDir qFromRotMat3x3 qFromMat4 qToMat4
241
257
  quatToAxisAngle
242
258
  ```
243
259
 
244
- **Spline / vector:** `catmullRomVec3`, `lerpVec3`
260
+ **Spline / vector:** `hermiteVec3`, `lerpVec3`
245
261
 
246
262
  **Mat4:**
247
263
  ```