@ikijs/editor 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.mjs CHANGED
@@ -2001,14 +2001,18 @@ function bakeHairBackTurnWarp(mesh, parameter) {
2001
2001
  const radius = halfWidth * HAIR_BACK_BEND_RADIUS_FACTOR;
2002
2002
  const bulge = HAIR_BACK_FAR_BULGE * halfWidth;
2003
2003
  const DEG_TO_RAD = Math.PI / 180;
2004
- const keyforms = [-HEAD_TURN_MAX_DEG, 0, HEAD_TURN_MAX_DEG].map((deg) => {
2004
+ const keyforms = HEAD_TURN_STOPS.map((deg) => {
2005
2005
  const theta = deg * DEG_TO_RAD;
2006
2006
  const s = Math.sign(deg);
2007
+ const turnFraction = Math.abs(deg) / HEAD_TURN_MAX_DEG;
2008
+ const fullTheta = s * HEAD_TURN_MAX_DEG * DEG_TO_RAD;
2009
+ const bulgeAtStop = bulge * deg / HEAD_TURN_MAX_DEG;
2007
2010
  const offsets = [];
2008
2011
  for (let i = 0; i < mesh.vertices.length; i += 2) {
2009
2012
  const x = mesh.vertices[i];
2010
2013
  const far = Math.max(0, -s * x / halfWidth);
2011
- offsets.push(pinnedCylinderBend(x, radius, theta) - s * bulge * far, 0);
2014
+ const bend = far > 0 ? turnFraction * pinnedCylinderBend(x, radius, fullTheta) : pinnedCylinderBend(x, radius, theta);
2015
+ offsets.push(bend - bulgeAtStop * far, 0);
2012
2016
  }
2013
2017
  return { value: deg, offsets };
2014
2018
  });