@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.js CHANGED
@@ -2044,7 +2044,7 @@ var PROFILE_VALUES = {
2044
2044
  mouthWiden: 1.2,
2045
2045
  brow: 0.15,
2046
2046
  breath: 0.03,
2047
- sway: 0.08,
2047
+ sway: 0.24,
2048
2048
  blushRest: 0.4,
2049
2049
  bodySlide: 0.1,
2050
2050
  bodyNarrow: 0.05,
@@ -6312,7 +6312,7 @@ function generateIkiFromLayerSet(layers, canvas, options = {}) {
6312
6312
  parameters,
6313
6313
  parts,
6314
6314
  deformers: deformers(frame, grids, bodyWarp?.deformer, arms, byRole),
6315
- ...has("hair_front") ? { physics: hairPhysics() } : {},
6315
+ ...has("hair_front") ? { physics: hairPhysics(has("hair_back")) } : {},
6316
6316
  expressions: defaultExpressions(new Set(parameters.map((p) => p.id))),
6317
6317
  motions: defaultMotions(new Set(parameters.map((p) => p.id)))
6318
6318
  };
@@ -6519,10 +6519,14 @@ function buildPart(spec, b, order, frame, byRole, style, frontGrid, lips) {
6519
6519
  case "hair_back":
6520
6520
  if (byRole.has("hair_front")) {
6521
6521
  const amp = style.sway * AMPLITUDE.sway * hh;
6522
- warps.push(
6523
- hairSway(import_format12.StandardParameter.HairSwayX, mesh, b, amp),
6524
- hairSway(import_format12.StandardParameter.HairSwayZ, mesh, b, amp)
6525
- );
6522
+ if (spec.role === "hair_front") {
6523
+ warps.push(
6524
+ hairSway(import_format12.StandardParameter.HairSwayX, mesh, b, amp),
6525
+ hairSway(import_format12.StandardParameter.HairSwayZ, mesh, b, amp)
6526
+ );
6527
+ } else {
6528
+ warps.push(hairSway(import_format12.StandardParameter.HairBackSway, mesh, b, amp));
6529
+ }
6526
6530
  }
6527
6531
  warps.push(tiltHang(mesh, b, pivot, hairHangWeight(frame.chinY, b.y0)));
6528
6532
  break;
@@ -6637,25 +6641,40 @@ function deformers(frame, grids, bodyWarp, arms, byRole) {
6637
6641
  }
6638
6642
  return out;
6639
6643
  }
6640
- function hairPhysics() {
6641
- return [
6644
+ function hairPhysics(hasBack) {
6645
+ const spring = { mass: 1, stiffness: 77, damping: 7 };
6646
+ const rigs = [
6642
6647
  {
6643
6648
  id: "hairSway",
6644
- input: { parameter: import_format12.StandardParameter.AngleX, weight: 1 },
6645
- output: { parameter: import_format12.StandardParameter.HairSwayX, scale: 5 },
6646
- mass: 1,
6647
- stiffness: 30,
6648
- damping: 3
6649
+ inputs: [
6650
+ { parameter: import_format12.StandardParameter.AngleX, weight: 1, mode: "lag" },
6651
+ { parameter: import_format12.StandardParameter.AmbientSway, weight: 0.25 }
6652
+ ],
6653
+ output: { parameter: import_format12.StandardParameter.HairSwayX, scale: 14 },
6654
+ ...spring
6649
6655
  },
6650
6656
  {
6651
6657
  id: "hairTilt",
6652
- input: { parameter: import_format12.StandardParameter.AngleZ, weight: 1 },
6653
- output: { parameter: import_format12.StandardParameter.HairSwayZ, scale: 8 },
6654
- mass: 1,
6655
- stiffness: 25,
6656
- damping: 2.5
6658
+ input: { parameter: import_format12.StandardParameter.AngleZ, weight: 1, mode: "lag" },
6659
+ output: { parameter: import_format12.StandardParameter.HairSwayZ, scale: 9 },
6660
+ ...spring
6657
6661
  }
6658
6662
  ];
6663
+ if (hasBack) {
6664
+ rigs.push({
6665
+ id: "hairBack",
6666
+ inputs: [
6667
+ { parameter: import_format12.StandardParameter.AngleX, weight: 1, mode: "lag" },
6668
+ { parameter: import_format12.StandardParameter.AngleZ, weight: 0.4, mode: "lag" },
6669
+ { parameter: import_format12.StandardParameter.AmbientSway, weight: 1.73, mode: "lag" }
6670
+ ],
6671
+ output: { parameter: import_format12.StandardParameter.HairBackSway, scale: 7 },
6672
+ mass: 1,
6673
+ stiffness: 32,
6674
+ damping: 4.5
6675
+ });
6676
+ }
6677
+ return rigs;
6659
6678
  }
6660
6679
  function declareParameters(roles) {
6661
6680
  const out = [];
@@ -6709,6 +6728,10 @@ function declareParameters(roles) {
6709
6728
  if (roles.has("hair_front")) {
6710
6729
  add(import_format12.StandardParameter.HairSwayX, "Hair Sway X", -SWAY_RANGE, SWAY_RANGE, 0);
6711
6730
  add(import_format12.StandardParameter.HairSwayZ, "Hair Sway Z", -SWAY_RANGE, SWAY_RANGE, 0);
6731
+ if (roles.has("hair_back")) {
6732
+ add(import_format12.StandardParameter.HairBackSway, "Hair Back Sway", -SWAY_RANGE, SWAY_RANGE, 0);
6733
+ }
6734
+ add(import_format12.StandardParameter.AmbientSway, "Ambient Sway", -1, 1, 0);
6712
6735
  }
6713
6736
  return out;
6714
6737
  }