@esotericsoftware/spine-webgl 4.3.4 → 4.3.6

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.
@@ -21,6 +21,8 @@ var spine = (() => {
21
21
  // spine-webgl/src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ ATTACH_RETAIN: () => ATTACH_RETAIN,
25
+ ATTACH_SETUP: () => ATTACH_SETUP,
24
26
  AlphaTimeline: () => AlphaTimeline,
25
27
  Animation: () => Animation,
26
28
  AnimationState: () => AnimationState,
@@ -40,6 +42,7 @@ var spine = (() => {
40
42
  BoneTimeline1: () => BoneTimeline1,
41
43
  BoneTimeline2: () => BoneTimeline2,
42
44
  BoundingBoxAttachment: () => BoundingBoxAttachment,
45
+ CURRENT: () => CURRENT,
43
46
  CameraController: () => CameraController,
44
47
  ClippingAttachment: () => ClippingAttachment,
45
48
  Color: () => Color,
@@ -72,7 +75,6 @@ var spine = (() => {
72
75
  FromY: () => FromY,
73
76
  GLTexture: () => GLTexture,
74
77
  HOLD: () => HOLD,
75
- HOLD_FIRST: () => HOLD_FIRST,
76
78
  IkConstraint: () => IkConstraint,
77
79
  IkConstraintData: () => IkConstraintData,
78
80
  IkConstraintPose: () => IkConstraintPose,
@@ -99,11 +101,13 @@ var spine = (() => {
99
101
  M31: () => M31,
100
102
  M32: () => M32,
101
103
  M33: () => M33,
104
+ MODE: () => MODE,
102
105
  ManagedWebGLRenderingContext: () => ManagedWebGLRenderingContext,
103
106
  MathUtils: () => MathUtils,
104
107
  Matrix4: () => Matrix4,
105
108
  Mesh: () => Mesh,
106
109
  MeshAttachment: () => MeshAttachment,
110
+ MixFrom: () => MixFrom,
107
111
  OrthoCamera: () => OrthoCamera,
108
112
  PathAttachment: () => PathAttachment,
109
113
  PathConstraint: () => PathConstraint,
@@ -137,7 +141,6 @@ var spine = (() => {
137
141
  Pow: () => Pow,
138
142
  PowOut: () => PowOut,
139
143
  Property: () => Property,
140
- RETAIN: () => RETAIN,
141
144
  RGB2Timeline: () => RGB2Timeline,
142
145
  RGBA2Timeline: () => RGBA2Timeline,
143
146
  RGBATimeline: () => RGBATimeline,
@@ -147,7 +150,6 @@ var spine = (() => {
147
150
  RotateMode: () => RotateMode,
148
151
  RotateTimeline: () => RotateTimeline,
149
152
  SETUP: () => SETUP,
150
- SUBSEQUENT: () => SUBSEQUENT,
151
153
  ScaleTimeline: () => ScaleTimeline,
152
154
  ScaleXTimeline: () => ScaleXTimeline,
153
155
  ScaleYMode: () => ScaleYMode,
@@ -1530,17 +1532,14 @@ var spine = (() => {
1530
1532
  * @param loop True if `time` beyond the {@link duration} repeats the animation, else the last frame is used.
1531
1533
  * @param events If any events are fired, they are added to this list. Pass null to ignore fired events or if no timelines fire
1532
1534
  * events.
1533
- * @param alpha 0 applies setup or current values (depending on `fromSetup`), 1 uses timeline values, and
1534
- * intermediate values interpolate between them. Adjusting `alpha` over time can mix an animation in or
1535
- * out.
1536
- * @param fromSetup If true, `alpha` transitions between setup and timeline values, setup values are used before the
1537
- * first frame (current values are not used). If false, `alpha` transitions between current and timeline
1538
- * values, no change is made before the first frame.
1535
+ * @param alpha 0 applies setup or current values (depending on `from`), 1 uses timeline values, and intermediate
1536
+ * values interpolate between them. Adjusting `alpha` over time can mix an animation in or out.
1537
+ * @param from Controls how `alpha` and `add` mix from current or setup pose values to timeline values.
1539
1538
  * @param add If true, for timelines that support it, their values are added to the setup or current values (depending on
1540
- * `fromSetup`).
1539
+ * `from`).
1541
1540
  * @param out True when the animation is mixing out, else it is mixing in. Used by timelines that perform instant transitions.
1542
1541
  * @param appliedPose True to modify {@link Posed.appliedPose}, else {@link Posed.pose} is modified. */
1543
- apply(skeleton, lastTime, time, loop, events, alpha, fromSetup, add, out, appliedPose) {
1542
+ apply(skeleton, lastTime, time, loop, events, alpha, from, add, out, appliedPose) {
1544
1543
  if (!skeleton) throw new Error("skeleton cannot be null.");
1545
1544
  if (loop && this.duration !== 0) {
1546
1545
  time %= this.duration;
@@ -1548,9 +1547,15 @@ var spine = (() => {
1548
1547
  }
1549
1548
  const timelines = this.timelines;
1550
1549
  for (let i = 0, n = timelines.length; i < n; i++)
1551
- timelines[i].apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose);
1550
+ timelines[i].apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose);
1552
1551
  }
1553
1552
  };
1553
+ var MixFrom = /* @__PURE__ */ ((MixFrom2) => {
1554
+ MixFrom2[MixFrom2["current"] = 0] = "current";
1555
+ MixFrom2[MixFrom2["setup"] = 1] = "setup";
1556
+ MixFrom2[MixFrom2["first"] = 2] = "first";
1557
+ return MixFrom2;
1558
+ })(MixFrom || {});
1554
1559
  var Property = /* @__PURE__ */ ((Property2) => {
1555
1560
  Property2[Property2["rotate"] = 0] = "rotate";
1556
1561
  Property2[Property2["x"] = 1] = "x";
@@ -1567,28 +1572,31 @@ var spine = (() => {
1567
1572
  Property2[Property2["deform"] = 12] = "deform";
1568
1573
  Property2[Property2["event"] = 13] = "event";
1569
1574
  Property2[Property2["drawOrder"] = 14] = "drawOrder";
1570
- Property2[Property2["ikConstraint"] = 15] = "ikConstraint";
1571
- Property2[Property2["transformConstraint"] = 16] = "transformConstraint";
1572
- Property2[Property2["pathConstraintPosition"] = 17] = "pathConstraintPosition";
1573
- Property2[Property2["pathConstraintSpacing"] = 18] = "pathConstraintSpacing";
1574
- Property2[Property2["pathConstraintMix"] = 19] = "pathConstraintMix";
1575
- Property2[Property2["physicsConstraintInertia"] = 20] = "physicsConstraintInertia";
1576
- Property2[Property2["physicsConstraintStrength"] = 21] = "physicsConstraintStrength";
1577
- Property2[Property2["physicsConstraintDamping"] = 22] = "physicsConstraintDamping";
1578
- Property2[Property2["physicsConstraintMass"] = 23] = "physicsConstraintMass";
1579
- Property2[Property2["physicsConstraintWind"] = 24] = "physicsConstraintWind";
1580
- Property2[Property2["physicsConstraintGravity"] = 25] = "physicsConstraintGravity";
1581
- Property2[Property2["physicsConstraintMix"] = 26] = "physicsConstraintMix";
1582
- Property2[Property2["physicsConstraintReset"] = 27] = "physicsConstraintReset";
1583
- Property2[Property2["sequence"] = 28] = "sequence";
1584
- Property2[Property2["sliderTime"] = 29] = "sliderTime";
1585
- Property2[Property2["sliderMix"] = 30] = "sliderMix";
1575
+ Property2[Property2["drawOrderFolder"] = 15] = "drawOrderFolder";
1576
+ Property2[Property2["ikConstraint"] = 16] = "ikConstraint";
1577
+ Property2[Property2["transformConstraint"] = 17] = "transformConstraint";
1578
+ Property2[Property2["pathConstraintPosition"] = 18] = "pathConstraintPosition";
1579
+ Property2[Property2["pathConstraintSpacing"] = 19] = "pathConstraintSpacing";
1580
+ Property2[Property2["pathConstraintMix"] = 20] = "pathConstraintMix";
1581
+ Property2[Property2["physicsConstraintInertia"] = 21] = "physicsConstraintInertia";
1582
+ Property2[Property2["physicsConstraintStrength"] = 22] = "physicsConstraintStrength";
1583
+ Property2[Property2["physicsConstraintDamping"] = 23] = "physicsConstraintDamping";
1584
+ Property2[Property2["physicsConstraintMass"] = 24] = "physicsConstraintMass";
1585
+ Property2[Property2["physicsConstraintWind"] = 25] = "physicsConstraintWind";
1586
+ Property2[Property2["physicsConstraintGravity"] = 26] = "physicsConstraintGravity";
1587
+ Property2[Property2["physicsConstraintMix"] = 27] = "physicsConstraintMix";
1588
+ Property2[Property2["physicsConstraintReset"] = 28] = "physicsConstraintReset";
1589
+ Property2[Property2["sequence"] = 29] = "sequence";
1590
+ Property2[Property2["sliderTime"] = 30] = "sliderTime";
1591
+ Property2[Property2["sliderMix"] = 31] = "sliderMix";
1586
1592
  return Property2;
1587
1593
  })(Property || {});
1588
1594
  var Timeline = class {
1589
1595
  propertyIds;
1590
1596
  frames;
1591
- /** True if this timeline supports additive blending. */
1597
+ /** True if this timeline supports being applied additively.
1598
+ *
1599
+ * See the `add` parameter in {@link Timeline.apply}. */
1592
1600
  additive = false;
1593
1601
  /** True if this timeline sets values instantaneously and does not support interpolation between frames. */
1594
1602
  instant = false;
@@ -1709,7 +1717,7 @@ var spine = (() => {
1709
1717
  return y + (time - x) / (this.frames[frameIndex] - x) * (this.frames[frameIndex + valueOffset] - y);
1710
1718
  }
1711
1719
  };
1712
- var CurveTimeline1 = class extends CurveTimeline {
1720
+ var CurveTimeline1 = class _CurveTimeline1 extends CurveTimeline {
1713
1721
  constructor(frameCount, bezierCount, propertyId) {
1714
1722
  super(frameCount, bezierCount, propertyId);
1715
1723
  }
@@ -1772,41 +1780,51 @@ var spine = (() => {
1772
1780
  * See {@link Timeline.apply}.
1773
1781
  * @param current The current value for the property.
1774
1782
  * @param setup The setup value for the property. */
1775
- getRelativeValue(time, alpha, fromSetup, add, current, setup) {
1776
- if (time < this.frames[0]) return fromSetup ? setup : current;
1783
+ getRelativeValue(time, alpha, from, add, current, setup) {
1784
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1777
1785
  const value = this.getCurveValue(time);
1778
- return fromSetup ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1786
+ return from === 1 /* setup */ ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1779
1787
  }
1780
- getAbsoluteValue(time, alpha, fromSetup, add, current, setup, value) {
1788
+ getAbsoluteValue(time, alpha, from, add, current, setup, value) {
1781
1789
  if (value === void 0)
1782
- return this.getAbsoluteValue1(time, alpha, fromSetup, add, current, setup);
1790
+ return this.getAbsoluteValue1(time, alpha, from, add, current, setup);
1783
1791
  else
1784
- return this.getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value);
1792
+ return this.getAbsoluteValue2(time, alpha, from, add, current, setup, value);
1785
1793
  }
1786
- getAbsoluteValue1(time, alpha, fromSetup, add, current, setup) {
1787
- if (time < this.frames[0]) return fromSetup ? setup : current;
1794
+ getAbsoluteValue1(time, alpha, from, add, current, setup) {
1795
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1788
1796
  const value = this.getCurveValue(time);
1789
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1797
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1790
1798
  }
1791
- getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value) {
1792
- if (time < this.frames[0]) return fromSetup ? setup : current;
1793
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1799
+ getAbsoluteValue2(time, alpha, from, add, current, setup, value) {
1800
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1801
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1794
1802
  }
1795
1803
  /** Returns the interpolated value for scale properties. The timeline and setup values are multiplied and sign adjusted.
1796
1804
  *
1797
1805
  * See {@link Timeline.apply}.
1798
1806
  * @param current The current value for the property.
1799
1807
  * @param setup The setup value for the property. */
1800
- getScaleValue(time, alpha, fromSetup, add, out, current, setup) {
1801
- if (time < this.frames[0]) return fromSetup ? setup : current;
1808
+ getScaleValue(time, alpha, from, add, out, current, setup) {
1809
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1802
1810
  const value = this.getCurveValue(time) * setup;
1803
1811
  if (alpha === 1 && !add) return value;
1804
- let base = fromSetup ? setup : current;
1812
+ let base = from === 1 /* setup */ ? setup : current;
1805
1813
  if (add) return base + (value - setup) * alpha;
1806
1814
  if (out) return base + (Math.abs(value) * Math.sign(base) - base) * alpha;
1807
1815
  base = Math.abs(base) * Math.sign(value);
1808
1816
  return base + (value - base) * alpha;
1809
1817
  }
1818
+ static beforeFirstKey(from, alpha, current, setup) {
1819
+ switch (from) {
1820
+ case 1 /* setup */:
1821
+ return setup;
1822
+ case 2 /* first */:
1823
+ return current + (setup - current) * alpha;
1824
+ case 0 /* current */:
1825
+ return current;
1826
+ }
1827
+ }
1810
1828
  };
1811
1829
  function isBoneTimeline(obj) {
1812
1830
  return typeof obj === "object" && obj !== null && typeof obj.boneIndex === "number";
@@ -1818,10 +1836,10 @@ var spine = (() => {
1818
1836
  this.boneIndex = boneIndex;
1819
1837
  this.additive = true;
1820
1838
  }
1821
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1839
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1822
1840
  const bone = skeleton.bones[this.boneIndex];
1823
1841
  if (bone.active)
1824
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1842
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1825
1843
  }
1826
1844
  };
1827
1845
  var BoneTimeline2 = class extends CurveTimeline {
@@ -1851,30 +1869,36 @@ var spine = (() => {
1851
1869
  /*VALUE2*/
1852
1870
  ] = value2;
1853
1871
  }
1854
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1872
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1855
1873
  const bone = skeleton.bones[this.boneIndex];
1856
1874
  if (bone.active)
1857
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1875
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1858
1876
  }
1859
1877
  };
1860
1878
  var RotateTimeline = class extends BoneTimeline1 {
1861
1879
  constructor(frameCount, bezierCount, boneIndex) {
1862
1880
  super(frameCount, bezierCount, boneIndex, 0 /* rotate */);
1863
1881
  }
1864
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1865
- pose.rotation = this.getRelativeValue(time, alpha, fromSetup, add, pose.rotation, setup.rotation);
1882
+ apply1(pose, setup, time, alpha, from, add, out) {
1883
+ pose.rotation = this.getRelativeValue(time, alpha, from, add, pose.rotation, setup.rotation);
1866
1884
  }
1867
1885
  };
1868
1886
  var TranslateTimeline = class extends BoneTimeline2 {
1869
1887
  constructor(frameCount, bezierCount, boneIndex) {
1870
1888
  super(frameCount, bezierCount, boneIndex, 1 /* x */, 2 /* y */);
1871
1889
  }
1872
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1890
+ apply1(pose, setup, time, alpha, from, add, out) {
1873
1891
  const frames = this.frames;
1874
1892
  if (time < frames[0]) {
1875
- if (fromSetup) {
1876
- pose.x = setup.x;
1877
- pose.y = setup.y;
1893
+ switch (from) {
1894
+ case 1 /* setup */:
1895
+ pose.x = setup.x;
1896
+ pose.y = setup.y;
1897
+ break;
1898
+ case 2 /* first */:
1899
+ pose.x += (setup.x - pose.x) * alpha;
1900
+ pose.y += (setup.y - pose.y) * alpha;
1901
+ break;
1878
1902
  }
1879
1903
  return;
1880
1904
  }
@@ -1940,7 +1964,7 @@ var spine = (() => {
1940
1964
  /*BEZIER*/
1941
1965
  );
1942
1966
  }
1943
- if (fromSetup) {
1967
+ if (from === 1 /* setup */) {
1944
1968
  pose.x = setup.x + x * alpha;
1945
1969
  pose.y = setup.y + y * alpha;
1946
1970
  } else if (add) {
@@ -1956,28 +1980,34 @@ var spine = (() => {
1956
1980
  constructor(frameCount, bezierCount, boneIndex) {
1957
1981
  super(frameCount, bezierCount, boneIndex, 1 /* x */);
1958
1982
  }
1959
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1960
- pose.x = this.getRelativeValue(time, alpha, fromSetup, add, pose.x, setup.x);
1983
+ apply1(pose, setup, time, alpha, from, add, out) {
1984
+ pose.x = this.getRelativeValue(time, alpha, from, add, pose.x, setup.x);
1961
1985
  }
1962
1986
  };
1963
1987
  var TranslateYTimeline = class extends BoneTimeline1 {
1964
1988
  constructor(frameCount, bezierCount, boneIndex) {
1965
1989
  super(frameCount, bezierCount, boneIndex, 2 /* y */);
1966
1990
  }
1967
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1968
- pose.y = this.getRelativeValue(time, alpha, fromSetup, add, pose.y, setup.y);
1991
+ apply1(pose, setup, time, alpha, from, add, out) {
1992
+ pose.y = this.getRelativeValue(time, alpha, from, add, pose.y, setup.y);
1969
1993
  }
1970
1994
  };
1971
1995
  var ScaleTimeline = class extends BoneTimeline2 {
1972
1996
  constructor(frameCount, bezierCount, boneIndex) {
1973
1997
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */, 4 /* scaleY */);
1974
1998
  }
1975
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1999
+ apply1(pose, setup, time, alpha, from, add, out) {
1976
2000
  const frames = this.frames;
1977
2001
  if (time < frames[0]) {
1978
- if (fromSetup) {
1979
- pose.scaleX = setup.scaleX;
1980
- pose.scaleY = setup.scaleY;
2002
+ switch (from) {
2003
+ case 1 /* setup */:
2004
+ pose.scaleX = setup.scaleX;
2005
+ pose.scaleY = setup.scaleY;
2006
+ break;
2007
+ case 2 /* first */:
2008
+ pose.scaleX += (setup.scaleX - pose.scaleX) * alpha;
2009
+ pose.scaleY += (setup.scaleY - pose.scaleY) * alpha;
2010
+ break;
1981
2011
  }
1982
2012
  return;
1983
2013
  }
@@ -2050,7 +2080,7 @@ var spine = (() => {
2050
2080
  pose.scaleY = y;
2051
2081
  } else {
2052
2082
  let bx = 0, by = 0;
2053
- if (fromSetup) {
2083
+ if (from === 1 /* setup */) {
2054
2084
  bx = setup.scaleX;
2055
2085
  by = setup.scaleY;
2056
2086
  } else {
@@ -2076,28 +2106,34 @@ var spine = (() => {
2076
2106
  constructor(frameCount, bezierCount, boneIndex) {
2077
2107
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */);
2078
2108
  }
2079
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2080
- pose.scaleX = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleX, setup.scaleX);
2109
+ apply1(pose, setup, time, alpha, from, add, out) {
2110
+ pose.scaleX = this.getScaleValue(time, alpha, from, add, out, pose.scaleX, setup.scaleX);
2081
2111
  }
2082
2112
  };
2083
2113
  var ScaleYTimeline = class extends BoneTimeline1 {
2084
2114
  constructor(frameCount, bezierCount, boneIndex) {
2085
2115
  super(frameCount, bezierCount, boneIndex, 4 /* scaleY */);
2086
2116
  }
2087
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2088
- pose.scaleY = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleY, setup.scaleY);
2117
+ apply1(pose, setup, time, alpha, from, add, out) {
2118
+ pose.scaleY = this.getScaleValue(time, alpha, from, add, out, pose.scaleY, setup.scaleY);
2089
2119
  }
2090
2120
  };
2091
2121
  var ShearTimeline = class extends BoneTimeline2 {
2092
2122
  constructor(frameCount, bezierCount, boneIndex) {
2093
2123
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */, 6 /* shearY */);
2094
2124
  }
2095
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2125
+ apply1(pose, setup, time, alpha, from, add, out) {
2096
2126
  const frames = this.frames;
2097
2127
  if (time < frames[0]) {
2098
- if (fromSetup) {
2099
- pose.shearX = setup.shearX;
2100
- pose.shearY = setup.shearY;
2128
+ switch (from) {
2129
+ case 1 /* setup */:
2130
+ pose.shearX = setup.shearX;
2131
+ pose.shearY = setup.shearY;
2132
+ break;
2133
+ case 2 /* first */:
2134
+ pose.shearX += (setup.shearX - pose.shearX) * alpha;
2135
+ pose.shearY += (setup.shearY - pose.shearY) * alpha;
2136
+ break;
2101
2137
  }
2102
2138
  return;
2103
2139
  }
@@ -2163,7 +2199,7 @@ var spine = (() => {
2163
2199
  /*BEZIER*/
2164
2200
  );
2165
2201
  }
2166
- if (fromSetup) {
2202
+ if (from === 1 /* setup */) {
2167
2203
  pose.shearX = setup.shearX + x * alpha;
2168
2204
  pose.shearY = setup.shearY + y * alpha;
2169
2205
  } else if (add) {
@@ -2179,16 +2215,16 @@ var spine = (() => {
2179
2215
  constructor(frameCount, bezierCount, boneIndex) {
2180
2216
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */);
2181
2217
  }
2182
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2183
- pose.shearX = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearX, setup.shearX);
2218
+ apply1(pose, setup, time, alpha, from, add, out) {
2219
+ pose.shearX = this.getRelativeValue(time, alpha, from, add, pose.shearX, setup.shearX);
2184
2220
  }
2185
2221
  };
2186
2222
  var ShearYTimeline = class extends BoneTimeline1 {
2187
2223
  constructor(frameCount, bezierCount, boneIndex) {
2188
2224
  super(frameCount, bezierCount, boneIndex, 6 /* shearY */);
2189
2225
  }
2190
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2191
- pose.shearY = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearY, setup.shearY);
2226
+ apply1(pose, setup, time, alpha, from, add, out) {
2227
+ pose.shearY = this.getRelativeValue(time, alpha, from, add, pose.shearY, setup.shearY);
2192
2228
  }
2193
2229
  };
2194
2230
  var InheritTimeline = class extends Timeline {
@@ -2212,16 +2248,16 @@ var spine = (() => {
2212
2248
  /*INHERIT*/
2213
2249
  ] = inherit;
2214
2250
  }
2215
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2251
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2216
2252
  const bone = skeleton.bones[this.boneIndex];
2217
2253
  if (!bone.active) return;
2218
2254
  const pose = appliedPose ? bone.appliedPose : bone.pose;
2219
2255
  if (out) {
2220
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2256
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2221
2257
  } else {
2222
2258
  const frames = this.frames;
2223
2259
  if (time < frames[0]) {
2224
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2260
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2225
2261
  } else
2226
2262
  pose.inherit = this.frames[
2227
2263
  Timeline.search(
@@ -2241,9 +2277,9 @@ var spine = (() => {
2241
2277
  super(frameCount, bezierCount, ...propertyIds);
2242
2278
  this.slotIndex = slotIndex;
2243
2279
  }
2244
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2280
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2245
2281
  const slot = skeleton.slots[this.slotIndex];
2246
- if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, fromSetup, add);
2282
+ if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, from, add);
2247
2283
  }
2248
2284
  };
2249
2285
  var RGBATimeline = class extends SlotCurveTimeline {
@@ -2282,11 +2318,24 @@ var spine = (() => {
2282
2318
  /*A*/
2283
2319
  ] = a;
2284
2320
  }
2285
- apply1(slot, pose, time, alpha, fromSetup, add) {
2321
+ apply1(slot, pose, time, alpha, from, add) {
2286
2322
  const color = pose.color;
2287
2323
  const frames = this.frames;
2288
2324
  if (time < frames[0]) {
2289
- if (fromSetup) color.setFromColor(slot.data.setupPose.color);
2325
+ const setup = slot.data.setupPose.color;
2326
+ switch (from) {
2327
+ case 1 /* setup */:
2328
+ color.setFromColor(setup);
2329
+ break;
2330
+ case 2 /* first */:
2331
+ color.add(
2332
+ (setup.r - color.r) * alpha,
2333
+ (setup.g - color.g) * alpha,
2334
+ (setup.b - color.b) * alpha,
2335
+ (setup.a - color.a) * alpha
2336
+ );
2337
+ break;
2338
+ }
2290
2339
  return;
2291
2340
  }
2292
2341
  let r = 0, g = 0, b = 0, a = 0;
@@ -2392,7 +2441,7 @@ var spine = (() => {
2392
2441
  if (alpha === 1)
2393
2442
  color.set(r, g, b, a);
2394
2443
  else {
2395
- if (fromSetup) {
2444
+ if (from === 1 /* setup */) {
2396
2445
  const setup = slot.data.setupPose.color;
2397
2446
  color.set(
2398
2447
  setup.r + (r - setup.r) * alpha,
@@ -2429,16 +2478,25 @@ var spine = (() => {
2429
2478
  /*B*/
2430
2479
  ] = b;
2431
2480
  }
2432
- apply1(slot, pose, time, alpha, fromSetup, add) {
2481
+ apply1(slot, pose, time, alpha, from, add) {
2433
2482
  const color = pose.color;
2434
2483
  let r = 0, g = 0, b = 0;
2435
2484
  const frames = this.frames;
2436
2485
  if (time < frames[0]) {
2437
- if (fromSetup) {
2438
- const setup = slot.data.setupPose.color;
2439
- color.r = setup.r;
2440
- color.g = setup.g;
2441
- color.b = setup.b;
2486
+ const setup = slot.data.setupPose.color;
2487
+ switch (from) {
2488
+ case 1 /* setup */: {
2489
+ color.r = setup.r;
2490
+ color.g = setup.g;
2491
+ color.b = setup.b;
2492
+ break;
2493
+ }
2494
+ case 2 /* first */: {
2495
+ color.r += (setup.r - color.r) * alpha;
2496
+ color.g += (setup.g - color.g) * alpha;
2497
+ color.b += (setup.b - color.b) * alpha;
2498
+ break;
2499
+ }
2442
2500
  }
2443
2501
  return;
2444
2502
  }
@@ -2520,7 +2578,7 @@ var spine = (() => {
2520
2578
  );
2521
2579
  }
2522
2580
  if (alpha !== 1) {
2523
- if (fromSetup) {
2581
+ if (from === 1 /* setup */) {
2524
2582
  const setup = slot.data.setupPose.color;
2525
2583
  r = setup.r + (r - setup.r) * alpha;
2526
2584
  g = setup.g + (g - setup.g) * alpha;
@@ -2542,19 +2600,27 @@ var spine = (() => {
2542
2600
  super(frameCount, bezierCount, `${9 /* alpha */}|${slotIndex}`);
2543
2601
  this.slotIndex = slotIndex;
2544
2602
  }
2545
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2603
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2546
2604
  const slot = skeleton.slots[this.slotIndex];
2547
2605
  if (!slot.bone.active) return;
2548
2606
  const color = (appliedPose ? slot.appliedPose : slot.pose).color;
2549
2607
  let a = 0;
2550
2608
  const frames = this.frames;
2551
2609
  if (time < frames[0]) {
2552
- if (fromSetup) color.a = slot.data.setupPose.color.a;
2610
+ const setup = slot.data.setupPose.color.a;
2611
+ switch (from) {
2612
+ case 1 /* setup */:
2613
+ color.a = setup;
2614
+ break;
2615
+ case 2 /* first */:
2616
+ color.a += (setup - color.a) * alpha;
2617
+ break;
2618
+ }
2553
2619
  return;
2554
2620
  }
2555
2621
  a = this.getCurveValue(time);
2556
2622
  if (alpha !== 1) {
2557
- if (fromSetup) {
2623
+ if (from === 1 /* setup */) {
2558
2624
  const setup = slot.data.setupPose.color;
2559
2625
  a = setup.a + (a - setup.a) * alpha;
2560
2626
  } else
@@ -2613,18 +2679,33 @@ var spine = (() => {
2613
2679
  /*B2*/
2614
2680
  ] = b2;
2615
2681
  }
2616
- apply1(slot, pose, time, alpha, fromSetup, add) {
2682
+ apply1(slot, pose, time, alpha, from, add) {
2617
2683
  const light = pose.color, dark = pose.darkColor;
2618
2684
  let r2 = 0, g2 = 0, b2 = 0;
2619
2685
  const frames = this.frames;
2620
2686
  if (time < frames[0]) {
2621
- if (fromSetup) {
2622
- const setup = slot.data.setupPose;
2623
- light.setFromColor(setup.color);
2624
- const setupDark = setup.darkColor;
2625
- dark.r = setupDark.r;
2626
- dark.g = setupDark.g;
2627
- dark.b = setupDark.b;
2687
+ const setup = slot.data.setupPose;
2688
+ const setupLight = setup.color, setupDark = setup.darkColor;
2689
+ switch (from) {
2690
+ case 1 /* setup */: {
2691
+ light.setFromColor(setupLight);
2692
+ dark.r = setupDark.r;
2693
+ dark.g = setupDark.g;
2694
+ dark.b = setupDark.b;
2695
+ break;
2696
+ }
2697
+ case 2 /* first */: {
2698
+ light.add(
2699
+ (setupLight.r - light.r) * alpha,
2700
+ (setupLight.g - light.g) * alpha,
2701
+ (setupLight.b - light.b) * alpha,
2702
+ (setupLight.a - light.a) * alpha
2703
+ );
2704
+ dark.r += (setupDark.r - dark.r) * alpha;
2705
+ dark.g += (setupDark.g - dark.g) * alpha;
2706
+ dark.b += (setupDark.b - dark.b) * alpha;
2707
+ break;
2708
+ }
2628
2709
  }
2629
2710
  return;
2630
2711
  }
@@ -2784,7 +2865,7 @@ var spine = (() => {
2784
2865
  }
2785
2866
  if (alpha === 1)
2786
2867
  light.set(r, g, b, a);
2787
- else if (fromSetup) {
2868
+ else if (from === 1 /* setup */) {
2788
2869
  const setupPose = slot.data.setupPose;
2789
2870
  let setup = setupPose.color;
2790
2871
  light.set(
@@ -2852,20 +2933,30 @@ var spine = (() => {
2852
2933
  /*B2*/
2853
2934
  ] = b2;
2854
2935
  }
2855
- apply1(slot, pose, time, alpha, fromSetup, add) {
2936
+ apply1(slot, pose, time, alpha, from, add) {
2856
2937
  const light = pose.color, dark = pose.darkColor;
2857
2938
  let r = 0, g = 0, b = 0, r2 = 0, g2 = 0, b2 = 0;
2858
2939
  const frames = this.frames;
2859
2940
  if (time < frames[0]) {
2860
- if (fromSetup) {
2861
- const setup = slot.data.setupPose;
2862
- const setupLight = setup.color, setupDark = setup.darkColor;
2863
- light.r = setupLight.r;
2864
- light.g = setupLight.g;
2865
- light.b = setupLight.b;
2866
- dark.r = setupDark.r;
2867
- dark.g = setupDark.g;
2868
- dark.b = setupDark.b;
2941
+ const setup = slot.data.setupPose;
2942
+ const setupLight = setup.color, setupDark = setup.darkColor;
2943
+ switch (from) {
2944
+ case 1 /* setup */:
2945
+ light.r = setupLight.r;
2946
+ light.g = setupLight.g;
2947
+ light.b = setupLight.b;
2948
+ dark.r = setupDark.r;
2949
+ dark.g = setupDark.g;
2950
+ dark.b = setupDark.b;
2951
+ break;
2952
+ case 2 /* first */:
2953
+ light.r += (setupLight.r - light.r) * alpha;
2954
+ light.g += (setupLight.g - light.g) * alpha;
2955
+ light.b += (setupLight.b - light.b) * alpha;
2956
+ dark.r += (setupDark.r - dark.r) * alpha;
2957
+ dark.g += (setupDark.g - dark.g) * alpha;
2958
+ dark.b += (setupDark.b - dark.b) * alpha;
2959
+ break;
2869
2960
  }
2870
2961
  return;
2871
2962
  }
@@ -3007,7 +3098,7 @@ var spine = (() => {
3007
3098
  );
3008
3099
  }
3009
3100
  if (alpha !== 1) {
3010
- if (fromSetup) {
3101
+ if (from === 1 /* setup */) {
3011
3102
  const setupPose = slot.data.setupPose;
3012
3103
  let setup = setupPose.color;
3013
3104
  r = setup.r + (r - setup.r) * alpha;
@@ -3052,12 +3143,12 @@ var spine = (() => {
3052
3143
  this.frames[frame] = time;
3053
3144
  this.attachmentNames[frame] = attachmentName;
3054
3145
  }
3055
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3146
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3056
3147
  const slot = skeleton.slots[this.slotIndex];
3057
3148
  if (!slot.bone.active) return;
3058
3149
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3059
3150
  if (out || time < this.frames[0]) {
3060
- if (fromSetup) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3151
+ if (from !== 0 /* current */) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3061
3152
  } else
3062
3153
  this.setAttachment(skeleton, pose, this.attachmentNames[Timeline.search(this.frames, time)]);
3063
3154
  }
@@ -3139,15 +3230,15 @@ var spine = (() => {
3139
3230
  const x = curves[n - 2], y = curves[n - 1];
3140
3231
  return y + (1 - y) * (time - x) / (this.frames[frame + this.getFrameEntries()] - x);
3141
3232
  }
3142
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3233
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3143
3234
  const slots = skeleton.slots;
3144
3235
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3145
3236
  const timelineSlots = this.attachment.timelineSlots;
3146
3237
  const frames = this.frames;
3147
3238
  if (time < frames[0]) {
3148
- this.applyBeforeFirst(slots[this.slotIndex], appliedPose, fromSetup);
3239
+ this.applyBeforeFirst(slots[this.slotIndex], appliedPose, alpha, from);
3149
3240
  for (const slotIndex of timelineSlots)
3150
- this.applyBeforeFirst(slots[slotIndex], appliedPose, fromSetup);
3241
+ this.applyBeforeFirst(slots[slotIndex], appliedPose, alpha, from);
3151
3242
  return;
3152
3243
  }
3153
3244
  let v1, v2;
@@ -3163,17 +3254,49 @@ var spine = (() => {
3163
3254
  v2 = this.vertices[frame + 1];
3164
3255
  }
3165
3256
  const vertexCount = this.vertices[0].length;
3166
- this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3257
+ this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3167
3258
  for (const slotIndex of timelineSlots)
3168
- this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3259
+ this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3260
+ }
3261
+ applyBeforeFirst(slot, appliedPose, alpha, from) {
3262
+ if (!slot.bone.active) return;
3263
+ const pose = appliedPose ? slot.appliedPose : slot.pose;
3264
+ if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3265
+ const deformArray = pose.deform;
3266
+ if (deformArray.length === 0) from = 1 /* setup */;
3267
+ switch (from) {
3268
+ case 1 /* setup */:
3269
+ deformArray.length = 0;
3270
+ break;
3271
+ case 2 /* first */: {
3272
+ if (alpha === 1) {
3273
+ deformArray.length = 0;
3274
+ return;
3275
+ }
3276
+ const vertexCount = this.vertices[0].length;
3277
+ deformArray.length = vertexCount;
3278
+ const deform = deformArray;
3279
+ const vertexAttachment = pose.attachment;
3280
+ if (vertexAttachment.bones === null) {
3281
+ const setupVertices = vertexAttachment.vertices;
3282
+ for (let i = 0; i < vertexCount; i++)
3283
+ deform[i] += (setupVertices[i] - deform[i]) * alpha;
3284
+ } else {
3285
+ alpha = 1 - alpha;
3286
+ for (let i = 0; i < vertexCount; i++)
3287
+ deform[i] *= alpha;
3288
+ }
3289
+ }
3290
+ }
3169
3291
  }
3170
- applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add) {
3292
+ applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, from, add) {
3171
3293
  if (!slot.bone.active) return;
3172
3294
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3173
3295
  if (pose.attachment === null || pose.attachment.timelineAttachment !== this.attachment) return;
3174
3296
  const vertexAttachment = pose.attachment;
3175
3297
  const deform = pose.deform;
3176
- if (deform.length === 0) fromSetup = true;
3298
+ if (deform.length === 0) from = 1 /* setup */;
3299
+ const fromSetup = from === 1 /* setup */;
3177
3300
  deform.length = vertexCount;
3178
3301
  if (v2 === null) {
3179
3302
  if (alpha === 1) {
@@ -3269,13 +3392,6 @@ var spine = (() => {
3269
3392
  }
3270
3393
  }
3271
3394
  }
3272
- applyBeforeFirst(slot, appliedPose, fromSetup) {
3273
- if (!slot.bone.active) return;
3274
- const pose = appliedPose ? slot.appliedPose : slot.pose;
3275
- if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3276
- if (pose.deform.length === 0) fromSetup = true;
3277
- if (fromSetup) pose.deform.length = 0;
3278
- }
3279
3395
  };
3280
3396
  var SequenceTimeline = class _SequenceTimeline extends Timeline {
3281
3397
  static ENTRIES = 3;
@@ -3284,7 +3400,7 @@ var spine = (() => {
3284
3400
  slotIndex;
3285
3401
  attachment;
3286
3402
  constructor(frameCount, slotIndex, attachment) {
3287
- super(frameCount, `${28 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3403
+ super(frameCount, `${29 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3288
3404
  this.slotIndex = slotIndex;
3289
3405
  this.attachment = attachment;
3290
3406
  this.instant = true;
@@ -3311,13 +3427,13 @@ var spine = (() => {
3311
3427
  frames[frame + _SequenceTimeline.MODE] = mode | index << 4;
3312
3428
  frames[frame + _SequenceTimeline.DELAY] = delay;
3313
3429
  }
3314
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3430
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3315
3431
  const slots = skeleton.slots;
3316
3432
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3317
3433
  const timelineSlots = this.attachment.timelineSlots;
3318
3434
  const frames = this.frames;
3319
3435
  if (out || time < frames[0]) {
3320
- if (fromSetup) {
3436
+ if (from !== 0 /* current */) {
3321
3437
  this.setupPose(slots[this.slotIndex], appliedPose);
3322
3438
  for (const slotIndex of timelineSlots)
3323
3439
  this.setupPose(slots[slotIndex], appliedPose);
@@ -3393,12 +3509,12 @@ var spine = (() => {
3393
3509
  this.events[frame] = event;
3394
3510
  }
3395
3511
  /** Fires events for frames > `lastTime` and <= `time`. */
3396
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3512
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3397
3513
  if (!firedEvents) return;
3398
3514
  const frames = this.frames;
3399
3515
  const frameCount = this.frames.length;
3400
3516
  if (lastTime > time) {
3401
- this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, false, false, false, false);
3517
+ this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, from, false, false, false);
3402
3518
  lastTime = -1;
3403
3519
  } else if (lastTime >= frames[frameCount - 1])
3404
3520
  return;
@@ -3438,11 +3554,11 @@ var spine = (() => {
3438
3554
  this.frames[frame] = time;
3439
3555
  this.drawOrders[frame] = drawOrder;
3440
3556
  }
3441
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3557
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3442
3558
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3443
3559
  const setup = skeleton.slots;
3444
3560
  if (out || time < this.frames[0]) {
3445
- if (fromSetup) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3561
+ if (from !== 0 /* current */) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3446
3562
  return;
3447
3563
  }
3448
3564
  const order = this.drawOrders[Timeline.search(this.frames, time)];
@@ -3455,6 +3571,7 @@ var spine = (() => {
3455
3571
  }
3456
3572
  };
3457
3573
  var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3574
+ static propertyID = `${15 /* drawOrderFolder */}`;
3458
3575
  slots;
3459
3576
  inFolder;
3460
3577
  drawOrders;
@@ -3473,7 +3590,7 @@ var spine = (() => {
3473
3590
  const n = slots.length;
3474
3591
  const ids = new Array(n);
3475
3592
  for (let i = 0; i < n; i++)
3476
- ids[i] = `d${slots[i]}`;
3593
+ ids[i] = `${_DrawOrderFolderTimeline.propertyID}|${slots[i]}`;
3477
3594
  return ids;
3478
3595
  }
3479
3596
  getFrameCount() {
@@ -3495,11 +3612,11 @@ var spine = (() => {
3495
3612
  this.frames[frame] = time;
3496
3613
  this.drawOrders[frame] = drawOrder;
3497
3614
  }
3498
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3615
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3499
3616
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3500
3617
  const setup = skeleton.slots;
3501
3618
  if (out || time < this.frames[0]) {
3502
- if (fromSetup) this.setup(pose, setup);
3619
+ if (from !== 0 /* current */) this.setup(pose, setup);
3503
3620
  } else {
3504
3621
  const order = this.drawOrders[Timeline.search(this.frames, time)];
3505
3622
  if (!order)
@@ -3532,7 +3649,7 @@ var spine = (() => {
3532
3649
  var IkConstraintTimeline = class extends CurveTimeline {
3533
3650
  constraintIndex = 0;
3534
3651
  constructor(frameCount, bezierCount, constraintIndex) {
3535
- super(frameCount, bezierCount, `${15 /* ikConstraint */}|${constraintIndex}`);
3652
+ super(frameCount, bezierCount, `${16 /* ikConstraint */}|${constraintIndex}`);
3536
3653
  this.constraintIndex = constraintIndex;
3537
3654
  }
3538
3655
  getFrameEntries() {
@@ -3566,19 +3683,30 @@ var spine = (() => {
3566
3683
  /*STRETCH*/
3567
3684
  ] = stretch ? 1 : 0;
3568
3685
  }
3569
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3686
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3570
3687
  const constraint = skeleton.constraints[this.constraintIndex];
3571
3688
  if (!constraint.active) return;
3572
3689
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3573
3690
  const frames = this.frames;
3574
3691
  if (time < frames[0]) {
3575
- if (fromSetup) {
3576
- const setup = constraint.data.setupPose;
3577
- pose.mix = setup.mix;
3578
- pose.softness = setup.softness;
3579
- pose.bendDirection = setup.bendDirection;
3580
- pose.compress = setup.compress;
3581
- pose.stretch = setup.stretch;
3692
+ const setup = constraint.data.setupPose;
3693
+ switch (from) {
3694
+ case 1 /* setup */: {
3695
+ pose.mix = setup.mix;
3696
+ pose.softness = setup.softness;
3697
+ pose.bendDirection = setup.bendDirection;
3698
+ pose.compress = setup.compress;
3699
+ pose.stretch = setup.stretch;
3700
+ break;
3701
+ }
3702
+ case 2 /* first */: {
3703
+ pose.mix += (setup.mix - pose.mix) * alpha;
3704
+ pose.softness += (setup.softness - pose.softness) * alpha;
3705
+ pose.bendDirection = setup.bendDirection;
3706
+ pose.compress = setup.compress;
3707
+ pose.stretch = setup.stretch;
3708
+ break;
3709
+ }
3582
3710
  }
3583
3711
  return;
3584
3712
  }
@@ -3644,11 +3772,11 @@ var spine = (() => {
3644
3772
  /*BEZIER*/
3645
3773
  );
3646
3774
  }
3647
- const base = fromSetup ? constraint.data.setupPose : pose;
3775
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3648
3776
  pose.mix = base.mix + (mix - base.mix) * alpha;
3649
3777
  pose.softness = base.softness + (softness - base.softness) * alpha;
3650
3778
  if (out) {
3651
- if (fromSetup) {
3779
+ if (from === 1 /* setup */) {
3652
3780
  pose.bendDirection = base.bendDirection;
3653
3781
  pose.compress = base.compress;
3654
3782
  pose.stretch = base.stretch;
@@ -3673,7 +3801,7 @@ var spine = (() => {
3673
3801
  /** The index of the transform constraint slot in {@link Skeleton.transformConstraints} that will be changed. */
3674
3802
  constraintIndex = 0;
3675
3803
  constructor(frameCount, bezierCount, constraintIndex) {
3676
- super(frameCount, bezierCount, `${16 /* transformConstraint */}|${constraintIndex}`);
3804
+ super(frameCount, bezierCount, `${17 /* transformConstraint */}|${constraintIndex}`);
3677
3805
  this.constraintIndex = constraintIndex;
3678
3806
  this.additive = true;
3679
3807
  }
@@ -3712,20 +3840,32 @@ var spine = (() => {
3712
3840
  /*SHEARY*/
3713
3841
  ] = mixShearY;
3714
3842
  }
3715
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3843
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3716
3844
  const constraint = skeleton.constraints[this.constraintIndex];
3717
3845
  if (!constraint.active) return;
3718
3846
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3719
3847
  const frames = this.frames;
3720
3848
  if (time < frames[0]) {
3721
- if (fromSetup) {
3722
- const setup = constraint.data.setupPose;
3723
- pose.mixRotate = setup.mixRotate;
3724
- pose.mixX = setup.mixX;
3725
- pose.mixY = setup.mixY;
3726
- pose.mixScaleX = setup.mixScaleX;
3727
- pose.mixScaleY = setup.mixScaleY;
3728
- pose.mixShearY = setup.mixShearY;
3849
+ const setup = constraint.data.setupPose;
3850
+ switch (from) {
3851
+ case 1 /* setup */: {
3852
+ pose.mixRotate = setup.mixRotate;
3853
+ pose.mixX = setup.mixX;
3854
+ pose.mixY = setup.mixY;
3855
+ pose.mixScaleX = setup.mixScaleX;
3856
+ pose.mixScaleY = setup.mixScaleY;
3857
+ pose.mixShearY = setup.mixShearY;
3858
+ break;
3859
+ }
3860
+ case 2 /* first */: {
3861
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
3862
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
3863
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
3864
+ pose.mixScaleX += (setup.mixScaleX - pose.mixScaleX) * alpha;
3865
+ pose.mixScaleY += (setup.mixScaleY - pose.mixScaleY) * alpha;
3866
+ pose.mixShearY += (setup.mixShearY - pose.mixShearY) * alpha;
3867
+ break;
3868
+ }
3729
3869
  }
3730
3870
  return;
3731
3871
  }
@@ -3867,7 +4007,7 @@ var spine = (() => {
3867
4007
  /*BEZIER*/
3868
4008
  );
3869
4009
  }
3870
- const base = fromSetup ? constraint.data.setupPose : pose;
4010
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3871
4011
  if (add) {
3872
4012
  pose.mixRotate = base.mixRotate + rotate * alpha;
3873
4013
  pose.mixX = base.mixX + x * alpha;
@@ -3894,29 +4034,29 @@ var spine = (() => {
3894
4034
  };
3895
4035
  var PathConstraintPositionTimeline = class extends ConstraintTimeline1 {
3896
4036
  constructor(frameCount, bezierCount, constraintIndex) {
3897
- super(frameCount, bezierCount, constraintIndex, 17 /* pathConstraintPosition */);
4037
+ super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintPosition */);
3898
4038
  this.additive = true;
3899
4039
  }
3900
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4040
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3901
4041
  const constraint = skeleton.constraints[this.constraintIndex];
3902
4042
  if (constraint.active) {
3903
4043
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3904
- pose.position = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.position, constraint.data.setupPose.position);
4044
+ pose.position = this.getAbsoluteValue(time, alpha, from, add, pose.position, constraint.data.setupPose.position);
3905
4045
  }
3906
4046
  }
3907
4047
  };
3908
4048
  var PathConstraintSpacingTimeline = class extends ConstraintTimeline1 {
3909
4049
  constructor(frameCount, bezierCount, constraintIndex) {
3910
- super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintSpacing */);
4050
+ super(frameCount, bezierCount, constraintIndex, 19 /* pathConstraintSpacing */);
3911
4051
  }
3912
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4052
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3913
4053
  const constraint = skeleton.constraints[this.constraintIndex];
3914
4054
  if (constraint.active) {
3915
4055
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3916
4056
  pose.spacing = this.getAbsoluteValue(
3917
4057
  time,
3918
4058
  alpha,
3919
- fromSetup,
4059
+ from,
3920
4060
  false,
3921
4061
  pose.spacing,
3922
4062
  constraint.data.setupPose.spacing
@@ -3927,7 +4067,7 @@ var spine = (() => {
3927
4067
  var PathConstraintMixTimeline = class extends CurveTimeline {
3928
4068
  constraintIndex;
3929
4069
  constructor(frameCount, bezierCount, constraintIndex) {
3930
- super(frameCount, bezierCount, `${19 /* pathConstraintMix */}|${constraintIndex}`);
4070
+ super(frameCount, bezierCount, `${20 /* pathConstraintMix */}|${constraintIndex}`);
3931
4071
  this.constraintIndex = constraintIndex;
3932
4072
  }
3933
4073
  getFrameEntries() {
@@ -3953,17 +4093,26 @@ var spine = (() => {
3953
4093
  /*Y*/
3954
4094
  ] = mixY;
3955
4095
  }
3956
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4096
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3957
4097
  const constraint = skeleton.constraints[this.constraintIndex];
3958
4098
  if (!constraint.active) return;
3959
4099
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3960
4100
  const frames = this.frames;
3961
4101
  if (time < frames[0]) {
3962
- if (fromSetup) {
3963
- const setup = constraint.data.setupPose;
3964
- pose.mixRotate = setup.mixRotate;
3965
- pose.mixX = setup.mixX;
3966
- pose.mixY = setup.mixY;
4102
+ const setup = constraint.data.setupPose;
4103
+ switch (from) {
4104
+ case 1 /* setup */: {
4105
+ pose.mixRotate = setup.mixRotate;
4106
+ pose.mixX = setup.mixX;
4107
+ pose.mixY = setup.mixY;
4108
+ break;
4109
+ }
4110
+ case 2 /* first */: {
4111
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
4112
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
4113
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
4114
+ break;
4115
+ }
3967
4116
  }
3968
4117
  return;
3969
4118
  }
@@ -4045,7 +4194,7 @@ var spine = (() => {
4045
4194
  /*BEZIER*/
4046
4195
  );
4047
4196
  }
4048
- const base = fromSetup ? constraint.data.setupPose : pose;
4197
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
4049
4198
  if (add) {
4050
4199
  pose.mixRotate = base.mixRotate + rotate * alpha;
4051
4200
  pose.mixX = base.mixX + x * alpha;
@@ -4062,7 +4211,7 @@ var spine = (() => {
4062
4211
  constructor(frameCount, bezierCount, constraintIndex, property) {
4063
4212
  super(frameCount, bezierCount, constraintIndex, property);
4064
4213
  }
4065
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4214
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4066
4215
  if (add && !this.additive) add = false;
4067
4216
  if (this.constraintIndex === -1) {
4068
4217
  const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
@@ -4070,21 +4219,21 @@ var spine = (() => {
4070
4219
  for (const constraint of constraints) {
4071
4220
  if (constraint.active && this.global(constraint.data)) {
4072
4221
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4073
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose), value));
4222
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose), value));
4074
4223
  }
4075
4224
  }
4076
4225
  } else {
4077
4226
  const constraint = skeleton.constraints[this.constraintIndex];
4078
4227
  if (constraint.active) {
4079
4228
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4080
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose)));
4229
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose)));
4081
4230
  }
4082
4231
  }
4083
4232
  }
4084
4233
  };
4085
4234
  var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
4086
4235
  constructor(frameCount, bezierCount, constraintIndex) {
4087
- super(frameCount, bezierCount, constraintIndex, 20 /* physicsConstraintInertia */);
4236
+ super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintInertia */);
4088
4237
  }
4089
4238
  get(pose) {
4090
4239
  return pose.inertia;
@@ -4098,7 +4247,7 @@ var spine = (() => {
4098
4247
  };
4099
4248
  var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
4100
4249
  constructor(frameCount, bezierCount, constraintIndex) {
4101
- super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintStrength */);
4250
+ super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintStrength */);
4102
4251
  }
4103
4252
  get(pose) {
4104
4253
  return pose.strength;
@@ -4112,7 +4261,7 @@ var spine = (() => {
4112
4261
  };
4113
4262
  var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
4114
4263
  constructor(frameCount, bezierCount, constraintIndex) {
4115
- super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintDamping */);
4264
+ super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintDamping */);
4116
4265
  }
4117
4266
  get(pose) {
4118
4267
  return pose.damping;
@@ -4126,7 +4275,7 @@ var spine = (() => {
4126
4275
  };
4127
4276
  var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
4128
4277
  constructor(frameCount, bezierCount, constraintIndex) {
4129
- super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintMass */);
4278
+ super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintMass */);
4130
4279
  }
4131
4280
  get(pose) {
4132
4281
  return 1 / pose.massInverse;
@@ -4140,7 +4289,7 @@ var spine = (() => {
4140
4289
  };
4141
4290
  var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
4142
4291
  constructor(frameCount, bezierCount, constraintIndex) {
4143
- super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintWind */);
4292
+ super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintWind */);
4144
4293
  this.additive = true;
4145
4294
  }
4146
4295
  get(pose) {
@@ -4155,7 +4304,7 @@ var spine = (() => {
4155
4304
  };
4156
4305
  var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
4157
4306
  constructor(frameCount, bezierCount, constraintIndex) {
4158
- super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintGravity */);
4307
+ super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintGravity */);
4159
4308
  this.additive = true;
4160
4309
  }
4161
4310
  get(pose) {
@@ -4170,7 +4319,7 @@ var spine = (() => {
4170
4319
  };
4171
4320
  var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
4172
4321
  constructor(frameCount, bezierCount, constraintIndex) {
4173
- super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintMix */);
4322
+ super(frameCount, bezierCount, constraintIndex, 27 /* physicsConstraintMix */);
4174
4323
  }
4175
4324
  get(pose) {
4176
4325
  return pose.mix;
@@ -4183,7 +4332,7 @@ var spine = (() => {
4183
4332
  }
4184
4333
  };
4185
4334
  var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
4186
- static propertyIds = [27 /* physicsConstraintReset */.toString()];
4335
+ static propertyIds = [28 /* physicsConstraintReset */.toString()];
4187
4336
  /** The index of the physics constraint in {@link Skeleton.contraints} that will be reset when this timeline is
4188
4337
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
4189
4338
  constraintIndex;
@@ -4202,7 +4351,7 @@ var spine = (() => {
4202
4351
  this.frames[frame] = time;
4203
4352
  }
4204
4353
  /** Resets the physics constraint when frames > `lastTime` and <= `time`. */
4205
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4354
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4206
4355
  let constraint;
4207
4356
  if (this.constraintIndex !== -1) {
4208
4357
  constraint = skeleton.constraints[this.constraintIndex];
@@ -4210,7 +4359,7 @@ var spine = (() => {
4210
4359
  }
4211
4360
  const frames = this.frames;
4212
4361
  if (lastTime > time) {
4213
- this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, false, false, false, false);
4362
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, from, false, false, false);
4214
4363
  lastTime = -1;
4215
4364
  } else if (lastTime >= frames[frames.length - 1])
4216
4365
  return;
@@ -4228,26 +4377,26 @@ var spine = (() => {
4228
4377
  };
4229
4378
  var SliderTimeline = class extends ConstraintTimeline1 {
4230
4379
  constructor(frameCount, bezierCount, constraintIndex) {
4231
- super(frameCount, bezierCount, constraintIndex, 29 /* sliderTime */);
4380
+ super(frameCount, bezierCount, constraintIndex, 30 /* sliderTime */);
4232
4381
  }
4233
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4382
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4234
4383
  const constraint = skeleton.constraints[this.constraintIndex];
4235
4384
  if (constraint.active) {
4236
4385
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4237
- pose.time = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.time, constraint.data.setupPose.time);
4386
+ pose.time = this.getAbsoluteValue(time, alpha, from, add, pose.time, constraint.data.setupPose.time);
4238
4387
  }
4239
4388
  }
4240
4389
  };
4241
4390
  var SliderMixTimeline = class extends ConstraintTimeline1 {
4242
4391
  constructor(frameCount, bezierCount, constraintIndex) {
4243
- super(frameCount, bezierCount, constraintIndex, 30 /* sliderMix */);
4392
+ super(frameCount, bezierCount, constraintIndex, 31 /* sliderMix */);
4244
4393
  this.additive = true;
4245
4394
  }
4246
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4395
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4247
4396
  const constraint = skeleton.constraints[this.constraintIndex];
4248
4397
  if (constraint.active) {
4249
4398
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4250
- pose.mix = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.mix, constraint.data.setupPose.mix);
4399
+ pose.mix = this.getAbsoluteValue(time, alpha, from, add, pose.mix, constraint.data.setupPose.mix);
4251
4400
  }
4252
4401
  }
4253
4402
  };
@@ -4268,7 +4417,7 @@ var spine = (() => {
4268
4417
  events = [];
4269
4418
  listeners = [];
4270
4419
  queue = new EventQueue(this);
4271
- propertyIds = new StringSet();
4420
+ propertyIds = /* @__PURE__ */ new Map();
4272
4421
  animationsChanged = false;
4273
4422
  trackEntryPool = new Pool(() => new TrackEntry());
4274
4423
  constructor(data) {
@@ -4377,9 +4526,9 @@ var spine = (() => {
4377
4526
  Utils.webkit602BugfixHelper(alpha);
4378
4527
  const timeline = timelines[ii];
4379
4528
  if (timeline instanceof AttachmentTimeline)
4380
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, true, true);
4529
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, 1 /* setup */, true);
4381
4530
  else
4382
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, true, false, false, false);
4531
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, 1 /* setup */, false, false, false);
4383
4532
  }
4384
4533
  } else {
4385
4534
  const timelineMode = current.timelineMode;
@@ -4389,14 +4538,14 @@ var spine = (() => {
4389
4538
  if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
4390
4539
  for (let ii = 0; ii < timelineCount; ii++) {
4391
4540
  const timeline = timelines[ii];
4392
- const fromSetup = (timelineMode[ii] & FIRST) !== 0;
4541
+ const from = timelineMode[ii] & MODE;
4393
4542
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4394
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, current.timelinesRotation, ii << 1, firstFrame);
4543
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, from, current.timelinesRotation, ii << 1, firstFrame);
4395
4544
  } else if (timeline instanceof AttachmentTimeline) {
4396
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, fromSetup, retainAttachments);
4545
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, from, retainAttachments);
4397
4546
  } else {
4398
4547
  Utils.webkit602BugfixHelper(alpha);
4399
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, fromSetup, add, false, false);
4548
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, from, add, false, false);
4400
4549
  }
4401
4550
  }
4402
4551
  }
@@ -4406,7 +4555,7 @@ var spine = (() => {
4406
4555
  current.nextAnimationLast = animationTime;
4407
4556
  current.nextTrackLast = current.trackTime;
4408
4557
  }
4409
- const setupState = this.unkeyedState + SETUP;
4558
+ const setupState = this.unkeyedState + ATTACH_SETUP;
4410
4559
  const slots = skeleton.slots;
4411
4560
  for (let i = 0, n = skeleton.slots.length; i < n; i++) {
4412
4561
  const slot = slots[i];
@@ -4444,29 +4593,29 @@ var spine = (() => {
4444
4593
  for (let i = 0; i < timelineCount; i++) {
4445
4594
  const timeline = timelines[i];
4446
4595
  const mode = timelineMode[i];
4596
+ const mixFrom = mode & MODE;
4447
4597
  let alpha = 0;
4448
4598
  if ((mode & HOLD) !== 0) {
4449
4599
  const holdMix = timelineHoldMix[i];
4450
4600
  alpha = holdMix == null ? alphaHold : alphaHold * (1 - holdMix.mix());
4451
4601
  } else {
4452
- if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
4602
+ if (!drawOrder && timeline instanceof DrawOrderTimeline && mixFrom === 0 /* current */) continue;
4453
4603
  alpha = alphaMix;
4454
4604
  }
4455
4605
  from.totalAlpha += alpha;
4456
- const fromSetup = (mode & FIRST) !== 0;
4457
4606
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4458
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, timelinesRotation, i << 1, firstFrame);
4607
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, mixFrom, timelinesRotation, i << 1, firstFrame);
4459
4608
  } else if (timeline instanceof AttachmentTimeline)
4460
4609
  this.applyAttachmentTimeline(
4461
4610
  timeline,
4462
4611
  skeleton,
4463
4612
  applyTime,
4464
- fromSetup,
4613
+ mixFrom,
4465
4614
  retainAttachments && alpha >= from.alphaAttachmentThreshold
4466
4615
  );
4467
4616
  else {
4468
- const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || !fromSetup;
4469
- timeline.apply(skeleton, animationLast, applyTime, events, alpha, fromSetup, add, out, false);
4617
+ const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || mixFrom === 0 /* current */;
4618
+ timeline.apply(skeleton, animationLast, applyTime, events, alpha, mixFrom, add, out, false);
4470
4619
  }
4471
4620
  }
4472
4621
  if (from.reverse && mix < from.eventThreshold) this.eventsReverse(from, animationLast, animationTime);
@@ -4478,10 +4627,10 @@ var spine = (() => {
4478
4627
  }
4479
4628
  /** Applies the attachment timeline and sets {@link Slot.attachmentState}.
4480
4629
  * @param retain True if the attachment remains after apply, false if temporary for deform timelines. */
4481
- applyAttachmentTimeline(timeline, skeleton, time, fromSetup, retain) {
4630
+ applyAttachmentTimeline(timeline, skeleton, time, from, retain) {
4482
4631
  const slot = skeleton.slots[timeline.slotIndex];
4483
4632
  if (!slot.bone.active) return;
4484
- if (!retain && slot.attachmentState === this.unkeyedState + RETAIN) return;
4633
+ if (!retain && slot.attachmentState === this.unkeyedState + ATTACH_RETAIN) return;
4485
4634
  let setup = time < timeline.frames[0];
4486
4635
  let name = null;
4487
4636
  if (!setup) {
@@ -4489,33 +4638,44 @@ var spine = (() => {
4489
4638
  setup = !retain && name == null;
4490
4639
  }
4491
4640
  if (setup) {
4492
- if (!fromSetup) return;
4641
+ if (from === 0 /* current */) return;
4493
4642
  name = slot.data.attachmentName;
4494
4643
  }
4495
4644
  slot.pose.setAttachment(name == null ? null : skeleton.getAttachment(slot.data.index, name));
4496
4645
  if (retain)
4497
- slot.attachmentState = this.unkeyedState + RETAIN;
4646
+ slot.attachmentState = this.unkeyedState + ATTACH_RETAIN;
4498
4647
  else if (!setup)
4499
- slot.attachmentState = this.unkeyedState + SETUP;
4648
+ slot.attachmentState = this.unkeyedState + ATTACH_SETUP;
4500
4649
  }
4501
4650
  /** Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
4502
4651
  * the first time the mixing was applied. */
4503
- applyRotateTimeline(timeline, skeleton, time, alpha, fromSetup, timelinesRotation, i, firstFrame) {
4652
+ applyRotateTimeline(timeline, skeleton, time, alpha, from, timelinesRotation, i, firstFrame) {
4504
4653
  if (firstFrame) timelinesRotation[i] = 0;
4505
4654
  if (alpha === 1) {
4506
- timeline.apply(skeleton, 0, time, null, 1, fromSetup, false, false, false);
4655
+ timeline.apply(skeleton, 0, time, null, 1, from, false, false, false);
4507
4656
  return;
4508
4657
  }
4509
4658
  const bone = skeleton.bones[timeline.boneIndex];
4510
4659
  if (!bone.active) return;
4511
4660
  const pose = bone.pose, setup = bone.data.setupPose;
4512
4661
  const frames = timeline.frames;
4662
+ let r1, r2;
4513
4663
  if (time < frames[0]) {
4514
- if (fromSetup) pose.rotation = setup.rotation;
4515
- return;
4664
+ switch (from) {
4665
+ case 1 /* setup */: {
4666
+ pose.rotation = setup.rotation;
4667
+ return;
4668
+ }
4669
+ case 0 /* current */: {
4670
+ return;
4671
+ }
4672
+ }
4673
+ r1 = pose.rotation;
4674
+ r2 = setup.rotation;
4675
+ } else {
4676
+ r1 = from === 1 /* setup */ ? setup.rotation : pose.rotation;
4677
+ r2 = setup.rotation + timeline.getCurveValue(time);
4516
4678
  }
4517
- const r1 = fromSetup ? setup.rotation : pose.rotation;
4518
- const r2 = setup.rotation + timeline.getCurveValue(time);
4519
4679
  let total = 0, diff = r2 - r1;
4520
4680
  diff -= Math.ceil(diff / 360 - 0.5) * 360;
4521
4681
  if (diff === 0) {
@@ -4830,57 +4990,72 @@ var spine = (() => {
4830
4990
  this.animationsChanged = false;
4831
4991
  const tracks = this.tracks;
4832
4992
  for (let i = 0, n = tracks.length; i < n; i++) {
4833
- let entry = tracks[i];
4834
- if (!entry) continue;
4993
+ const track = tracks[i];
4994
+ if (!track) continue;
4995
+ let entry = track;
4835
4996
  while (entry.mixingFrom)
4836
4997
  entry = entry.mixingFrom;
4837
4998
  do {
4838
- this.computeHold(entry);
4999
+ this.computeHold(entry, track);
4839
5000
  entry = entry.mixingTo;
4840
5001
  } while (entry);
4841
5002
  }
4842
5003
  this.propertyIds.clear();
4843
5004
  }
4844
- computeHold(entry) {
5005
+ computeHold(entry, track) {
4845
5006
  const timelines = entry.animation.timelines;
4846
5007
  const timelinesCount = entry.animation.timelines.length;
4847
5008
  const timelineMode = entry.timelineMode;
4848
5009
  timelineMode.length = timelinesCount;
4849
5010
  const timelineHoldMix = entry.timelineHoldMix;
4850
5011
  timelineHoldMix.length = 0;
4851
- const propertyIds = this.propertyIds;
4852
5012
  const add = entry.additive, keepHold = entry.keepHold;
4853
5013
  const to = entry.mixingTo;
4854
- outer:
4855
- for (let i = 0; i < timelinesCount; i++) {
4856
- const timeline = timelines[i];
4857
- const ids = timeline.propertyIds;
4858
- const first = propertyIds.addAll(ids) && !(timeline instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID));
4859
- if (add && timeline.additive) {
4860
- timelineMode[i] = first ? FIRST : SUBSEQUENT;
4861
- continue;
4862
- }
4863
- for (let from = entry.mixingFrom; from != null; from = from.mixingFrom) {
4864
- if (from.animation.hasTimeline(ids)) {
4865
- timelineMode[i] = SUBSEQUENT;
4866
- continue outer;
5014
+ for (let i = 0; i < timelinesCount; i++) {
5015
+ const timeline = timelines[i];
5016
+ const ids = timeline.propertyIds;
5017
+ const from = this.from(track, timeline, ids);
5018
+ if (add && timeline.additive) {
5019
+ timelineMode[i] = from;
5020
+ continue;
5021
+ }
5022
+ let mode;
5023
+ if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
5024
+ mode = from;
5025
+ else {
5026
+ mode = from | HOLD;
5027
+ for (let next = to.mixingTo; next != null; next = next.mixingTo) {
5028
+ if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
5029
+ if (next.mixDuration > 0) timelineHoldMix[i] = next;
5030
+ break;
4867
5031
  }
4868
5032
  }
4869
- let mode;
4870
- if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4871
- mode = first ? FIRST : SUBSEQUENT;
4872
- else {
4873
- mode = first ? HOLD_FIRST : HOLD;
4874
- for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4875
- if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4876
- if (next.mixDuration > 0) timelineHoldMix[i] = next;
4877
- break;
4878
- }
4879
- }
5033
+ }
5034
+ if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
5035
+ timelineMode[i] = mode;
5036
+ }
5037
+ }
5038
+ from(track, timeline, ids) {
5039
+ const propertyIds = this.propertyIds;
5040
+ let from = SETUP;
5041
+ for (let i = 0, n = ids.length; i < n; i++) {
5042
+ const owner = propertyIds.get(ids[i]);
5043
+ if (owner === void 0) {
5044
+ propertyIds.set(ids[i], track);
5045
+ } else {
5046
+ if (owner !== track) {
5047
+ while (++i < n)
5048
+ if (!propertyIds.has(ids[i])) propertyIds.set(ids[i], track);
5049
+ return CURRENT;
4880
5050
  }
4881
- if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4882
- timelineMode[i] = mode;
5051
+ from = FIRST;
4883
5052
  }
5053
+ }
5054
+ if (timeline instanceof DrawOrderFolderTimeline) {
5055
+ const first = propertyIds.get(DrawOrderTimeline.propertyID);
5056
+ if (first != null) return first !== track ? CURRENT : FIRST;
5057
+ }
5058
+ return from;
4884
5059
  }
4885
5060
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4886
5061
  getTrack(trackIndex) {
@@ -5005,7 +5180,7 @@ var spine = (() => {
5005
5180
  * properties keyed by the animation are set to the setup pose and the track is cleared.
5006
5181
  *
5007
5182
  * Usually you want to use {@link AnimationState.addEmptyAnimation} rather than have the animation
5008
- * abruptly cease being applied. */
5183
+ * abruptly cease being applied, leaving the current pose. */
5009
5184
  trackEnd = 0;
5010
5185
  /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
5011
5186
  * faster. Defaults to 1.
@@ -5089,8 +5264,8 @@ var spine = (() => {
5089
5264
  return mix;
5090
5265
  }
5091
5266
  /** For each timeline:
5092
- * - Bit 0, FIRST: 0 = mix from current pose, 1 = mix from setup pose. Timeline is first to set the property.
5093
- * - Bit 1, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5267
+ * - Bits 0-1: MixFrom.
5268
+ * - Bit 2, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5094
5269
  * set the property and the next entry (mixingTo) also sets it. When held, timelineHoldMix's mix controls how the hold fades
5095
5270
  * out (for 3+ entry chains where the chain eventually stops setting the property). */
5096
5271
  timelineMode = [];
@@ -5284,12 +5459,13 @@ var spine = (() => {
5284
5459
  event(entry, event) {
5285
5460
  }
5286
5461
  };
5287
- var SUBSEQUENT = 0;
5288
- var FIRST = 1;
5289
- var HOLD = 2;
5290
- var HOLD_FIRST = 3;
5462
+ var CURRENT = 0;
5291
5463
  var SETUP = 1;
5292
- var RETAIN = 2;
5464
+ var FIRST = 2;
5465
+ var MODE = 3;
5466
+ var HOLD = 4;
5467
+ var ATTACH_SETUP = 1;
5468
+ var ATTACH_RETAIN = 2;
5293
5469
 
5294
5470
  // spine-core/src/AnimationStateData.ts
5295
5471
  var AnimationStateData = class {
@@ -8337,7 +8513,7 @@ ${error}` : ""}`);
8337
8513
  gravityGlobal = false;
8338
8514
  /** True when this constraint's mix is controlled by global slider timelines. */
8339
8515
  mixGlobal = false;
8340
- /** Determines how the {@link BonePose.scaleY} changes when {@link PhysicsConstraintData.scaleX} sets
8516
+ /** Determines how the {@link BonePose.scaleY} changes when {@link BonePose.scaleX} sets
8341
8517
  * {@link BonePose.scaleX}. */
8342
8518
  _scaleYMode = 0 /* None */;
8343
8519
  get scaleYMode() {
@@ -8409,7 +8585,7 @@ ${error}` : ""}`);
8409
8585
  const indices = animation.bones;
8410
8586
  for (let i = 0, n = animation.bones.length; i < n; i++)
8411
8587
  bones[indices[i]].appliedPose.modifyLocal(skeleton);
8412
- animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, false, data.additive, false, true);
8588
+ animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, 0 /* current */, data.additive, false, true);
8413
8589
  }
8414
8590
  sort(skeleton) {
8415
8591
  const bone = this.bone;
@@ -8467,6 +8643,9 @@ ${error}` : ""}`);
8467
8643
  offset = 0;
8468
8644
  /** When true and a bone is set, the bone's local transform property is read instead of its world transform. */
8469
8645
  local = false;
8646
+ // Nonessential.
8647
+ /** When a bone is set, the maximum slider time for the bone property range, or 0 if nonessential data was not exported. */
8648
+ max = 0;
8470
8649
  constructor(name) {
8471
8650
  super(name, new SliderPose());
8472
8651
  }
@@ -9149,7 +9328,7 @@ ${error}` : ""}`);
9149
9328
  if (additive)
9150
9329
  value -= MathUtils.PI / 2;
9151
9330
  else {
9152
- value -= by - Math.atan2(bone.c / sx, bone.a / sy);
9331
+ value -= by - Math.atan2(bone.c / sy, bone.a / sx);
9153
9332
  if (value > MathUtils.PI)
9154
9333
  value -= MathUtils.PI2;
9155
9334
  else if (value < -MathUtils.PI)
@@ -9157,8 +9336,8 @@ ${error}` : ""}`);
9157
9336
  }
9158
9337
  value = by + value * pose.mixShearY;
9159
9338
  const s = Math.sqrt(b * b + d * d);
9160
- bone.b = Math.cos(value) * s * sy;
9161
- bone.d = Math.sin(value) * s * sx;
9339
+ bone.b = Math.cos(value) * s * sx;
9340
+ bone.d = Math.sin(value) * s * sy;
9162
9341
  }
9163
9342
  }
9164
9343
  };
@@ -9438,7 +9617,13 @@ ${error}` : ""}`);
9438
9617
  data.skinRequired = (flags & 1) !== 0;
9439
9618
  data.loop = (flags & 2) !== 0;
9440
9619
  data.additive = (flags & 4) !== 0;
9441
- if ((flags & 8) !== 0) data.setupPose.time = input.readFloat();
9620
+ if ((flags & 8) !== 0) {
9621
+ const value = input.readFloat();
9622
+ if (nonessential && (flags & 64) !== 0)
9623
+ data.max = value;
9624
+ else
9625
+ data.setupPose.time = value;
9626
+ }
9442
9627
  if ((flags & 16) !== 0) data.setupPose.mix = (flags & 32) !== 0 ? input.readFloat() : 1;
9443
9628
  if ((flags & 64) !== 0) {
9444
9629
  data.local = (flags & 128) !== 0;
@@ -11863,7 +12048,6 @@ ${error}` : ""}`);
11863
12048
  data.skinRequired = skinRequired;
11864
12049
  data.additive = getValue(constraintMap, "additive", false);
11865
12050
  data.loop = getValue(constraintMap, "loop", false);
11866
- data.setupPose.time = getValue(constraintMap, "time", 0);
11867
12051
  data.setupPose.mix = getValue(constraintMap, "mix", 1);
11868
12052
  const boneName = constraintMap.bone;
11869
12053
  if (boneName) {
@@ -11875,8 +12059,10 @@ ${error}` : ""}`);
11875
12059
  data.property.offset = getValue(constraintMap, "from", 0) * propertyScale;
11876
12060
  data.offset = getValue(constraintMap, "to", 0);
11877
12061
  data.scale = getValue(constraintMap, "scale", 1) / propertyScale;
12062
+ data.max = getValue(constraintMap, "max", 0);
11878
12063
  data.local = getValue(constraintMap, "local", false);
11879
- }
12064
+ } else
12065
+ data.setupPose.time = getValue(constraintMap, "time", 0);
11880
12066
  skeletonData.constraints.push(data);
11881
12067
  break;
11882
12068
  }
@@ -12453,7 +12639,7 @@ ${error}` : ""}`);
12453
12639
  let mixRotate = getValue(keyMap, "mixRotate", 1);
12454
12640
  let mixX = getValue(keyMap, "mixX", 1), mixY = getValue(keyMap, "mixY", mixX);
12455
12641
  let mixScaleX = getValue(keyMap, "mixScaleX", 1), mixScaleY = getValue(keyMap, "mixScaleY", 1);
12456
- const mixShearY = getValue(keyMap, "mixShearY", 1);
12642
+ let mixShearY = getValue(keyMap, "mixShearY", 1);
12457
12643
  for (let frame = 0, bezier = 0; ; frame++) {
12458
12644
  timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
12459
12645
  const nextMap = timelineMap[frame + 1];
@@ -12481,7 +12667,7 @@ ${error}` : ""}`);
12481
12667
  mixY = mixY2;
12482
12668
  mixScaleX = mixScaleX2;
12483
12669
  mixScaleY = mixScaleY2;
12484
- mixScaleX = mixScaleX2;
12670
+ mixShearY = mixShearY2;
12485
12671
  keyMap = nextMap;
12486
12672
  }
12487
12673
  timelines.push(timeline);