@ikijs/engine 0.1.1 → 0.2.0

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
@@ -1,9 +1,9 @@
1
1
  # @ikijs/engine
2
2
 
3
- WebGL2 runtime that plays a [`.iki`](../format) puppet model in the browser.
3
+ WebGL2 runtime that plays a [`.iki`](https://github.com/zeikar/iki/tree/main/packages/format) puppet model in the browser.
4
4
 
5
5
  The engine is **host-agnostic**: it depends only on
6
- [`@ikijs/format`](../format) and knows nothing about any particular app. A host
6
+ [`@ikijs/format`](https://github.com/zeikar/iki/tree/main/packages/format) and knows nothing about any particular app. A host
7
7
  drives it by setting parameters (from lip-sync, gaze, blink, expressions); the
8
8
  engine renders the result each frame.
9
9
 
package/dist/index.d.mts CHANGED
@@ -232,6 +232,8 @@ declare class IdleMotion {
232
232
  private swayX;
233
233
  /** Vertical head sway in degrees, pure function of the internal clock. */
234
234
  private swayY;
235
+ /** Head roll sway in degrees, pure function of the internal clock. */
236
+ private swayZ;
235
237
  /** Ease gaze current toward target; pick a new target on the internal clock. */
236
238
  private advanceGaze;
237
239
  }
package/dist/index.d.ts CHANGED
@@ -232,6 +232,8 @@ declare class IdleMotion {
232
232
  private swayX;
233
233
  /** Vertical head sway in degrees, pure function of the internal clock. */
234
234
  private swayY;
235
+ /** Head roll sway in degrees, pure function of the internal clock. */
236
+ private swayZ;
235
237
  /** Ease gaze current toward target; pick a new target on the internal clock. */
236
238
  private advanceGaze;
237
239
  }
package/dist/index.js CHANGED
@@ -1084,6 +1084,8 @@ var SWAY_X_AMP_B_DEG = 1.3;
1084
1084
  var SWAY_X_PERIOD_B_MS = 9700;
1085
1085
  var SWAY_Y_AMP_DEG = 1.6;
1086
1086
  var SWAY_Y_PERIOD_MS = 7300;
1087
+ var SWAY_Z_AMP_DEG = 1.1;
1088
+ var SWAY_Z_PERIOD_MS = 11300;
1087
1089
  function lerp(a, b, t) {
1088
1090
  return a + (b - a) * t;
1089
1091
  }
@@ -1157,6 +1159,7 @@ var IdleMotion = class {
1157
1159
  this.sink(import_format.StandardParameter.EyeballY, this.gazeCurrentY);
1158
1160
  this.sink(import_format.StandardParameter.AngleX, this.swayX());
1159
1161
  this.sink(import_format.StandardParameter.AngleY, this.swayY());
1162
+ this.sink(import_format.StandardParameter.AngleZ, this.swayZ());
1160
1163
  }
1161
1164
  // ---------------------------------------------------------------------------
1162
1165
  // Private helpers
@@ -1169,6 +1172,7 @@ var IdleMotion = class {
1169
1172
  this.sink(import_format.StandardParameter.EyeballY, 0);
1170
1173
  this.sink(import_format.StandardParameter.AngleX, 0);
1171
1174
  this.sink(import_format.StandardParameter.AngleY, 0);
1175
+ this.sink(import_format.StandardParameter.AngleZ, 0);
1172
1176
  }
1173
1177
  /** Returns the current eye-open value (0..1) and advances blink state. */
1174
1178
  advanceBlink() {
@@ -1200,6 +1204,10 @@ var IdleMotion = class {
1200
1204
  swayY() {
1201
1205
  return SWAY_Y_AMP_DEG * Math.sin(2 * Math.PI * this.clockMs / SWAY_Y_PERIOD_MS);
1202
1206
  }
1207
+ /** Head roll sway in degrees, pure function of the internal clock. */
1208
+ swayZ() {
1209
+ return SWAY_Z_AMP_DEG * Math.sin(2 * Math.PI * this.clockMs / SWAY_Z_PERIOD_MS);
1210
+ }
1203
1211
  /** Ease gaze current toward target; pick a new target on the internal clock. */
1204
1212
  advanceGaze(dt) {
1205
1213
  if (this.clockMs >= this.nextGazeRetargetMs) {