@ikijs/engine 0.3.0 → 0.3.1
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/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1037,7 +1037,10 @@ var FixedStepClock = class {
|
|
|
1037
1037
|
// src/idle-motion.ts
|
|
1038
1038
|
var BLINK_INTERVAL_MIN_MS = 1500;
|
|
1039
1039
|
var BLINK_INTERVAL_MAX_MS = 6e3;
|
|
1040
|
-
var
|
|
1040
|
+
var BLINK_CLOSE_MS = 60;
|
|
1041
|
+
var BLINK_HOLD_MS = 20;
|
|
1042
|
+
var BLINK_OPEN_MS = 100;
|
|
1043
|
+
var BLINK_DURATION_MS = BLINK_CLOSE_MS + BLINK_HOLD_MS + BLINK_OPEN_MS;
|
|
1041
1044
|
var BREATH_PERIOD_MS = 3500;
|
|
1042
1045
|
var GAZE_RADIUS = 0.3;
|
|
1043
1046
|
var GAZE_RETARGET_MIN_MS = 1200;
|
|
@@ -1055,7 +1058,18 @@ function lerp(a, b, t) {
|
|
|
1055
1058
|
return a + (b - a) * t;
|
|
1056
1059
|
}
|
|
1057
1060
|
function blinkEnvelope(phase) {
|
|
1058
|
-
|
|
1061
|
+
const ms = phase * BLINK_DURATION_MS;
|
|
1062
|
+
if (ms <= 0) return 1;
|
|
1063
|
+
if (ms < BLINK_CLOSE_MS) {
|
|
1064
|
+
const t = ms / BLINK_CLOSE_MS;
|
|
1065
|
+
return 1 - t * t * (3 - 2 * t);
|
|
1066
|
+
}
|
|
1067
|
+
if (ms <= BLINK_CLOSE_MS + BLINK_HOLD_MS) return 0;
|
|
1068
|
+
if (ms < BLINK_DURATION_MS) {
|
|
1069
|
+
const t = (ms - BLINK_CLOSE_MS - BLINK_HOLD_MS) / BLINK_OPEN_MS;
|
|
1070
|
+
return 1 - (1 - t) * (1 - t);
|
|
1071
|
+
}
|
|
1072
|
+
return 1;
|
|
1059
1073
|
}
|
|
1060
1074
|
function randomInDisk(rng, radius) {
|
|
1061
1075
|
const r = Math.sqrt(rng()) * radius;
|