@ikijs/mcp 0.37.0 → 0.37.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/README.md +1 -1
- package/dist/{chunk-4B6MEVAP.mjs → chunk-N6KPV7FC.mjs} +200 -61
- package/dist/chunk-N6KPV7FC.mjs.map +1 -0
- package/dist/cli.js +199 -60
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.js +199 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/render-page.global.js +226 -65
- package/package.json +2 -2
- package/dist/chunk-4B6MEVAP.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1333,19 +1333,33 @@ void main() {
|
|
|
1333
1333
|
var BLINK_HOLD_MS = 20;
|
|
1334
1334
|
var BLINK_OPEN_MS = 100;
|
|
1335
1335
|
var BLINK_DURATION_MS = BLINK_CLOSE_MS + BLINK_HOLD_MS + BLINK_OPEN_MS;
|
|
1336
|
-
var
|
|
1337
|
-
var
|
|
1338
|
-
var
|
|
1339
|
-
var
|
|
1340
|
-
var
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1343
|
-
var
|
|
1344
|
-
var
|
|
1345
|
-
var
|
|
1346
|
-
var
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1336
|
+
var DOUBLE_BLINK_P = 0.18;
|
|
1337
|
+
var DOUBLE_BLINK_GAP_MS = 70;
|
|
1338
|
+
var BROW_BLINK_DIP = 0.06;
|
|
1339
|
+
var BREATH_IN_END = 0.4;
|
|
1340
|
+
var BREATH_OUT_END = 0.88;
|
|
1341
|
+
var BREATH_PERIOD_MIN_MS = 3200;
|
|
1342
|
+
var BREATH_PERIOD_MAX_MS = 4600;
|
|
1343
|
+
var BREATH_PITCH_DEG = 1;
|
|
1344
|
+
var GAZE_RETARGET_MIN_MS = 800;
|
|
1345
|
+
var GAZE_RETARGET_MAX_MS = 3300;
|
|
1346
|
+
var GAZE_EYE_CONTACT_P = 0.4;
|
|
1347
|
+
var GAZE_X_MAX = 0.8;
|
|
1348
|
+
var GAZE_Y_MAX = 0.5;
|
|
1349
|
+
var EYE_SPRING_OMEGA = 16;
|
|
1350
|
+
var EYE_SPRING_ZETA = 0.9;
|
|
1351
|
+
var HEAD_FOLLOW_X_DEG = 10;
|
|
1352
|
+
var HEAD_FOLLOW_Y_DEG = 10;
|
|
1353
|
+
var HEAD_NOISE_AMP_X_DEG = 6;
|
|
1354
|
+
var HEAD_NOISE_AMP_Y_DEG = 4;
|
|
1355
|
+
var HEAD_NOISE_AMP_Z_DEG = 4;
|
|
1356
|
+
var HEAD_NOISE_RATE_X_HZ = 0.18;
|
|
1357
|
+
var HEAD_NOISE_RATE_Y_HZ = 0.15;
|
|
1358
|
+
var HEAD_NOISE_RATE_Z_HZ = 0.12;
|
|
1359
|
+
var HEAD_SPRING_OMEGA = 7.4;
|
|
1360
|
+
var HEAD_SPRING_ZETA = 0.72;
|
|
1361
|
+
var HEAD_NOISE_EASE_IN_MS = 4e3;
|
|
1362
|
+
var SPRING_SUBSTEP_MS = 8;
|
|
1349
1363
|
var AMBIENT_AMP_A = 0.6;
|
|
1350
1364
|
var AMBIENT_PERIOD_A_MS = 2900;
|
|
1351
1365
|
var AMBIENT_AMP_B = 0.4;
|
|
@@ -1361,11 +1375,51 @@ void main() {
|
|
|
1361
1375
|
}
|
|
1362
1376
|
return 1;
|
|
1363
1377
|
}
|
|
1364
|
-
function
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
return [r * Math.cos(theta), r * Math.sin(theta)];
|
|
1378
|
+
function breathEnvelope(phase) {
|
|
1379
|
+
if (phase < BREATH_IN_END) return smoothstep(phase / BREATH_IN_END);
|
|
1380
|
+
return 1 - smoothstep((phase - BREATH_IN_END) / (BREATH_OUT_END - BREATH_IN_END));
|
|
1368
1381
|
}
|
|
1382
|
+
function drawSeed(rng) {
|
|
1383
|
+
return Math.floor(rng() * 4294967296) | 0;
|
|
1384
|
+
}
|
|
1385
|
+
function latticeValue(seed, i) {
|
|
1386
|
+
let h = Math.imul(i, 668265261) ^ seed;
|
|
1387
|
+
h = Math.imul(h ^ h >>> 15, 739982445);
|
|
1388
|
+
h = Math.imul(h ^ h >>> 12, 695872825);
|
|
1389
|
+
h ^= h >>> 15;
|
|
1390
|
+
return (h >>> 0) / 2147483648 - 1;
|
|
1391
|
+
}
|
|
1392
|
+
function valueNoise(seed, x) {
|
|
1393
|
+
const i = Math.floor(x);
|
|
1394
|
+
return lerp(
|
|
1395
|
+
latticeValue(seed, i),
|
|
1396
|
+
latticeValue(seed, i + 1),
|
|
1397
|
+
smoothstep(x - i)
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
function fbm(seed, x) {
|
|
1401
|
+
return (valueNoise(seed, x) + 0.5 * valueNoise(seed ^ 1540483477, 2 * x)) / 1.5;
|
|
1402
|
+
}
|
|
1403
|
+
var Spring = class {
|
|
1404
|
+
constructor(omega, zeta) {
|
|
1405
|
+
this.omega = omega;
|
|
1406
|
+
this.zeta = zeta;
|
|
1407
|
+
}
|
|
1408
|
+
omega;
|
|
1409
|
+
zeta;
|
|
1410
|
+
value = 0;
|
|
1411
|
+
velocity = 0;
|
|
1412
|
+
/** Advance `dtMs` toward `target` by semi-implicit Euler in short slices. */
|
|
1413
|
+
step(target, dtMs) {
|
|
1414
|
+
const slices = Math.ceil(dtMs / SPRING_SUBSTEP_MS);
|
|
1415
|
+
const h = dtMs / slices / 1e3;
|
|
1416
|
+
for (let s = 0; s < slices; s++) {
|
|
1417
|
+
const accel = this.omega * this.omega * (target - this.value) - 2 * this.zeta * this.omega * this.velocity;
|
|
1418
|
+
this.velocity += accel * h;
|
|
1419
|
+
this.value += this.velocity * h;
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1369
1423
|
var IdleMotion = class {
|
|
1370
1424
|
/**
|
|
1371
1425
|
* Every parameter id {@link update} and `emitRestingPose` write, in write
|
|
@@ -1373,19 +1427,11 @@ void main() {
|
|
|
1373
1427
|
* stops driving — keep in step with those two methods; the test suite
|
|
1374
1428
|
* pins this list to the actual emissions.
|
|
1375
1429
|
*/
|
|
1376
|
-
drivenParameterIds
|
|
1377
|
-
StandardParameter.EyeOpenLeft,
|
|
1378
|
-
StandardParameter.EyeOpenRight,
|
|
1379
|
-
StandardParameter.Breath,
|
|
1380
|
-
StandardParameter.EyeballX,
|
|
1381
|
-
StandardParameter.EyeballY,
|
|
1382
|
-
StandardParameter.AngleX,
|
|
1383
|
-
StandardParameter.AngleY,
|
|
1384
|
-
StandardParameter.AngleZ,
|
|
1385
|
-
StandardParameter.AmbientSway
|
|
1386
|
-
];
|
|
1430
|
+
drivenParameterIds;
|
|
1387
1431
|
sink;
|
|
1388
1432
|
rng;
|
|
1433
|
+
/** The declared brow Y ids the blink dip writes, with their resting values. */
|
|
1434
|
+
brows;
|
|
1389
1435
|
// Internal clock: advances by clamped dt, NOT by raw wall-clock jumps.
|
|
1390
1436
|
// This is the only clock blink/breath/gaze scheduling reads.
|
|
1391
1437
|
clockMs = 0;
|
|
@@ -1394,15 +1440,43 @@ void main() {
|
|
|
1394
1440
|
nextBlinkAtMs;
|
|
1395
1441
|
blinkStartMs = -1;
|
|
1396
1442
|
// -1 means not currently blinking
|
|
1397
|
-
//
|
|
1398
|
-
|
|
1399
|
-
|
|
1443
|
+
// Whether the blink scheduled (or running) is the second of a pair.
|
|
1444
|
+
blinkIsSecond = false;
|
|
1445
|
+
// Gaze state: the scheduled pick starts at eye contact, (0, 0), until the
|
|
1446
|
+
// first retarget. A host target, while set, replaces the pick as what the
|
|
1447
|
+
// eyes and head chase; the schedule keeps picking underneath it.
|
|
1448
|
+
eyeX = new Spring(EYE_SPRING_OMEGA, EYE_SPRING_ZETA);
|
|
1449
|
+
eyeY = new Spring(EYE_SPRING_OMEGA, EYE_SPRING_ZETA);
|
|
1400
1450
|
gazeTargetX = 0;
|
|
1401
1451
|
gazeTargetY = 0;
|
|
1402
1452
|
nextGazeRetargetMs;
|
|
1453
|
+
hostGaze = void 0;
|
|
1454
|
+
// Breath state: the current cycle's start and length on the internal clock.
|
|
1455
|
+
breathStartMs = 0;
|
|
1456
|
+
breathPeriodMs;
|
|
1457
|
+
// Head state: one noise seed and one spring per axis (X turn, Y nod, Z roll).
|
|
1458
|
+
headSeedX;
|
|
1459
|
+
headSeedY;
|
|
1460
|
+
headSeedZ;
|
|
1461
|
+
headX = new Spring(HEAD_SPRING_OMEGA, HEAD_SPRING_ZETA);
|
|
1462
|
+
headY = new Spring(HEAD_SPRING_OMEGA, HEAD_SPRING_ZETA);
|
|
1463
|
+
headZ = new Spring(HEAD_SPRING_OMEGA, HEAD_SPRING_ZETA);
|
|
1403
1464
|
constructor(sink, options) {
|
|
1404
1465
|
this.sink = sink;
|
|
1405
1466
|
this.rng = options?.rng ?? Math.random;
|
|
1467
|
+
this.brows = [StandardParameter.BrowLeftY, StandardParameter.BrowRightY].map((id) => options?.parameters?.find((p) => p.id === id)).filter((p) => p !== void 0).map((p) => ({ id: p.id, rest: clamp(p.default, p.min, p.max) }));
|
|
1468
|
+
this.drivenParameterIds = [
|
|
1469
|
+
StandardParameter.EyeOpenLeft,
|
|
1470
|
+
StandardParameter.EyeOpenRight,
|
|
1471
|
+
...this.brows.map((b) => b.id),
|
|
1472
|
+
StandardParameter.Breath,
|
|
1473
|
+
StandardParameter.EyeballX,
|
|
1474
|
+
StandardParameter.EyeballY,
|
|
1475
|
+
StandardParameter.AngleX,
|
|
1476
|
+
StandardParameter.AngleY,
|
|
1477
|
+
StandardParameter.AngleZ,
|
|
1478
|
+
StandardParameter.AmbientSway
|
|
1479
|
+
];
|
|
1406
1480
|
this.nextBlinkAtMs = lerp(
|
|
1407
1481
|
BLINK_INTERVAL_MIN_MS,
|
|
1408
1482
|
BLINK_INTERVAL_MAX_MS,
|
|
@@ -1413,6 +1487,10 @@ void main() {
|
|
|
1413
1487
|
GAZE_RETARGET_MAX_MS,
|
|
1414
1488
|
this.rng()
|
|
1415
1489
|
);
|
|
1490
|
+
this.headSeedX = drawSeed(this.rng);
|
|
1491
|
+
this.headSeedY = drawSeed(this.rng);
|
|
1492
|
+
this.headSeedZ = drawSeed(this.rng);
|
|
1493
|
+
this.breathPeriodMs = this.drawBreathPeriod();
|
|
1416
1494
|
}
|
|
1417
1495
|
/**
|
|
1418
1496
|
* Advance the idle animation to the given wall-clock timestamp (milliseconds).
|
|
@@ -1438,23 +1516,52 @@ void main() {
|
|
|
1438
1516
|
const eyeVal = this.advanceBlink();
|
|
1439
1517
|
this.sink(StandardParameter.EyeOpenLeft, eyeVal);
|
|
1440
1518
|
this.sink(StandardParameter.EyeOpenRight, eyeVal);
|
|
1519
|
+
for (const { id, rest } of this.brows) {
|
|
1520
|
+
this.sink(id, rest + BROW_BLINK_DIP * (eyeVal - 1));
|
|
1521
|
+
}
|
|
1441
1522
|
const breath = this.advanceBreath();
|
|
1442
1523
|
this.advanceGaze(dt);
|
|
1443
1524
|
this.sink(StandardParameter.Breath, breath);
|
|
1444
|
-
this.sink(StandardParameter.EyeballX, this.
|
|
1445
|
-
this.sink(StandardParameter.EyeballY, this.
|
|
1446
|
-
this.
|
|
1447
|
-
this.sink(StandardParameter.
|
|
1448
|
-
this.sink(StandardParameter.
|
|
1525
|
+
this.sink(StandardParameter.EyeballX, this.eyeX.value);
|
|
1526
|
+
this.sink(StandardParameter.EyeballY, this.eyeY.value);
|
|
1527
|
+
this.advanceHead(dt, breath);
|
|
1528
|
+
this.sink(StandardParameter.AngleX, this.headX.value);
|
|
1529
|
+
this.sink(StandardParameter.AngleY, this.headY.value);
|
|
1530
|
+
this.sink(StandardParameter.AngleZ, this.headZ.value);
|
|
1449
1531
|
this.sink(StandardParameter.AmbientSway, this.ambientSway());
|
|
1450
1532
|
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Hold the gaze on (`x`, `y`), in EyeballX/Y units (+ is the viewer's right
|
|
1535
|
+
* and up), until {@link clearGazeTarget}: the eyes chase it on their stiff
|
|
1536
|
+
* springs and the head follows it on the turn and nod, as it follows a
|
|
1537
|
+
* scheduled pick. Each value is clamped to [-1, 1], so the follow can reach
|
|
1538
|
+
* past the scheduled picks' ±0.8 / ±0.5 box. A pair with a non-finite value
|
|
1539
|
+
* is ignored and changes nothing, the same boundary rule as
|
|
1540
|
+
* ParameterStore.set.
|
|
1541
|
+
*
|
|
1542
|
+
* The scheduled retargets keep running and drawing from the rng while a host
|
|
1543
|
+
* target is set, so the rng sequence does not depend on host calls.
|
|
1544
|
+
*/
|
|
1545
|
+
setGazeTarget(x, y) {
|
|
1546
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return;
|
|
1547
|
+
this.hostGaze = { x: clamp(x, -1, 1), y: clamp(y, -1, 1) };
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Drop the host target: the eyes and head turn back to the current
|
|
1551
|
+
* scheduled pick at once (a pointer leaving does not leave the eyes frozen
|
|
1552
|
+
* until the next retarget), and later picks drive them as before.
|
|
1553
|
+
*/
|
|
1554
|
+
clearGazeTarget() {
|
|
1555
|
+
this.hostGaze = void 0;
|
|
1556
|
+
}
|
|
1451
1557
|
// ---------------------------------------------------------------------------
|
|
1452
1558
|
// Private helpers
|
|
1453
1559
|
// ---------------------------------------------------------------------------
|
|
1454
1560
|
emitRestingPose() {
|
|
1455
1561
|
this.sink(StandardParameter.EyeOpenLeft, 1);
|
|
1456
1562
|
this.sink(StandardParameter.EyeOpenRight, 1);
|
|
1457
|
-
this.sink(
|
|
1563
|
+
for (const { id, rest } of this.brows) this.sink(id, rest);
|
|
1564
|
+
this.sink(StandardParameter.Breath, 0);
|
|
1458
1565
|
this.sink(StandardParameter.EyeballX, 0);
|
|
1459
1566
|
this.sink(StandardParameter.EyeballY, 0);
|
|
1460
1567
|
this.sink(StandardParameter.AngleX, 0);
|
|
@@ -1469,7 +1576,8 @@ void main() {
|
|
|
1469
1576
|
const phase = (clockMs - this.blinkStartMs) / BLINK_DURATION_MS;
|
|
1470
1577
|
if (phase >= 1) {
|
|
1471
1578
|
this.blinkStartMs = -1;
|
|
1472
|
-
this.
|
|
1579
|
+
this.blinkIsSecond = !this.blinkIsSecond && this.rng() < DOUBLE_BLINK_P;
|
|
1580
|
+
this.nextBlinkAtMs = clockMs + (this.blinkIsSecond ? DOUBLE_BLINK_GAP_MS : lerp(BLINK_INTERVAL_MIN_MS, BLINK_INTERVAL_MAX_MS, this.rng()));
|
|
1473
1581
|
return 1;
|
|
1474
1582
|
}
|
|
1475
1583
|
return blinkEnvelope(phase);
|
|
@@ -1480,38 +1588,68 @@ void main() {
|
|
|
1480
1588
|
}
|
|
1481
1589
|
return 1;
|
|
1482
1590
|
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Returns the breath value (0..1), starting the next cycle, with a freshly
|
|
1593
|
+
* drawn length, once the current one has run out. One clamped dt (≤ 100 ms)
|
|
1594
|
+
* is far shorter than any cycle, so a step crosses at most one boundary.
|
|
1595
|
+
*/
|
|
1483
1596
|
advanceBreath() {
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1597
|
+
if (this.clockMs - this.breathStartMs >= this.breathPeriodMs) {
|
|
1598
|
+
this.breathStartMs += this.breathPeriodMs;
|
|
1599
|
+
this.breathPeriodMs = this.drawBreathPeriod();
|
|
1600
|
+
}
|
|
1601
|
+
return breathEnvelope(
|
|
1602
|
+
(this.clockMs - this.breathStartMs) / this.breathPeriodMs
|
|
1603
|
+
);
|
|
1490
1604
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
return SWAY_Y_AMP_DEG * Math.sin(2 * Math.PI * this.clockMs / SWAY_Y_PERIOD_MS);
|
|
1605
|
+
drawBreathPeriod() {
|
|
1606
|
+
return lerp(BREATH_PERIOD_MIN_MS, BREATH_PERIOD_MAX_MS, this.rng());
|
|
1494
1607
|
}
|
|
1495
|
-
/**
|
|
1496
|
-
|
|
1497
|
-
|
|
1608
|
+
/**
|
|
1609
|
+
* Step each head spring toward its axis noise at the internal clock, plus,
|
|
1610
|
+
* on the turn and nod, the gaze target scaled to degrees, and on the nod the
|
|
1611
|
+
* breath's lift. Only the noise fades in: the scheduled pick starts at
|
|
1612
|
+
* (0, 0), so it has no start value to lurch to, and its first jump is no
|
|
1613
|
+
* larger than any later one; the breath starts empty, at 0.
|
|
1614
|
+
*/
|
|
1615
|
+
advanceHead(dt, breath) {
|
|
1616
|
+
const seconds = this.clockMs / 1e3;
|
|
1617
|
+
const easeIn = smoothstep(this.clockMs / HEAD_NOISE_EASE_IN_MS);
|
|
1618
|
+
this.headX.step(
|
|
1619
|
+
easeIn * HEAD_NOISE_AMP_X_DEG * fbm(this.headSeedX, seconds * HEAD_NOISE_RATE_X_HZ) + HEAD_FOLLOW_X_DEG * (this.hostGaze?.x ?? this.gazeTargetX),
|
|
1620
|
+
dt
|
|
1621
|
+
);
|
|
1622
|
+
this.headY.step(
|
|
1623
|
+
easeIn * HEAD_NOISE_AMP_Y_DEG * fbm(this.headSeedY, seconds * HEAD_NOISE_RATE_Y_HZ) + HEAD_FOLLOW_Y_DEG * (this.hostGaze?.y ?? this.gazeTargetY) + BREATH_PITCH_DEG * breath,
|
|
1624
|
+
dt
|
|
1625
|
+
);
|
|
1626
|
+
this.headZ.step(
|
|
1627
|
+
easeIn * HEAD_NOISE_AMP_Z_DEG * fbm(this.headSeedZ, seconds * HEAD_NOISE_RATE_Z_HZ),
|
|
1628
|
+
dt
|
|
1629
|
+
);
|
|
1498
1630
|
}
|
|
1499
1631
|
/** Ambient sway (-1..1), pure function of the internal clock. */
|
|
1500
1632
|
ambientSway() {
|
|
1501
1633
|
const t = 2 * Math.PI * this.clockMs;
|
|
1502
1634
|
return AMBIENT_AMP_A * Math.sin(t / AMBIENT_PERIOD_A_MS) + AMBIENT_AMP_B * Math.sin(t / AMBIENT_PERIOD_B_MS);
|
|
1503
1635
|
}
|
|
1504
|
-
/**
|
|
1636
|
+
/**
|
|
1637
|
+
* Step the eye springs toward the gaze target, the host's while set, else
|
|
1638
|
+
* the scheduled pick; retarget on the internal clock either way.
|
|
1639
|
+
*/
|
|
1505
1640
|
advanceGaze(dt) {
|
|
1506
1641
|
if (this.clockMs >= this.nextGazeRetargetMs) {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1642
|
+
if (this.rng() < GAZE_EYE_CONTACT_P) {
|
|
1643
|
+
this.gazeTargetX = 0;
|
|
1644
|
+
this.gazeTargetY = 0;
|
|
1645
|
+
} else {
|
|
1646
|
+
this.gazeTargetX = lerp(-GAZE_X_MAX, GAZE_X_MAX, this.rng());
|
|
1647
|
+
this.gazeTargetY = lerp(-GAZE_Y_MAX, GAZE_Y_MAX, this.rng());
|
|
1648
|
+
}
|
|
1510
1649
|
this.nextGazeRetargetMs = this.clockMs + lerp(GAZE_RETARGET_MIN_MS, GAZE_RETARGET_MAX_MS, this.rng());
|
|
1511
1650
|
}
|
|
1512
|
-
|
|
1513
|
-
this.
|
|
1514
|
-
this.gazeCurrentY = lerp(this.gazeCurrentY, this.gazeTargetY, factor);
|
|
1651
|
+
this.eyeX.step(this.hostGaze?.x ?? this.gazeTargetX, dt);
|
|
1652
|
+
this.eyeY.step(this.hostGaze?.y ?? this.gazeTargetY, dt);
|
|
1515
1653
|
}
|
|
1516
1654
|
};
|
|
1517
1655
|
|
|
@@ -2175,9 +2313,12 @@ void main() {
|
|
|
2175
2313
|
model.parameters
|
|
2176
2314
|
);
|
|
2177
2315
|
const idleKeeps = this.clips.hasIdleLoop ? (id) => !HEAD_AND_GAZE.has(id) : () => true;
|
|
2178
|
-
this.idle = new IdleMotion(
|
|
2179
|
-
|
|
2180
|
-
|
|
2316
|
+
this.idle = new IdleMotion(
|
|
2317
|
+
(id, value) => {
|
|
2318
|
+
if (idleKeeps(id)) this.frame.set(id, value);
|
|
2319
|
+
},
|
|
2320
|
+
{ parameters: model.parameters }
|
|
2321
|
+
);
|
|
2181
2322
|
this.physics = new PhysicsMotion(rigs, model.parameters, read, sink);
|
|
2182
2323
|
this.chains = new HairChainMotion(
|
|
2183
2324
|
chains,
|
|
@@ -2221,12 +2362,29 @@ void main() {
|
|
|
2221
2362
|
playMotion(group, index) {
|
|
2222
2363
|
return this.clips.play(group, index);
|
|
2223
2364
|
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Hold the idle gaze on (`x`, `y`) until {@link clearGazeTarget}: the eyes
|
|
2367
|
+
* go there and the head follows on the turn and nod, as
|
|
2368
|
+
* {@link IdleMotion.setGazeTarget} describes (clamped to [-1, 1]; a pair
|
|
2369
|
+
* with a non-finite value is ignored).
|
|
2370
|
+
*
|
|
2371
|
+
* Under a declared `Idle` motion group this moves nothing: idle's head and
|
|
2372
|
+
* gaze writes are dropped, so a host that wants the eyes on a point writes
|
|
2373
|
+
* EyeballX/Y itself after {@link update}.
|
|
2374
|
+
*/
|
|
2375
|
+
setGazeTarget(x, y) {
|
|
2376
|
+
this.idle.setGazeTarget(x, y);
|
|
2377
|
+
}
|
|
2378
|
+
/** Drop the host gaze target; the idle's own gaze resumes. */
|
|
2379
|
+
clearGazeTarget() {
|
|
2380
|
+
this.idle.clearGazeTarget();
|
|
2381
|
+
}
|
|
2224
2382
|
/**
|
|
2225
2383
|
* Advance everything to the same wall-clock timestamp (milliseconds), in
|
|
2226
2384
|
* this order:
|
|
2227
2385
|
*
|
|
2228
|
-
* 1. Idle writes blink,
|
|
2229
|
-
* replaced) into this update's frame.
|
|
2386
|
+
* 1. Idle writes blink, the declared brows' blink dip, breath, the ambient
|
|
2387
|
+
* sway (and head and gaze, unless replaced) into this update's frame.
|
|
2230
2388
|
* 2. The clip stage writes the `Idle` loop, then the one-shot over it.
|
|
2231
2389
|
* 3. The expression stage writes the active expression, fading in from the
|
|
2232
2390
|
* pose it replaced, or a stop fading back to base.
|
|
@@ -2238,9 +2396,12 @@ void main() {
|
|
|
2238
2396
|
* a physics output). Physics outputs are physics-owned: a clip or
|
|
2239
2397
|
* expression that writes one is overwritten here.
|
|
2240
2398
|
*
|
|
2241
|
-
* The host writes the signals it owns (lip-sync MouthOpen,
|
|
2242
|
-
* AFTER update(); the last write wins. That is how lip-sync beats
|
|
2243
|
-
* expression that opens the mouth
|
|
2399
|
+
* The host writes the signals it owns (lip-sync MouthOpen, brows it drives
|
|
2400
|
+
* itself) AFTER update(); the last write wins. That is how lip-sync beats
|
|
2401
|
+
* an expression that opens the mouth, and how a host's brow beats idle's
|
|
2402
|
+
* blink dip. A host pointer goes through {@link setGazeTarget} instead, so
|
|
2403
|
+
* the head follows it; only on a model with an `Idle` group, where that
|
|
2404
|
+
* moves nothing, does the host write EyeballX/Y itself after update().
|
|
2244
2405
|
*
|
|
2245
2406
|
* The clips and expressions advance by `clamp(now − prev, 0, MAX_DT_MS)`,
|
|
2246
2407
|
* 0 on the first update. A non-finite `nowMs` is a dropped frame: idle and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikijs/mcp",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"description": "MCP server that lets AI agents build 2D puppet characters: compose AI-drawn part images, check their geometry and auto-rig them into an open .iki model — Iki, the free Live2D alternative.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iki",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"zod": "^3.25"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@ikijs/engine": "^0.
|
|
51
|
+
"@ikijs/engine": "^0.12.0",
|
|
52
52
|
"tsup": "^8.5.0",
|
|
53
53
|
"typescript": "^5.9.2"
|
|
54
54
|
},
|