@ikijs/editor 0.25.1 → 0.27.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/dist/index.mjs CHANGED
@@ -1958,7 +1958,7 @@ var PROFILE_VALUES = {
1958
1958
  mouthWiden: 1.2,
1959
1959
  brow: 0.15,
1960
1960
  breath: 0.03,
1961
- sway: 0.08,
1961
+ sway: 0.24,
1962
1962
  blushRest: 0.4,
1963
1963
  bodySlide: 0.1,
1964
1964
  bodyNarrow: 0.05,
@@ -6244,7 +6244,7 @@ function generateIkiFromLayerSet(layers, canvas, options = {}) {
6244
6244
  parameters,
6245
6245
  parts,
6246
6246
  deformers: deformers(frame, grids, bodyWarp?.deformer, arms, byRole),
6247
- ...has("hair_front") ? { physics: hairPhysics() } : {},
6247
+ ...has("hair_front") ? { physics: hairPhysics(has("hair_back")) } : {},
6248
6248
  expressions: defaultExpressions(new Set(parameters.map((p) => p.id))),
6249
6249
  motions: defaultMotions(new Set(parameters.map((p) => p.id)))
6250
6250
  };
@@ -6451,10 +6451,14 @@ function buildPart(spec, b, order, frame, byRole, style, frontGrid, lips) {
6451
6451
  case "hair_back":
6452
6452
  if (byRole.has("hair_front")) {
6453
6453
  const amp = style.sway * AMPLITUDE.sway * hh;
6454
- warps.push(
6455
- hairSway(P10.HairSwayX, mesh, b, amp),
6456
- hairSway(P10.HairSwayZ, mesh, b, amp)
6457
- );
6454
+ if (spec.role === "hair_front") {
6455
+ warps.push(
6456
+ hairSway(P10.HairSwayX, mesh, b, amp),
6457
+ hairSway(P10.HairSwayZ, mesh, b, amp)
6458
+ );
6459
+ } else {
6460
+ warps.push(hairSway(P10.HairBackSway, mesh, b, amp));
6461
+ }
6458
6462
  }
6459
6463
  warps.push(tiltHang(mesh, b, pivot, hairHangWeight(frame.chinY, b.y0)));
6460
6464
  break;
@@ -6569,25 +6573,40 @@ function deformers(frame, grids, bodyWarp, arms, byRole) {
6569
6573
  }
6570
6574
  return out;
6571
6575
  }
6572
- function hairPhysics() {
6573
- return [
6576
+ function hairPhysics(hasBack) {
6577
+ const spring = { mass: 1, stiffness: 77, damping: 7 };
6578
+ const rigs = [
6574
6579
  {
6575
6580
  id: "hairSway",
6576
- input: { parameter: P10.AngleX, weight: 1 },
6577
- output: { parameter: P10.HairSwayX, scale: 5 },
6578
- mass: 1,
6579
- stiffness: 30,
6580
- damping: 3
6581
+ inputs: [
6582
+ { parameter: P10.AngleX, weight: 1, mode: "lag" },
6583
+ { parameter: P10.AmbientSway, weight: 0.25 }
6584
+ ],
6585
+ output: { parameter: P10.HairSwayX, scale: 14 },
6586
+ ...spring
6581
6587
  },
6582
6588
  {
6583
6589
  id: "hairTilt",
6584
- input: { parameter: P10.AngleZ, weight: 1 },
6585
- output: { parameter: P10.HairSwayZ, scale: 8 },
6586
- mass: 1,
6587
- stiffness: 25,
6588
- damping: 2.5
6590
+ input: { parameter: P10.AngleZ, weight: 1, mode: "lag" },
6591
+ output: { parameter: P10.HairSwayZ, scale: 9 },
6592
+ ...spring
6589
6593
  }
6590
6594
  ];
6595
+ if (hasBack) {
6596
+ rigs.push({
6597
+ id: "hairBack",
6598
+ inputs: [
6599
+ { parameter: P10.AngleX, weight: 1, mode: "lag" },
6600
+ { parameter: P10.AngleZ, weight: 0.4, mode: "lag" },
6601
+ { parameter: P10.AmbientSway, weight: 1.73, mode: "lag" }
6602
+ ],
6603
+ output: { parameter: P10.HairBackSway, scale: 7 },
6604
+ mass: 1,
6605
+ stiffness: 32,
6606
+ damping: 4.5
6607
+ });
6608
+ }
6609
+ return rigs;
6591
6610
  }
6592
6611
  function declareParameters(roles) {
6593
6612
  const out = [];
@@ -6641,6 +6660,10 @@ function declareParameters(roles) {
6641
6660
  if (roles.has("hair_front")) {
6642
6661
  add(P10.HairSwayX, "Hair Sway X", -SWAY_RANGE, SWAY_RANGE, 0);
6643
6662
  add(P10.HairSwayZ, "Hair Sway Z", -SWAY_RANGE, SWAY_RANGE, 0);
6663
+ if (roles.has("hair_back")) {
6664
+ add(P10.HairBackSway, "Hair Back Sway", -SWAY_RANGE, SWAY_RANGE, 0);
6665
+ }
6666
+ add(P10.AmbientSway, "Ambient Sway", -1, 1, 0);
6644
6667
  }
6645
6668
  return out;
6646
6669
  }