@esotericsoftware/spine-core 4.2.25 → 4.2.27

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.
Files changed (86) hide show
  1. package/dist/Animation.d.ts +109 -16
  2. package/dist/Animation.js +392 -322
  3. package/dist/AnimationState.d.ts +21 -12
  4. package/dist/AnimationState.js +191 -168
  5. package/dist/AnimationStateData.d.ts +3 -3
  6. package/dist/AnimationStateData.js +6 -4
  7. package/dist/AssetManagerBase.d.ts +3 -3
  8. package/dist/AssetManagerBase.js +11 -11
  9. package/dist/AtlasAttachmentLoader.d.ts +10 -10
  10. package/dist/AtlasAttachmentLoader.js +8 -7
  11. package/dist/Bone.d.ts +19 -15
  12. package/dist/Bone.js +127 -106
  13. package/dist/BoneData.d.ts +6 -2
  14. package/dist/BoneData.js +37 -31
  15. package/dist/ConstraintData.js +4 -1
  16. package/dist/Event.d.ts +1 -1
  17. package/dist/Event.js +8 -7
  18. package/dist/EventData.js +8 -7
  19. package/dist/IkConstraint.d.ts +6 -5
  20. package/dist/IkConstraint.js +39 -22
  21. package/dist/IkConstraintData.d.ts +2 -2
  22. package/dist/IkConstraintData.js +20 -20
  23. package/dist/PathConstraint.d.ts +8 -7
  24. package/dist/PathConstraint.js +39 -29
  25. package/dist/PathConstraintData.d.ts +3 -3
  26. package/dist/PathConstraintData.js +21 -21
  27. package/dist/PhysicsConstraint.d.ts +74 -0
  28. package/dist/PhysicsConstraint.js +267 -0
  29. package/dist/PhysicsConstraintData.d.ts +61 -0
  30. package/dist/PhysicsConstraintData.js +68 -0
  31. package/dist/Skeleton.d.ts +36 -12
  32. package/dist/Skeleton.js +121 -90
  33. package/dist/SkeletonBinary.d.ts +2 -2
  34. package/dist/SkeletonBinary.js +30 -19
  35. package/dist/SkeletonBounds.d.ts +3 -3
  36. package/dist/SkeletonBounds.js +18 -20
  37. package/dist/SkeletonClipping.d.ts +3 -3
  38. package/dist/SkeletonClipping.js +11 -13
  39. package/dist/SkeletonData.d.ts +14 -7
  40. package/dist/SkeletonData.js +64 -50
  41. package/dist/SkeletonJson.d.ts +5 -5
  42. package/dist/SkeletonJson.js +26 -20
  43. package/dist/Skin.d.ts +7 -5
  44. package/dist/Skin.js +13 -5
  45. package/dist/Slot.d.ts +5 -5
  46. package/dist/Slot.js +23 -16
  47. package/dist/SlotData.d.ts +4 -2
  48. package/dist/SlotData.js +20 -14
  49. package/dist/Texture.js +14 -14
  50. package/dist/TextureAtlas.d.ts +3 -3
  51. package/dist/TextureAtlas.js +30 -27
  52. package/dist/TransformConstraint.d.ts +7 -6
  53. package/dist/TransformConstraint.js +28 -13
  54. package/dist/TransformConstraintData.d.ts +2 -2
  55. package/dist/TransformConstraintData.js +26 -26
  56. package/dist/Triangulator.d.ts +1 -1
  57. package/dist/Triangulator.js +13 -15
  58. package/dist/Updatable.d.ts +9 -4
  59. package/dist/Utils.d.ts +4 -2
  60. package/dist/Utils.js +41 -35
  61. package/dist/attachments/Attachment.d.ts +2 -2
  62. package/dist/attachments/Attachment.js +20 -19
  63. package/dist/attachments/AttachmentLoader.d.ts +8 -8
  64. package/dist/attachments/BoundingBoxAttachment.d.ts +2 -2
  65. package/dist/attachments/BoundingBoxAttachment.js +4 -4
  66. package/dist/attachments/ClippingAttachment.d.ts +3 -3
  67. package/dist/attachments/ClippingAttachment.js +10 -10
  68. package/dist/attachments/HasTextureRegion.d.ts +3 -3
  69. package/dist/attachments/MeshAttachment.d.ts +6 -6
  70. package/dist/attachments/MeshAttachment.js +29 -27
  71. package/dist/attachments/PathAttachment.d.ts +2 -2
  72. package/dist/attachments/PathAttachment.js +13 -13
  73. package/dist/attachments/PointAttachment.d.ts +3 -3
  74. package/dist/attachments/PointAttachment.js +13 -13
  75. package/dist/attachments/RegionAttachment.d.ts +6 -6
  76. package/dist/attachments/RegionAttachment.js +62 -60
  77. package/dist/attachments/Sequence.d.ts +3 -3
  78. package/dist/attachments/Sequence.js +9 -8
  79. package/dist/attachments/index.d.ts +8 -8
  80. package/dist/attachments/index.js +9 -9
  81. package/dist/iife/spine-core.js +1658 -1178
  82. package/dist/iife/spine-core.js.map +4 -4
  83. package/dist/iife/spine-core.min.js +2 -2
  84. package/dist/index.d.ts +39 -39
  85. package/dist/index.js +40 -40
  86. package/package.json +3 -2
@@ -4,6 +4,7 @@ var spine = (() => {
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +18,10 @@ var spine = (() => {
17
18
  return to;
18
19
  };
19
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __publicField = (obj, key, value) => {
22
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
+ return value;
24
+ };
20
25
 
21
26
  // spine-core/src/index.ts
22
27
  var src_exports = {};
@@ -71,6 +76,16 @@ var spine = (() => {
71
76
  PathConstraintMixTimeline: () => PathConstraintMixTimeline,
72
77
  PathConstraintPositionTimeline: () => PathConstraintPositionTimeline,
73
78
  PathConstraintSpacingTimeline: () => PathConstraintSpacingTimeline,
79
+ Physics: () => Physics,
80
+ PhysicsConstraintDampingTimeline: () => PhysicsConstraintDampingTimeline,
81
+ PhysicsConstraintGravityTimeline: () => PhysicsConstraintGravityTimeline,
82
+ PhysicsConstraintInertiaTimeline: () => PhysicsConstraintInertiaTimeline,
83
+ PhysicsConstraintMassTimeline: () => PhysicsConstraintMassTimeline,
84
+ PhysicsConstraintMixTimeline: () => PhysicsConstraintMixTimeline,
85
+ PhysicsConstraintResetTimeline: () => PhysicsConstraintResetTimeline,
86
+ PhysicsConstraintStrengthTimeline: () => PhysicsConstraintStrengthTimeline,
87
+ PhysicsConstraintTimeline: () => PhysicsConstraintTimeline,
88
+ PhysicsConstraintWindTimeline: () => PhysicsConstraintWindTimeline,
74
89
  PointAttachment: () => PointAttachment,
75
90
  Pool: () => Pool,
76
91
  PositionMode: () => PositionMode,
@@ -92,7 +107,7 @@ var spine = (() => {
92
107
  ShearTimeline: () => ShearTimeline,
93
108
  ShearXTimeline: () => ShearXTimeline,
94
109
  ShearYTimeline: () => ShearYTimeline,
95
- Skeleton: () => Skeleton,
110
+ Skeleton: () => Skeleton2,
96
111
  SkeletonBinary: () => SkeletonBinary,
97
112
  SkeletonBounds: () => SkeletonBounds,
98
113
  SkeletonClipping: () => SkeletonClipping,
@@ -130,9 +145,7 @@ var spine = (() => {
130
145
 
131
146
  // spine-core/src/Utils.ts
132
147
  var IntSet = class {
133
- constructor() {
134
- this.array = new Array();
135
- }
148
+ array = new Array();
136
149
  add(value) {
137
150
  let contains = this.contains(value);
138
151
  this.array[value | 0] = value | 0;
@@ -149,10 +162,8 @@ var spine = (() => {
149
162
  }
150
163
  };
151
164
  var StringSet = class {
152
- constructor() {
153
- this.entries = {};
154
- this.size = 0;
155
- }
165
+ entries = {};
166
+ size = 0;
156
167
  add(value) {
157
168
  let contains = this.entries[value];
158
169
  this.entries[value] = true;
@@ -247,11 +258,11 @@ var spine = (() => {
247
258
  }
248
259
  };
249
260
  var Color = _Color;
250
- Color.WHITE = new _Color(1, 1, 1, 1);
251
- Color.RED = new _Color(1, 0, 0, 1);
252
- Color.GREEN = new _Color(0, 1, 0, 1);
253
- Color.BLUE = new _Color(0, 0, 1, 1);
254
- Color.MAGENTA = new _Color(1, 0, 1, 1);
261
+ __publicField(Color, "WHITE", new _Color(1, 1, 1, 1));
262
+ __publicField(Color, "RED", new _Color(1, 0, 0, 1));
263
+ __publicField(Color, "GREEN", new _Color(0, 1, 0, 1));
264
+ __publicField(Color, "BLUE", new _Color(0, 0, 1, 1));
265
+ __publicField(Color, "MAGENTA", new _Color(1, 0, 1, 1));
255
266
  var _MathUtils = class {
256
267
  static clamp(value, min, max) {
257
268
  if (value < min)
@@ -266,6 +277,9 @@ var spine = (() => {
266
277
  static sinDeg(degrees) {
267
278
  return Math.sin(degrees * _MathUtils.degRad);
268
279
  }
280
+ static atan2Deg(y, x) {
281
+ return Math.atan2(y, x) * _MathUtils.degRad;
282
+ }
269
283
  static signum(value) {
270
284
  return value > 0 ? 1 : value < 0 ? -1 : 0;
271
285
  }
@@ -291,21 +305,22 @@ var spine = (() => {
291
305
  }
292
306
  };
293
307
  var MathUtils = _MathUtils;
294
- MathUtils.PI = 3.1415927;
295
- MathUtils.PI2 = _MathUtils.PI * 2;
296
- MathUtils.radiansToDegrees = 180 / _MathUtils.PI;
297
- MathUtils.radDeg = _MathUtils.radiansToDegrees;
298
- MathUtils.degreesToRadians = _MathUtils.PI / 180;
299
- MathUtils.degRad = _MathUtils.degreesToRadians;
308
+ __publicField(MathUtils, "PI", 3.1415927);
309
+ __publicField(MathUtils, "PI2", _MathUtils.PI * 2);
310
+ __publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
311
+ __publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
312
+ __publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
313
+ __publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
314
+ __publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
300
315
  var Interpolation = class {
301
316
  apply(start, end, a) {
302
317
  return start + (end - start) * this.applyInternal(a);
303
318
  }
304
319
  };
305
320
  var Pow = class extends Interpolation {
321
+ power = 2;
306
322
  constructor(power) {
307
323
  super();
308
- this.power = 2;
309
324
  this.power = power;
310
325
  }
311
326
  applyInternal(a) {
@@ -394,7 +409,7 @@ var spine = (() => {
394
409
  }
395
410
  };
396
411
  var Utils = _Utils;
397
- Utils.SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
412
+ __publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
398
413
  var DebugUtils = class {
399
414
  static logBones(skeleton) {
400
415
  for (let i = 0; i < skeleton.bones.length; i++) {
@@ -404,8 +419,9 @@ var spine = (() => {
404
419
  }
405
420
  };
406
421
  var Pool = class {
422
+ items = new Array();
423
+ instantiator;
407
424
  constructor(instantiator) {
408
- this.items = new Array();
409
425
  this.instantiator = instantiator;
410
426
  }
411
427
  obtain() {
@@ -449,15 +465,13 @@ var spine = (() => {
449
465
  }
450
466
  };
451
467
  var TimeKeeper = class {
452
- constructor() {
453
- this.maxDelta = 0.064;
454
- this.framesPerSecond = 0;
455
- this.delta = 0;
456
- this.totalTime = 0;
457
- this.lastTime = Date.now() / 1e3;
458
- this.frameCount = 0;
459
- this.frameTime = 0;
460
- }
468
+ maxDelta = 0.064;
469
+ framesPerSecond = 0;
470
+ delta = 0;
471
+ totalTime = 0;
472
+ lastTime = Date.now() / 1e3;
473
+ frameCount = 0;
474
+ frameTime = 0;
461
475
  update() {
462
476
  let now = Date.now() / 1e3;
463
477
  this.delta = now - this.lastTime;
@@ -475,11 +489,12 @@ var spine = (() => {
475
489
  }
476
490
  };
477
491
  var WindowedMean = class {
492
+ values;
493
+ addedValues = 0;
494
+ lastValue = 0;
495
+ mean = 0;
496
+ dirty = true;
478
497
  constructor(windowSize = 32) {
479
- this.addedValues = 0;
480
- this.lastValue = 0;
481
- this.mean = 0;
482
- this.dirty = true;
483
498
  this.values = new Array(windowSize);
484
499
  }
485
500
  hasEnoughData() {
@@ -510,6 +525,7 @@ var spine = (() => {
510
525
 
511
526
  // spine-core/src/attachments/Attachment.ts
512
527
  var Attachment = class {
528
+ name;
513
529
  constructor(name) {
514
530
  if (!name)
515
531
  throw new Error("name cannot be null.");
@@ -517,24 +533,24 @@ var spine = (() => {
517
533
  }
518
534
  };
519
535
  var _VertexAttachment = class extends Attachment {
536
+ /** The unique ID for this attachment. */
537
+ id = _VertexAttachment.nextID++;
538
+ /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
539
+ * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
540
+ * if this attachment has no weights. */
541
+ bones = null;
542
+ /** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
543
+ * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
544
+ * each vertex. */
545
+ vertices = [];
546
+ /** The maximum number of world vertex values that can be output by
547
+ * {@link #computeWorldVertices()} using the `count` parameter. */
548
+ worldVerticesLength = 0;
549
+ /** Timelines for the timeline attachment are also applied to this attachment.
550
+ * May be null if no attachment-specific timelines should be applied. */
551
+ timelineAttachment = this;
520
552
  constructor(name) {
521
553
  super(name);
522
- /** The unique ID for this attachment. */
523
- this.id = _VertexAttachment.nextID++;
524
- /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
525
- * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
526
- * if this attachment has no weights. */
527
- this.bones = null;
528
- /** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
529
- * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
530
- * each vertex. */
531
- this.vertices = [];
532
- /** The maximum number of world vertex values that can be output by
533
- * {@link #computeWorldVertices()} using the `count` parameter. */
534
- this.worldVerticesLength = 0;
535
- /** Timelines for the timeline attachment are also applied to this attachment.
536
- * May be null if no attachment-specific timelines should be applied. */
537
- this.timelineAttachment = this;
538
554
  }
539
555
  /** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
540
556
  * not empty, it is used to deform the vertices.
@@ -621,16 +637,17 @@ var spine = (() => {
621
637
  }
622
638
  };
623
639
  var VertexAttachment = _VertexAttachment;
624
- VertexAttachment.nextID = 0;
640
+ __publicField(VertexAttachment, "nextID", 0);
625
641
 
626
642
  // spine-core/src/attachments/Sequence.ts
627
643
  var _Sequence = class {
644
+ id = _Sequence.nextID();
645
+ regions;
646
+ start = 0;
647
+ digits = 0;
648
+ /** The index of the region to show for the setup pose. */
649
+ setupIndex = 0;
628
650
  constructor(count) {
629
- this.id = _Sequence.nextID();
630
- this.start = 0;
631
- this.digits = 0;
632
- /** The index of the region to show for the setup pose. */
633
- this.setupIndex = 0;
634
651
  this.regions = new Array(count);
635
652
  }
636
653
  copy() {
@@ -666,7 +683,7 @@ var spine = (() => {
666
683
  }
667
684
  };
668
685
  var Sequence = _Sequence;
669
- Sequence._nextID = 0;
686
+ __publicField(Sequence, "_nextID", 0);
670
687
  var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
671
688
  SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
672
689
  SequenceMode2[SequenceMode2["once"] = 1] = "once";
@@ -689,9 +706,13 @@ var spine = (() => {
689
706
 
690
707
  // spine-core/src/Animation.ts
691
708
  var Animation = class {
709
+ /** The animation's name, which is unique across all animations in the skeleton. */
710
+ name;
711
+ timelines = [];
712
+ timelineIds = new StringSet();
713
+ /** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
714
+ duration;
692
715
  constructor(name, timelines, duration) {
693
- this.timelines = [];
694
- this.timelineIds = new StringSet();
695
716
  if (!name)
696
717
  throw new Error("name cannot be null.");
697
718
  this.name = name;
@@ -762,9 +783,19 @@ var spine = (() => {
762
783
  pathConstraintPosition: 16,
763
784
  pathConstraintSpacing: 17,
764
785
  pathConstraintMix: 18,
765
- sequence: 19
786
+ physicsConstraintInertia: 19,
787
+ physicsConstraintStrength: 20,
788
+ physicsConstraintDamping: 21,
789
+ physicsConstraintMass: 22,
790
+ physicsConstraintWind: 23,
791
+ physicsConstraintGravity: 24,
792
+ physicsConstraintMix: 25,
793
+ physicsConstraintReset: 26,
794
+ sequence: 27
766
795
  };
767
796
  var Timeline = class {
797
+ propertyIds;
798
+ frames;
768
799
  constructor(frameCount, propertyIds) {
769
800
  this.propertyIds = propertyIds;
770
801
  this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
@@ -797,6 +828,7 @@ var spine = (() => {
797
828
  }
798
829
  };
799
830
  var CurveTimeline = class extends Timeline {
831
+ curves;
800
832
  // type, x, y, ...
801
833
  constructor(frameCount, bezierCount, propertyIds) {
802
834
  super(frameCount, propertyIds);
@@ -937,6 +969,94 @@ var spine = (() => {
937
969
  /*BEZIER*/
938
970
  );
939
971
  }
972
+ getRelativeValue(time, alpha, blend, current, setup) {
973
+ if (time < this.frames[0]) {
974
+ switch (blend) {
975
+ case 0 /* setup */:
976
+ return setup;
977
+ case 1 /* first */:
978
+ return current + (setup - current) * alpha;
979
+ }
980
+ return current;
981
+ }
982
+ let value = this.getCurveValue(time);
983
+ switch (blend) {
984
+ case 0 /* setup */:
985
+ return setup + value * alpha;
986
+ case 1 /* first */:
987
+ case 2 /* replace */:
988
+ value += setup - current;
989
+ }
990
+ return current + value * alpha;
991
+ }
992
+ getAbsoluteValue(time, alpha, blend, current, setup) {
993
+ if (time < this.frames[0]) {
994
+ switch (blend) {
995
+ case 0 /* setup */:
996
+ return setup;
997
+ case 1 /* first */:
998
+ return current + (setup - current) * alpha;
999
+ }
1000
+ return current;
1001
+ }
1002
+ let value = this.getCurveValue(time);
1003
+ if (blend == 0 /* setup */)
1004
+ return setup + (value - setup) * alpha;
1005
+ return current + (value - current) * alpha;
1006
+ }
1007
+ getAbsoluteValue2(time, alpha, blend, current, setup, value) {
1008
+ if (time < this.frames[0]) {
1009
+ switch (blend) {
1010
+ case 0 /* setup */:
1011
+ return setup;
1012
+ case 1 /* first */:
1013
+ return current + (setup - current) * alpha;
1014
+ }
1015
+ return current;
1016
+ }
1017
+ if (blend == 0 /* setup */)
1018
+ return setup + (value - setup) * alpha;
1019
+ return current + (value - current) * alpha;
1020
+ }
1021
+ getScaleValue(time, alpha, blend, direction, current, setup) {
1022
+ const frames = this.frames;
1023
+ if (time < frames[0]) {
1024
+ switch (blend) {
1025
+ case 0 /* setup */:
1026
+ return setup;
1027
+ case 1 /* first */:
1028
+ return current + (setup - current) * alpha;
1029
+ }
1030
+ return current;
1031
+ }
1032
+ let value = this.getCurveValue(time) * setup;
1033
+ if (alpha == 1) {
1034
+ if (blend == 3 /* add */)
1035
+ return current + value - setup;
1036
+ return value;
1037
+ }
1038
+ if (direction == 1 /* mixOut */) {
1039
+ switch (blend) {
1040
+ case 0 /* setup */:
1041
+ return setup + (Math.abs(value) * MathUtils.signum(setup) - setup) * alpha;
1042
+ case 1 /* first */:
1043
+ case 2 /* replace */:
1044
+ return current + (Math.abs(value) * MathUtils.signum(current) - current) * alpha;
1045
+ }
1046
+ } else {
1047
+ let s = 0;
1048
+ switch (blend) {
1049
+ case 0 /* setup */:
1050
+ s = Math.abs(setup) * MathUtils.signum(value);
1051
+ return s + (value - s) * alpha;
1052
+ case 1 /* first */:
1053
+ case 2 /* replace */:
1054
+ s = Math.abs(current) * MathUtils.signum(value);
1055
+ return s + (value - s) * alpha;
1056
+ }
1057
+ }
1058
+ return current + (value - setup) * alpha;
1059
+ }
940
1060
  };
941
1061
  var CurveTimeline2 = class extends CurveTimeline {
942
1062
  /** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
@@ -964,40 +1084,19 @@ var spine = (() => {
964
1084
  }
965
1085
  };
966
1086
  var RotateTimeline = class extends CurveTimeline1 {
1087
+ boneIndex = 0;
967
1088
  constructor(frameCount, bezierCount, boneIndex) {
968
1089
  super(frameCount, bezierCount, Property.rotate + "|" + boneIndex);
969
- this.boneIndex = 0;
970
1090
  this.boneIndex = boneIndex;
971
1091
  }
972
1092
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
973
1093
  let bone = skeleton.bones[this.boneIndex];
974
- if (!bone.active)
975
- return;
976
- let frames = this.frames;
977
- if (time < frames[0]) {
978
- switch (blend) {
979
- case 0 /* setup */:
980
- bone.rotation = bone.data.rotation;
981
- return;
982
- case 1 /* first */:
983
- bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
984
- }
985
- return;
986
- }
987
- let r = this.getCurveValue(time);
988
- switch (blend) {
989
- case 0 /* setup */:
990
- bone.rotation = bone.data.rotation + r * alpha;
991
- break;
992
- case 1 /* first */:
993
- case 2 /* replace */:
994
- r += bone.data.rotation - bone.rotation;
995
- case 3 /* add */:
996
- bone.rotation += r * alpha;
997
- }
1094
+ if (bone.active)
1095
+ bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
998
1096
  }
999
1097
  };
1000
1098
  var TranslateTimeline = class extends CurveTimeline2 {
1099
+ boneIndex = 0;
1001
1100
  constructor(frameCount, bezierCount, boneIndex) {
1002
1101
  super(
1003
1102
  frameCount,
@@ -1005,7 +1104,6 @@ var spine = (() => {
1005
1104
  Property.x + "|" + boneIndex,
1006
1105
  Property.y + "|" + boneIndex
1007
1106
  );
1008
- this.boneIndex = 0;
1009
1107
  this.boneIndex = boneIndex;
1010
1108
  }
1011
1109
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1103,76 +1201,31 @@ var spine = (() => {
1103
1201
  }
1104
1202
  };
1105
1203
  var TranslateXTimeline = class extends CurveTimeline1 {
1204
+ boneIndex = 0;
1106
1205
  constructor(frameCount, bezierCount, boneIndex) {
1107
1206
  super(frameCount, bezierCount, Property.x + "|" + boneIndex);
1108
- this.boneIndex = 0;
1109
1207
  this.boneIndex = boneIndex;
1110
1208
  }
1111
1209
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1112
1210
  let bone = skeleton.bones[this.boneIndex];
1113
- if (!bone.active)
1114
- return;
1115
- let frames = this.frames;
1116
- if (time < frames[0]) {
1117
- switch (blend) {
1118
- case 0 /* setup */:
1119
- bone.x = bone.data.x;
1120
- return;
1121
- case 1 /* first */:
1122
- bone.x += (bone.data.x - bone.x) * alpha;
1123
- }
1124
- return;
1125
- }
1126
- let x = this.getCurveValue(time);
1127
- switch (blend) {
1128
- case 0 /* setup */:
1129
- bone.x = bone.data.x + x * alpha;
1130
- break;
1131
- case 1 /* first */:
1132
- case 2 /* replace */:
1133
- bone.x += (bone.data.x + x - bone.x) * alpha;
1134
- break;
1135
- case 3 /* add */:
1136
- bone.x += x * alpha;
1137
- }
1211
+ if (bone.active)
1212
+ bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1138
1213
  }
1139
1214
  };
1140
1215
  var TranslateYTimeline = class extends CurveTimeline1 {
1216
+ boneIndex = 0;
1141
1217
  constructor(frameCount, bezierCount, boneIndex) {
1142
1218
  super(frameCount, bezierCount, Property.y + "|" + boneIndex);
1143
- this.boneIndex = 0;
1144
1219
  this.boneIndex = boneIndex;
1145
1220
  }
1146
1221
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1147
1222
  let bone = skeleton.bones[this.boneIndex];
1148
- if (!bone.active)
1149
- return;
1150
- let frames = this.frames;
1151
- if (time < frames[0]) {
1152
- switch (blend) {
1153
- case 0 /* setup */:
1154
- bone.y = bone.data.y;
1155
- return;
1156
- case 1 /* first */:
1157
- bone.y += (bone.data.y - bone.y) * alpha;
1158
- }
1159
- return;
1160
- }
1161
- let y = this.getCurveValue(time);
1162
- switch (blend) {
1163
- case 0 /* setup */:
1164
- bone.y = bone.data.y + y * alpha;
1165
- break;
1166
- case 1 /* first */:
1167
- case 2 /* replace */:
1168
- bone.y += (bone.data.y + y - bone.y) * alpha;
1169
- break;
1170
- case 3 /* add */:
1171
- bone.y += y * alpha;
1172
- }
1223
+ if (bone.active)
1224
+ bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1173
1225
  }
1174
1226
  };
1175
1227
  var ScaleTimeline = class extends CurveTimeline2 {
1228
+ boneIndex = 0;
1176
1229
  constructor(frameCount, bezierCount, boneIndex) {
1177
1230
  super(
1178
1231
  frameCount,
@@ -1180,7 +1233,6 @@ var spine = (() => {
1180
1233
  Property.scaleX + "|" + boneIndex,
1181
1234
  Property.scaleY + "|" + boneIndex
1182
1235
  );
1183
- this.boneIndex = 0;
1184
1236
  this.boneIndex = boneIndex;
1185
1237
  }
1186
1238
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1316,128 +1368,31 @@ var spine = (() => {
1316
1368
  }
1317
1369
  };
1318
1370
  var ScaleXTimeline = class extends CurveTimeline1 {
1371
+ boneIndex = 0;
1319
1372
  constructor(frameCount, bezierCount, boneIndex) {
1320
1373
  super(frameCount, bezierCount, Property.scaleX + "|" + boneIndex);
1321
- this.boneIndex = 0;
1322
1374
  this.boneIndex = boneIndex;
1323
1375
  }
1324
1376
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1325
1377
  let bone = skeleton.bones[this.boneIndex];
1326
- if (!bone.active)
1327
- return;
1328
- let frames = this.frames;
1329
- if (time < frames[0]) {
1330
- switch (blend) {
1331
- case 0 /* setup */:
1332
- bone.scaleX = bone.data.scaleX;
1333
- return;
1334
- case 1 /* first */:
1335
- bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
1336
- }
1337
- return;
1338
- }
1339
- let x = this.getCurveValue(time) * bone.data.scaleX;
1340
- if (alpha == 1) {
1341
- if (blend == 3 /* add */)
1342
- bone.scaleX += x - bone.data.scaleX;
1343
- else
1344
- bone.scaleX = x;
1345
- } else {
1346
- let bx = 0;
1347
- if (direction == 1 /* mixOut */) {
1348
- switch (blend) {
1349
- case 0 /* setup */:
1350
- bx = bone.data.scaleX;
1351
- bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1352
- break;
1353
- case 1 /* first */:
1354
- case 2 /* replace */:
1355
- bx = bone.scaleX;
1356
- bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1357
- break;
1358
- case 3 /* add */:
1359
- bone.scaleX += (x - bone.data.scaleX) * alpha;
1360
- }
1361
- } else {
1362
- switch (blend) {
1363
- case 0 /* setup */:
1364
- bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
1365
- bone.scaleX = bx + (x - bx) * alpha;
1366
- break;
1367
- case 1 /* first */:
1368
- case 2 /* replace */:
1369
- bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
1370
- bone.scaleX = bx + (x - bx) * alpha;
1371
- break;
1372
- case 3 /* add */:
1373
- bone.scaleX += (x - bone.data.scaleX) * alpha;
1374
- }
1375
- }
1376
- }
1378
+ if (bone.active)
1379
+ bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1377
1380
  }
1378
1381
  };
1379
1382
  var ScaleYTimeline = class extends CurveTimeline1 {
1383
+ boneIndex = 0;
1380
1384
  constructor(frameCount, bezierCount, boneIndex) {
1381
1385
  super(frameCount, bezierCount, Property.scaleY + "|" + boneIndex);
1382
- this.boneIndex = 0;
1383
1386
  this.boneIndex = boneIndex;
1384
1387
  }
1385
1388
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1386
1389
  let bone = skeleton.bones[this.boneIndex];
1387
- if (!bone.active)
1388
- return;
1389
- let frames = this.frames;
1390
- if (time < frames[0]) {
1391
- switch (blend) {
1392
- case 0 /* setup */:
1393
- bone.scaleY = bone.data.scaleY;
1394
- return;
1395
- case 1 /* first */:
1396
- bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
1397
- }
1398
- return;
1399
- }
1400
- let y = this.getCurveValue(time) * bone.data.scaleY;
1401
- if (alpha == 1) {
1402
- if (blend == 3 /* add */)
1403
- bone.scaleY += y - bone.data.scaleY;
1404
- else
1405
- bone.scaleY = y;
1406
- } else {
1407
- let by = 0;
1408
- if (direction == 1 /* mixOut */) {
1409
- switch (blend) {
1410
- case 0 /* setup */:
1411
- by = bone.data.scaleY;
1412
- bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1413
- break;
1414
- case 1 /* first */:
1415
- case 2 /* replace */:
1416
- by = bone.scaleY;
1417
- bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1418
- break;
1419
- case 3 /* add */:
1420
- bone.scaleY += (y - bone.data.scaleY) * alpha;
1421
- }
1422
- } else {
1423
- switch (blend) {
1424
- case 0 /* setup */:
1425
- by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
1426
- bone.scaleY = by + (y - by) * alpha;
1427
- break;
1428
- case 1 /* first */:
1429
- case 2 /* replace */:
1430
- by = Math.abs(bone.scaleY) * MathUtils.signum(y);
1431
- bone.scaleY = by + (y - by) * alpha;
1432
- break;
1433
- case 3 /* add */:
1434
- bone.scaleY += (y - bone.data.scaleY) * alpha;
1435
- }
1436
- }
1437
- }
1390
+ if (bone.active)
1391
+ bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleY);
1438
1392
  }
1439
1393
  };
1440
1394
  var ShearTimeline = class extends CurveTimeline2 {
1395
+ boneIndex = 0;
1441
1396
  constructor(frameCount, bezierCount, boneIndex) {
1442
1397
  super(
1443
1398
  frameCount,
@@ -1445,7 +1400,6 @@ var spine = (() => {
1445
1400
  Property.shearX + "|" + boneIndex,
1446
1401
  Property.shearY + "|" + boneIndex
1447
1402
  );
1448
- this.boneIndex = 0;
1449
1403
  this.boneIndex = boneIndex;
1450
1404
  }
1451
1405
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1543,82 +1497,36 @@ var spine = (() => {
1543
1497
  }
1544
1498
  };
1545
1499
  var ShearXTimeline = class extends CurveTimeline1 {
1500
+ boneIndex = 0;
1546
1501
  constructor(frameCount, bezierCount, boneIndex) {
1547
1502
  super(frameCount, bezierCount, Property.shearX + "|" + boneIndex);
1548
- this.boneIndex = 0;
1549
1503
  this.boneIndex = boneIndex;
1550
1504
  }
1551
1505
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1552
1506
  let bone = skeleton.bones[this.boneIndex];
1553
- if (!bone.active)
1554
- return;
1555
- let frames = this.frames;
1556
- if (time < frames[0]) {
1557
- switch (blend) {
1558
- case 0 /* setup */:
1559
- bone.shearX = bone.data.shearX;
1560
- return;
1561
- case 1 /* first */:
1562
- bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
1563
- }
1564
- return;
1565
- }
1566
- let x = this.getCurveValue(time);
1567
- switch (blend) {
1568
- case 0 /* setup */:
1569
- bone.shearX = bone.data.shearX + x * alpha;
1570
- break;
1571
- case 1 /* first */:
1572
- case 2 /* replace */:
1573
- bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
1574
- break;
1575
- case 3 /* add */:
1576
- bone.shearX += x * alpha;
1577
- }
1507
+ if (bone.active)
1508
+ bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1578
1509
  }
1579
1510
  };
1580
1511
  var ShearYTimeline = class extends CurveTimeline1 {
1512
+ boneIndex = 0;
1581
1513
  constructor(frameCount, bezierCount, boneIndex) {
1582
1514
  super(frameCount, bezierCount, Property.shearY + "|" + boneIndex);
1583
- this.boneIndex = 0;
1584
1515
  this.boneIndex = boneIndex;
1585
1516
  }
1586
1517
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1587
1518
  let bone = skeleton.bones[this.boneIndex];
1588
- if (!bone.active)
1589
- return;
1590
- let frames = this.frames;
1591
- if (time < frames[0]) {
1592
- switch (blend) {
1593
- case 0 /* setup */:
1594
- bone.shearY = bone.data.shearY;
1595
- return;
1596
- case 1 /* first */:
1597
- bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
1598
- }
1599
- return;
1600
- }
1601
- let y = this.getCurveValue(time);
1602
- switch (blend) {
1603
- case 0 /* setup */:
1604
- bone.shearY = bone.data.shearY + y * alpha;
1605
- break;
1606
- case 1 /* first */:
1607
- case 2 /* replace */:
1608
- bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
1609
- break;
1610
- case 3 /* add */:
1611
- bone.shearY += y * alpha;
1612
- }
1519
+ if (bone.active)
1520
+ bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearY);
1613
1521
  }
1614
1522
  };
1615
1523
  var RGBATimeline = class extends CurveTimeline {
1524
+ slotIndex = 0;
1616
1525
  constructor(frameCount, bezierCount, slotIndex) {
1617
1526
  super(frameCount, bezierCount, [
1618
1527
  Property.rgb + "|" + slotIndex,
1619
1528
  Property.alpha + "|" + slotIndex
1620
1529
  ]);
1621
- this.slotIndex = 0;
1622
1530
  this.slotIndex = slotIndex;
1623
1531
  }
1624
1532
  getFrameEntries() {
@@ -1776,11 +1684,11 @@ var spine = (() => {
1776
1684
  }
1777
1685
  };
1778
1686
  var RGBTimeline = class extends CurveTimeline {
1687
+ slotIndex = 0;
1779
1688
  constructor(frameCount, bezierCount, slotIndex) {
1780
1689
  super(frameCount, bezierCount, [
1781
1690
  Property.rgb + "|" + slotIndex
1782
1691
  ]);
1783
- this.slotIndex = 0;
1784
1692
  this.slotIndex = slotIndex;
1785
1693
  }
1786
1694
  getFrameEntries() {
@@ -1919,9 +1827,9 @@ var spine = (() => {
1919
1827
  }
1920
1828
  };
1921
1829
  var AlphaTimeline = class extends CurveTimeline1 {
1830
+ slotIndex = 0;
1922
1831
  constructor(frameCount, bezierCount, slotIndex) {
1923
1832
  super(frameCount, bezierCount, Property.alpha + "|" + slotIndex);
1924
- this.slotIndex = 0;
1925
1833
  this.slotIndex = slotIndex;
1926
1834
  }
1927
1835
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1951,13 +1859,13 @@ var spine = (() => {
1951
1859
  }
1952
1860
  };
1953
1861
  var RGBA2Timeline = class extends CurveTimeline {
1862
+ slotIndex = 0;
1954
1863
  constructor(frameCount, bezierCount, slotIndex) {
1955
1864
  super(frameCount, bezierCount, [
1956
1865
  Property.rgb + "|" + slotIndex,
1957
1866
  Property.alpha + "|" + slotIndex,
1958
1867
  Property.rgb2 + "|" + slotIndex
1959
1868
  ]);
1960
- this.slotIndex = 0;
1961
1869
  this.slotIndex = slotIndex;
1962
1870
  }
1963
1871
  getFrameEntries() {
@@ -2198,12 +2106,12 @@ var spine = (() => {
2198
2106
  }
2199
2107
  };
2200
2108
  var RGB2Timeline = class extends CurveTimeline {
2109
+ slotIndex = 0;
2201
2110
  constructor(frameCount, bezierCount, slotIndex) {
2202
2111
  super(frameCount, bezierCount, [
2203
2112
  Property.rgb + "|" + slotIndex,
2204
2113
  Property.rgb2 + "|" + slotIndex
2205
2114
  ]);
2206
- this.slotIndex = 0;
2207
2115
  this.slotIndex = slotIndex;
2208
2116
  }
2209
2117
  getFrameEntries() {
@@ -2429,11 +2337,13 @@ var spine = (() => {
2429
2337
  }
2430
2338
  };
2431
2339
  var AttachmentTimeline = class extends Timeline {
2340
+ slotIndex = 0;
2341
+ /** The attachment name for each key frame. May contain null values to clear the attachment. */
2342
+ attachmentNames;
2432
2343
  constructor(frameCount, slotIndex) {
2433
2344
  super(frameCount, [
2434
2345
  Property.attachment + "|" + slotIndex
2435
2346
  ]);
2436
- this.slotIndex = 0;
2437
2347
  this.slotIndex = slotIndex;
2438
2348
  this.attachmentNames = new Array(frameCount);
2439
2349
  }
@@ -2466,11 +2376,15 @@ var spine = (() => {
2466
2376
  }
2467
2377
  };
2468
2378
  var DeformTimeline = class extends CurveTimeline {
2379
+ slotIndex = 0;
2380
+ /** The attachment that will be deformed. */
2381
+ attachment;
2382
+ /** The vertices for each key frame. */
2383
+ vertices;
2469
2384
  constructor(frameCount, bezierCount, slotIndex, attachment) {
2470
2385
  super(frameCount, bezierCount, [
2471
2386
  Property.deform + "|" + slotIndex + "|" + attachment.id
2472
2387
  ]);
2473
- this.slotIndex = 0;
2474
2388
  this.slotIndex = slotIndex;
2475
2389
  this.attachment = attachment;
2476
2390
  this.vertices = new Array(frameCount);
@@ -2691,6 +2605,8 @@ var spine = (() => {
2691
2605
  }
2692
2606
  };
2693
2607
  var _EventTimeline = class extends Timeline {
2608
+ /** The event for each key frame. */
2609
+ events;
2694
2610
  constructor(frameCount) {
2695
2611
  super(frameCount, _EventTimeline.propertyIds);
2696
2612
  this.events = new Array(frameCount);
@@ -2733,8 +2649,10 @@ var spine = (() => {
2733
2649
  }
2734
2650
  };
2735
2651
  var EventTimeline = _EventTimeline;
2736
- EventTimeline.propertyIds = ["" + Property.event];
2652
+ __publicField(EventTimeline, "propertyIds", ["" + Property.event]);
2737
2653
  var _DrawOrderTimeline = class extends Timeline {
2654
+ /** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
2655
+ drawOrders;
2738
2656
  constructor(frameCount) {
2739
2657
  super(frameCount, _DrawOrderTimeline.propertyIds);
2740
2658
  this.drawOrders = new Array(frameCount);
@@ -2773,15 +2691,15 @@ var spine = (() => {
2773
2691
  }
2774
2692
  };
2775
2693
  var DrawOrderTimeline = _DrawOrderTimeline;
2776
- DrawOrderTimeline.propertyIds = ["" + Property.drawOrder];
2694
+ __publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
2777
2695
  var IkConstraintTimeline = class extends CurveTimeline {
2696
+ /** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is */
2697
+ constraintIndex = 0;
2778
2698
  constructor(frameCount, bezierCount, ikConstraintIndex) {
2779
2699
  super(frameCount, bezierCount, [
2780
2700
  Property.ikConstraint + "|" + ikConstraintIndex
2781
2701
  ]);
2782
- /** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
2783
- this.ikConstraintIndex = 0;
2784
- this.ikConstraintIndex = ikConstraintIndex;
2702
+ this.constraintIndex = ikConstraintIndex;
2785
2703
  }
2786
2704
  getFrameEntries() {
2787
2705
  return 6;
@@ -2812,7 +2730,7 @@ var spine = (() => {
2812
2730
  ] = stretch ? 1 : 0;
2813
2731
  }
2814
2732
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2815
- let constraint = skeleton.ikConstraints[this.ikConstraintIndex];
2733
+ let constraint = skeleton.ikConstraints[this.constraintIndex];
2816
2734
  if (!constraint.active)
2817
2735
  return;
2818
2736
  let frames = this.frames;
@@ -2937,13 +2855,13 @@ var spine = (() => {
2937
2855
  }
2938
2856
  };
2939
2857
  var TransformConstraintTimeline = class extends CurveTimeline {
2858
+ /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
2859
+ constraintIndex = 0;
2940
2860
  constructor(frameCount, bezierCount, transformConstraintIndex) {
2941
2861
  super(frameCount, bezierCount, [
2942
2862
  Property.transformConstraint + "|" + transformConstraintIndex
2943
2863
  ]);
2944
- /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
2945
- this.transformConstraintIndex = 0;
2946
- this.transformConstraintIndex = transformConstraintIndex;
2864
+ this.constraintIndex = transformConstraintIndex;
2947
2865
  }
2948
2866
  getFrameEntries() {
2949
2867
  return 7;
@@ -2979,7 +2897,7 @@ var spine = (() => {
2979
2897
  ] = mixShearY;
2980
2898
  }
2981
2899
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2982
- let constraint = skeleton.transformConstraints[this.transformConstraintIndex];
2900
+ let constraint = skeleton.transformConstraints[this.constraintIndex];
2983
2901
  if (!constraint.active)
2984
2902
  return;
2985
2903
  let frames = this.frames;
@@ -3160,71 +3078,42 @@ var spine = (() => {
3160
3078
  }
3161
3079
  };
3162
3080
  var PathConstraintPositionTimeline = class extends CurveTimeline1 {
3081
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3082
+ * applied. */
3083
+ constraintIndex = 0;
3163
3084
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3164
3085
  super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
3165
- /** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
3166
- this.pathConstraintIndex = 0;
3167
- this.pathConstraintIndex = pathConstraintIndex;
3086
+ this.constraintIndex = pathConstraintIndex;
3168
3087
  }
3169
3088
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3170
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3171
- if (!constraint.active)
3172
- return;
3173
- let frames = this.frames;
3174
- if (time < frames[0]) {
3175
- switch (blend) {
3176
- case 0 /* setup */:
3177
- constraint.position = constraint.data.position;
3178
- return;
3179
- case 1 /* first */:
3180
- constraint.position += (constraint.data.position - constraint.position) * alpha;
3181
- }
3182
- return;
3183
- }
3184
- let position = this.getCurveValue(time);
3185
- if (blend == 0 /* setup */)
3186
- constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
3187
- else
3188
- constraint.position += (position - constraint.position) * alpha;
3089
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3090
+ if (constraint.active)
3091
+ constraint.position = this.getAbsoluteValue(time, alpha, blend, constraint.position, constraint.data.position);
3189
3092
  }
3190
3093
  };
3191
3094
  var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
3095
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3096
+ * applied. */
3097
+ constraintIndex = 0;
3192
3098
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3193
3099
  super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
3194
- /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
3195
- this.pathConstraintIndex = 0;
3196
- this.pathConstraintIndex = pathConstraintIndex;
3100
+ this.constraintIndex = pathConstraintIndex;
3197
3101
  }
3198
3102
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3199
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3200
- if (!constraint.active)
3201
- return;
3202
- let frames = this.frames;
3203
- if (time < frames[0]) {
3204
- switch (blend) {
3205
- case 0 /* setup */:
3206
- constraint.spacing = constraint.data.spacing;
3207
- return;
3208
- case 1 /* first */:
3209
- constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
3210
- }
3211
- return;
3212
- }
3213
- let spacing = this.getCurveValue(time);
3214
- if (blend == 0 /* setup */)
3215
- constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
3216
- else
3217
- constraint.spacing += (spacing - constraint.spacing) * alpha;
3103
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3104
+ if (constraint.active)
3105
+ constraint.spacing = this.getAbsoluteValue(time, alpha, blend, constraint.spacing, constraint.data.spacing);
3218
3106
  }
3219
3107
  };
3220
3108
  var PathConstraintMixTimeline = class extends CurveTimeline {
3109
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3110
+ * applied. */
3111
+ constraintIndex = 0;
3221
3112
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3222
3113
  super(frameCount, bezierCount, [
3223
3114
  Property.pathConstraintMix + "|" + pathConstraintIndex
3224
3115
  ]);
3225
- /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
3226
- this.pathConstraintIndex = 0;
3227
- this.pathConstraintIndex = pathConstraintIndex;
3116
+ this.constraintIndex = pathConstraintIndex;
3228
3117
  }
3229
3118
  getFrameEntries() {
3230
3119
  return 4;
@@ -3247,7 +3136,7 @@ var spine = (() => {
3247
3136
  ] = mixY;
3248
3137
  }
3249
3138
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3250
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3139
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3251
3140
  if (!constraint.active)
3252
3141
  return;
3253
3142
  let frames = this.frames;
@@ -3354,7 +3243,199 @@ var spine = (() => {
3354
3243
  }
3355
3244
  }
3356
3245
  };
3246
+ var PhysicsConstraintTimeline = class extends CurveTimeline1 {
3247
+ /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
3248
+ * is applied, or -1 if all physics constraints in the skeleton will be changed. */
3249
+ constraintIndex = 0;
3250
+ /** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
3251
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3252
+ super(frameCount, bezierCount, property + "|" + physicsConstraintIndex);
3253
+ this.constraintIndex = physicsConstraintIndex;
3254
+ }
3255
+ apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3256
+ let constraint;
3257
+ if (this.constraintIndex == -1) {
3258
+ const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
3259
+ for (const constraint2 of skeleton.physicsConstraints) {
3260
+ if (constraint2.active && this.global(constraint2.data))
3261
+ this.set(constraint2, this.getAbsoluteValue2(time, alpha, blend, this.get(constraint2), this.setup(constraint2), value));
3262
+ }
3263
+ } else {
3264
+ constraint = skeleton.physicsConstraints[this.constraintIndex];
3265
+ if (constraint.active)
3266
+ this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3267
+ }
3268
+ }
3269
+ };
3270
+ var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
3271
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3272
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);
3273
+ }
3274
+ setup(constraint) {
3275
+ return constraint.data.inertia;
3276
+ }
3277
+ get(constraint) {
3278
+ return constraint.inertia;
3279
+ }
3280
+ set(constraint, value) {
3281
+ constraint.inertia = value;
3282
+ }
3283
+ global(constraint) {
3284
+ return constraint.inertiaGlobal;
3285
+ }
3286
+ };
3287
+ var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
3288
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3289
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);
3290
+ }
3291
+ setup(constraint) {
3292
+ return constraint.data.strength;
3293
+ }
3294
+ get(constraint) {
3295
+ return constraint.strength;
3296
+ }
3297
+ set(constraint, value) {
3298
+ constraint.strength = value;
3299
+ }
3300
+ global(constraint) {
3301
+ return constraint.strengthGlobal;
3302
+ }
3303
+ };
3304
+ var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
3305
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3306
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);
3307
+ }
3308
+ setup(constraint) {
3309
+ return constraint.data.damping;
3310
+ }
3311
+ get(constraint) {
3312
+ return constraint.damping;
3313
+ }
3314
+ set(constraint, value) {
3315
+ constraint.damping = value;
3316
+ }
3317
+ global(constraint) {
3318
+ return constraint.dampingGlobal;
3319
+ }
3320
+ };
3321
+ var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
3322
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3323
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);
3324
+ }
3325
+ setup(constraint) {
3326
+ return 1 / constraint.data.massInverse;
3327
+ }
3328
+ get(constraint) {
3329
+ return 1 / constraint.massInverse;
3330
+ }
3331
+ set(constraint, value) {
3332
+ constraint.massInverse = 1 / value;
3333
+ }
3334
+ global(constraint) {
3335
+ return constraint.massGlobal;
3336
+ }
3337
+ };
3338
+ var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
3339
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3340
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);
3341
+ }
3342
+ setup(constraint) {
3343
+ return constraint.data.wind;
3344
+ }
3345
+ get(constraint) {
3346
+ return constraint.wind;
3347
+ }
3348
+ set(constraint, value) {
3349
+ constraint.wind = value;
3350
+ }
3351
+ global(constraint) {
3352
+ return constraint.windGlobal;
3353
+ }
3354
+ };
3355
+ var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
3356
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3357
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
3358
+ }
3359
+ setup(constraint) {
3360
+ return constraint.data.gravity;
3361
+ }
3362
+ get(constraint) {
3363
+ return constraint.gravity;
3364
+ }
3365
+ set(constraint, value) {
3366
+ constraint.gravity = value;
3367
+ }
3368
+ global(constraint) {
3369
+ return constraint.gravityGlobal;
3370
+ }
3371
+ };
3372
+ var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
3373
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3374
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
3375
+ }
3376
+ setup(constraint) {
3377
+ return constraint.data.mix;
3378
+ }
3379
+ get(constraint) {
3380
+ return constraint.mix;
3381
+ }
3382
+ set(constraint, value) {
3383
+ constraint.mix = value;
3384
+ }
3385
+ global(constraint) {
3386
+ return constraint.mixGlobal;
3387
+ }
3388
+ };
3389
+ var _PhysicsConstraintResetTimeline = class extends Timeline {
3390
+ /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
3391
+ * applied, or -1 if all physics constraints in the skeleton will be reset. */
3392
+ constraintIndex;
3393
+ /** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
3394
+ constructor(frameCount, physicsConstraintIndex) {
3395
+ super(frameCount, _PhysicsConstraintResetTimeline.propertyIds);
3396
+ this.constraintIndex = physicsConstraintIndex;
3397
+ }
3398
+ getFrameCount() {
3399
+ return this.frames.length;
3400
+ }
3401
+ /** Sets the time for the specified frame.
3402
+ * @param frame Between 0 and <code>frameCount</code>, inclusive. */
3403
+ setFrame(frame, time) {
3404
+ this.frames[frame] = time;
3405
+ }
3406
+ /** Resets the physics constraint when frames > <code>lastTime</code> and <= <code>time</code>. */
3407
+ apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3408
+ let constraint;
3409
+ if (this.constraintIndex != -1) {
3410
+ constraint = skeleton.physicsConstraints[this.constraintIndex];
3411
+ if (!constraint.active)
3412
+ return;
3413
+ }
3414
+ const frames = this.frames;
3415
+ if (lastTime > time) {
3416
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, blend, direction);
3417
+ lastTime = -1;
3418
+ } else if (lastTime >= frames[frames.length - 1])
3419
+ return;
3420
+ if (time < frames[0])
3421
+ return;
3422
+ if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
3423
+ if (constraint != null)
3424
+ constraint.reset();
3425
+ else {
3426
+ for (const constraint2 of skeleton.physicsConstraints) {
3427
+ if (constraint2.active)
3428
+ constraint2.reset();
3429
+ }
3430
+ }
3431
+ }
3432
+ }
3433
+ };
3434
+ var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
3435
+ __publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
3357
3436
  var _SequenceTimeline = class extends Timeline {
3437
+ slotIndex;
3438
+ attachment;
3358
3439
  constructor(frameCount, slotIndex, attachment) {
3359
3440
  super(frameCount, [
3360
3441
  Property.sequence + "|" + slotIndex + "|" + attachment.sequence.id
@@ -3439,32 +3520,34 @@ var spine = (() => {
3439
3520
  }
3440
3521
  };
3441
3522
  var SequenceTimeline = _SequenceTimeline;
3442
- SequenceTimeline.ENTRIES = 3;
3443
- SequenceTimeline.MODE = 1;
3444
- SequenceTimeline.DELAY = 2;
3523
+ __publicField(SequenceTimeline, "ENTRIES", 3);
3524
+ __publicField(SequenceTimeline, "MODE", 1);
3525
+ __publicField(SequenceTimeline, "DELAY", 2);
3445
3526
 
3446
3527
  // spine-core/src/AnimationState.ts
3447
3528
  var _AnimationState = class {
3529
+ static emptyAnimation() {
3530
+ return _AnimationState._emptyAnimation;
3531
+ }
3532
+ /** The AnimationStateData to look up mix durations. */
3533
+ data;
3534
+ /** The list of tracks that currently have animations, which may contain null entries. */
3535
+ tracks = new Array();
3536
+ /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
3537
+ * or faster. Defaults to 1.
3538
+ *
3539
+ * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
3540
+ timeScale = 1;
3541
+ unkeyedState = 0;
3542
+ events = new Array();
3543
+ listeners = new Array();
3544
+ queue = new EventQueue(this);
3545
+ propertyIDs = new StringSet();
3546
+ animationsChanged = false;
3547
+ trackEntryPool = new Pool(() => new TrackEntry());
3448
3548
  constructor(data) {
3449
- /** The list of tracks that currently have animations, which may contain null entries. */
3450
- this.tracks = new Array();
3451
- /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
3452
- * or faster. Defaults to 1.
3453
- *
3454
- * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
3455
- this.timeScale = 1;
3456
- this.unkeyedState = 0;
3457
- this.events = new Array();
3458
- this.listeners = new Array();
3459
- this.queue = new EventQueue(this);
3460
- this.propertyIDs = new StringSet();
3461
- this.animationsChanged = false;
3462
- this.trackEntryPool = new Pool(() => new TrackEntry());
3463
3549
  this.data = data;
3464
3550
  }
3465
- static emptyAnimation() {
3466
- return _AnimationState._emptyAnimation;
3467
- }
3468
3551
  /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
3469
3552
  update(delta) {
3470
3553
  delta *= this.timeScale;
@@ -3556,11 +3639,12 @@ var spine = (() => {
3556
3639
  continue;
3557
3640
  applied = true;
3558
3641
  let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
3559
- let mix = current.alpha;
3642
+ let alpha = current.alpha;
3560
3643
  if (current.mixingFrom)
3561
- mix *= this.applyMixingFrom(current, skeleton, blend);
3644
+ alpha *= this.applyMixingFrom(current, skeleton, blend);
3562
3645
  else if (current.trackTime >= current.trackEnd && !current.next)
3563
- mix = 0;
3646
+ alpha = 0;
3647
+ let attachments = alpha >= current.alphaAttachmentThreshold;
3564
3648
  let animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
3565
3649
  let applyEvents = events;
3566
3650
  if (current.reverse) {
@@ -3569,14 +3653,16 @@ var spine = (() => {
3569
3653
  }
3570
3654
  let timelines = current.animation.timelines;
3571
3655
  let timelineCount = timelines.length;
3572
- if (i2 == 0 && mix == 1 || blend == 3 /* add */) {
3656
+ if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
3657
+ if (i2 == 0)
3658
+ attachments = true;
3573
3659
  for (let ii = 0; ii < timelineCount; ii++) {
3574
- Utils.webkit602BugfixHelper(mix, blend);
3660
+ Utils.webkit602BugfixHelper(alpha, blend);
3575
3661
  var timeline = timelines[ii];
3576
3662
  if (timeline instanceof AttachmentTimeline)
3577
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
3663
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, attachments);
3578
3664
  else
3579
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, 0 /* mixIn */);
3665
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, 0 /* mixIn */);
3580
3666
  }
3581
3667
  } else {
3582
3668
  let timelineMode = current.timelineMode;
@@ -3588,12 +3674,12 @@ var spine = (() => {
3588
3674
  let timeline2 = timelines[ii];
3589
3675
  let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
3590
3676
  if (!shortestRotation && timeline2 instanceof RotateTimeline) {
3591
- this.applyRotateTimeline(timeline2, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
3677
+ this.applyRotateTimeline(timeline2, skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
3592
3678
  } else if (timeline2 instanceof AttachmentTimeline) {
3593
- this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, true);
3679
+ this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, attachments);
3594
3680
  } else {
3595
- Utils.webkit602BugfixHelper(mix, blend);
3596
- timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, 0 /* mixIn */);
3681
+ Utils.webkit602BugfixHelper(alpha, blend);
3682
+ timeline2.apply(skeleton, animationLast, applyTime, applyEvents, alpha, timelineBlend, 0 /* mixIn */);
3597
3683
  }
3598
3684
  }
3599
3685
  }
@@ -3631,7 +3717,7 @@ var spine = (() => {
3631
3717
  if (blend != 1 /* first */)
3632
3718
  blend = from.mixBlend;
3633
3719
  }
3634
- let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
3720
+ let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
3635
3721
  let timelines = from.animation.timelines;
3636
3722
  let timelineCount = timelines.length;
3637
3723
  let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
@@ -3686,7 +3772,7 @@ var spine = (() => {
3686
3772
  if (!shortestRotation && timeline instanceof RotateTimeline)
3687
3773
  this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame);
3688
3774
  else if (timeline instanceof AttachmentTimeline)
3689
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
3775
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold);
3690
3776
  else {
3691
3777
  Utils.webkit602BugfixHelper(alpha, blend);
3692
3778
  if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
@@ -3746,7 +3832,7 @@ var spine = (() => {
3746
3832
  r2 = bone.data.rotation + timeline.getCurveValue(time);
3747
3833
  }
3748
3834
  let total = 0, diff = r2 - r1;
3749
- diff -= (16384 - (16384.499999999996 - diff / 360 | 0)) * 360;
3835
+ diff -= Math.ceil(diff / 360 - 0.5) * 360;
3750
3836
  if (diff == 0) {
3751
3837
  total = timelinesRotation[i];
3752
3838
  } else {
@@ -4003,8 +4089,9 @@ var spine = (() => {
4003
4089
  entry.reverse = false;
4004
4090
  entry.shortestRotation = false;
4005
4091
  entry.eventThreshold = 0;
4006
- entry.attachmentThreshold = 0;
4007
- entry.drawOrderThreshold = 0;
4092
+ entry.alphaAttachmentThreshold = 0;
4093
+ entry.mixAttachmentThreshold = 0;
4094
+ entry.mixDrawOrderThreshold = 0;
4008
4095
  entry.animationStart = 0;
4009
4096
  entry.animationEnd = animation.duration;
4010
4097
  entry.animationLast = -1;
@@ -4116,141 +4203,151 @@ var spine = (() => {
4116
4203
  }
4117
4204
  };
4118
4205
  var AnimationState = _AnimationState;
4119
- AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
4206
+ __publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
4120
4207
  var TrackEntry = class {
4121
- constructor() {
4122
- /** The animation to apply for this track entry. */
4123
- this.animation = null;
4124
- this.previous = null;
4125
- /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
4126
- this.next = null;
4127
- /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4128
- * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
4129
- this.mixingFrom = null;
4130
- /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4131
- * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
4132
- this.mixingTo = null;
4133
- /** The listener for events generated by this track entry, or null.
4134
- *
4135
- * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4136
- * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
4137
- this.listener = null;
4138
- /** The index of the track where this track entry is either current or queued.
4139
- *
4140
- * See {@link AnimationState#getCurrent()}. */
4141
- this.trackIndex = 0;
4142
- /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4143
- * duration. */
4144
- this.loop = false;
4145
- /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4146
- * of being mixed out.
4147
- *
4148
- * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4149
- * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4150
- * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4151
- * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4152
- * keys the property, only when a higher track also keys the property.
4153
- *
4154
- * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4155
- * previous animation. */
4156
- this.holdPrevious = false;
4157
- this.reverse = false;
4158
- this.shortestRotation = false;
4159
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4160
- * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4161
- * timelines are not applied while this animation is being mixed out. */
4162
- this.eventThreshold = 0;
4163
- /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4164
- * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4165
- * 0, so attachment timelines are not applied while this animation is being mixed out. */
4166
- this.attachmentThreshold = 0;
4167
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4168
- * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
4169
- * so draw order timelines are not applied while this animation is being mixed out. */
4170
- this.drawOrderThreshold = 0;
4171
- /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4172
- *
4173
- * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4174
- * value to prevent timeline keys before the start time from triggering. */
4175
- this.animationStart = 0;
4176
- /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4177
- * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
4178
- this.animationEnd = 0;
4179
- /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4180
- * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4181
- * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4182
- * is applied. */
4183
- this.animationLast = 0;
4184
- this.nextAnimationLast = 0;
4185
- /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4186
- * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4187
- * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4188
- * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4189
- *
4190
- * {@link #timeScale} affects the delay. */
4191
- this.delay = 0;
4192
- /** Current time in seconds this track entry has been the current track entry. The track time determines
4193
- * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4194
- * looping. */
4195
- this.trackTime = 0;
4196
- this.trackLast = 0;
4197
- this.nextTrackLast = 0;
4198
- /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4199
- * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4200
- * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4201
- * properties keyed by the animation are set to the setup pose and the track is cleared.
4202
- *
4203
- * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4204
- * abruptly cease being applied. */
4205
- this.trackEnd = 0;
4206
- /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4207
- * faster. Defaults to 1.
4208
- *
4209
- * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4210
- * match the animation speed.
4211
- *
4212
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4213
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4214
- * the time scale is not 1, the delay may need to be adjusted.
4215
- *
4216
- * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
4217
- this.timeScale = 0;
4218
- /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4219
- * to 1, which overwrites the skeleton's current pose with this animation.
4220
- *
4221
- * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4222
- * use alpha on track 0 if the skeleton pose is from the last frame render. */
4223
- this.alpha = 0;
4224
- /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4225
- * slightly more than `mixDuration` when the mix is complete. */
4226
- this.mixTime = 0;
4227
- /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4228
- * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4229
- *
4230
- * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4231
- * properties it was animating.
4232
- *
4233
- * The `mixDuration` can be set manually rather than use the value from
4234
- * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4235
- * track entry only before {@link AnimationState#update(float)} is first called.
4236
- *
4237
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4238
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4239
- * afterward. */
4240
- this.mixDuration = 0;
4241
- this.interruptAlpha = 0;
4242
- this.totalAlpha = 0;
4243
- /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4244
- * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4245
- * the values from the lower tracks.
4246
- *
4247
- * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4248
- * called. */
4249
- this.mixBlend = 2 /* replace */;
4250
- this.timelineMode = new Array();
4251
- this.timelineHoldMix = new Array();
4252
- this.timelinesRotation = new Array();
4253
- }
4208
+ /** The animation to apply for this track entry. */
4209
+ animation = null;
4210
+ previous = null;
4211
+ /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
4212
+ next = null;
4213
+ /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4214
+ * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
4215
+ mixingFrom = null;
4216
+ /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4217
+ * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
4218
+ mixingTo = null;
4219
+ /** The listener for events generated by this track entry, or null.
4220
+ *
4221
+ * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4222
+ * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
4223
+ listener = null;
4224
+ /** The index of the track where this track entry is either current or queued.
4225
+ *
4226
+ * See {@link AnimationState#getCurrent()}. */
4227
+ trackIndex = 0;
4228
+ /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4229
+ * duration. */
4230
+ loop = false;
4231
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4232
+ * of being mixed out.
4233
+ *
4234
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4235
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4236
+ * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4237
+ * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4238
+ * keys the property, only when a higher track also keys the property.
4239
+ *
4240
+ * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4241
+ * previous animation. */
4242
+ holdPrevious = false;
4243
+ reverse = false;
4244
+ shortestRotation = false;
4245
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4246
+ * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4247
+ * timelines are not applied while this animation is being mixed out. */
4248
+ eventThreshold = 0;
4249
+ /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4250
+ * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4251
+ * 0, so attachment timelines are not applied while this animation is being mixed out. */
4252
+ mixAttachmentThreshold = 0;
4253
+ /** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
4254
+ * Defaults to 0, so attachment timelines are always applied. */
4255
+ alphaAttachmentThreshold = 0;
4256
+ /** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
4257
+ * <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
4258
+ * 0, so draw order timelines are not applied while this animation is being mixed out. */
4259
+ mixDrawOrderThreshold = 0;
4260
+ /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4261
+ *
4262
+ * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4263
+ * value to prevent timeline keys before the start time from triggering. */
4264
+ animationStart = 0;
4265
+ /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4266
+ * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
4267
+ animationEnd = 0;
4268
+ /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4269
+ * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4270
+ * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4271
+ * is applied. */
4272
+ animationLast = 0;
4273
+ nextAnimationLast = 0;
4274
+ /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4275
+ * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4276
+ * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4277
+ * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4278
+ *
4279
+ * {@link #timeScale} affects the delay. */
4280
+ delay = 0;
4281
+ /** Current time in seconds this track entry has been the current track entry. The track time determines
4282
+ * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4283
+ * looping. */
4284
+ trackTime = 0;
4285
+ trackLast = 0;
4286
+ nextTrackLast = 0;
4287
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4288
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4289
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4290
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
4291
+ *
4292
+ * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4293
+ * abruptly cease being applied. */
4294
+ trackEnd = 0;
4295
+ /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4296
+ * faster. Defaults to 1.
4297
+ *
4298
+ * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4299
+ * match the animation speed.
4300
+ *
4301
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4302
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4303
+ * the time scale is not 1, the delay may need to be adjusted.
4304
+ *
4305
+ * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
4306
+ timeScale = 0;
4307
+ /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4308
+ * to 1, which overwrites the skeleton's current pose with this animation.
4309
+ *
4310
+ * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4311
+ * use alpha on track 0 if the skeleton pose is from the last frame render. */
4312
+ alpha = 0;
4313
+ /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4314
+ * slightly more than `mixDuration` when the mix is complete. */
4315
+ mixTime = 0;
4316
+ /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4317
+ * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4318
+ *
4319
+ * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4320
+ * properties it was animating.
4321
+ *
4322
+ * The `mixDuration` can be set manually rather than use the value from
4323
+ * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4324
+ * track entry only before {@link AnimationState#update(float)} is first called.
4325
+ *
4326
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4327
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4328
+ * afterward. */
4329
+ _mixDuration = 0;
4330
+ interruptAlpha = 0;
4331
+ totalAlpha = 0;
4332
+ get mixDuration() {
4333
+ return this._mixDuration;
4334
+ }
4335
+ set mixDuration(mixDuration) {
4336
+ this._mixDuration = mixDuration;
4337
+ if (this.previous != null && this.delay <= 0)
4338
+ this.delay += this.previous.getTrackComplete() - mixDuration;
4339
+ this.delay = this.delay;
4340
+ }
4341
+ /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4342
+ * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4343
+ * the values from the lower tracks.
4344
+ *
4345
+ * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4346
+ * called. */
4347
+ mixBlend = 2 /* replace */;
4348
+ timelineMode = new Array();
4349
+ timelineHoldMix = new Array();
4350
+ timelinesRotation = new Array();
4254
4351
  reset() {
4255
4352
  this.next = null;
4256
4353
  this.previous = null;
@@ -4304,11 +4401,18 @@ var spine = (() => {
4304
4401
  }
4305
4402
  return this.trackTime;
4306
4403
  }
4404
+ /** Returns true if this track entry has been applied at least once.
4405
+ * <p>
4406
+ * See {@link AnimationState#apply(Skeleton)}. */
4407
+ wasApplied() {
4408
+ return this.nextTrackLast != -1;
4409
+ }
4307
4410
  };
4308
4411
  var EventQueue = class {
4412
+ objects = [];
4413
+ drainDisabled = false;
4414
+ animState;
4309
4415
  constructor(animState) {
4310
- this.objects = [];
4311
- this.drainDisabled = false;
4312
4416
  this.animState = animState;
4313
4417
  }
4314
4418
  start(entry) {
@@ -4445,10 +4549,12 @@ var spine = (() => {
4445
4549
 
4446
4550
  // spine-core/src/AnimationStateData.ts
4447
4551
  var AnimationStateData = class {
4552
+ /** The SkeletonData to look up animations when they are specified by name. */
4553
+ skeletonData;
4554
+ animationToMixTime = {};
4555
+ /** The mix duration to use when no mix duration has been defined between two animations. */
4556
+ defaultMix = 0;
4448
4557
  constructor(skeletonData) {
4449
- this.animationToMixTime = {};
4450
- /** The mix duration to use when no mix duration has been defined between two animations. */
4451
- this.defaultMix = 0;
4452
4558
  if (!skeletonData)
4453
4559
  throw new Error("skeletonData cannot be null.");
4454
4560
  this.skeletonData = skeletonData;
@@ -4487,9 +4593,9 @@ var spine = (() => {
4487
4593
 
4488
4594
  // spine-core/src/attachments/BoundingBoxAttachment.ts
4489
4595
  var BoundingBoxAttachment = class extends VertexAttachment {
4596
+ color = new Color(1, 1, 1, 1);
4490
4597
  constructor(name) {
4491
4598
  super(name);
4492
- this.color = new Color(1, 1, 1, 1);
4493
4599
  }
4494
4600
  copy() {
4495
4601
  let copy = new BoundingBoxAttachment(this.name);
@@ -4501,16 +4607,16 @@ var spine = (() => {
4501
4607
 
4502
4608
  // spine-core/src/attachments/ClippingAttachment.ts
4503
4609
  var ClippingAttachment = class extends VertexAttachment {
4610
+ /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4611
+ * the skeleton's rendering. */
4612
+ endSlot = null;
4613
+ // Nonessential.
4614
+ /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4615
+ * are not usually rendered at runtime. */
4616
+ color = new Color(0.2275, 0.2275, 0.8078, 1);
4504
4617
  // ce3a3aff
4505
4618
  constructor(name) {
4506
4619
  super(name);
4507
- /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4508
- * the skeleton's rendering. */
4509
- this.endSlot = null;
4510
- // Nonessential.
4511
- /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4512
- * are not usually rendered at runtime. */
4513
- this.color = new Color(0.2275, 0.2275, 0.8078, 1);
4514
4620
  }
4515
4621
  copy() {
4516
4622
  let copy = new ClippingAttachment(this.name);
@@ -4523,6 +4629,7 @@ var spine = (() => {
4523
4629
 
4524
4630
  // spine-core/src/Texture.ts
4525
4631
  var Texture = class {
4632
+ _image;
4526
4633
  constructor(image) {
4527
4634
  this._image = image;
4528
4635
  }
@@ -4547,19 +4654,18 @@ var spine = (() => {
4547
4654
  return TextureWrap2;
4548
4655
  })(TextureWrap || {});
4549
4656
  var TextureRegion = class {
4550
- constructor() {
4551
- this.u = 0;
4552
- this.v = 0;
4553
- this.u2 = 0;
4554
- this.v2 = 0;
4555
- this.width = 0;
4556
- this.height = 0;
4557
- this.degrees = 0;
4558
- this.offsetX = 0;
4559
- this.offsetY = 0;
4560
- this.originalWidth = 0;
4561
- this.originalHeight = 0;
4562
- }
4657
+ texture;
4658
+ u = 0;
4659
+ v = 0;
4660
+ u2 = 0;
4661
+ v2 = 0;
4662
+ width = 0;
4663
+ height = 0;
4664
+ degrees = 0;
4665
+ offsetX = 0;
4666
+ offsetY = 0;
4667
+ originalWidth = 0;
4668
+ originalHeight = 0;
4563
4669
  };
4564
4670
  var FakeTexture = class extends Texture {
4565
4671
  setFilters(minFilter, magFilter) {
@@ -4572,9 +4678,9 @@ var spine = (() => {
4572
4678
 
4573
4679
  // spine-core/src/TextureAtlas.ts
4574
4680
  var TextureAtlas = class {
4681
+ pages = new Array();
4682
+ regions = new Array();
4575
4683
  constructor(atlasText) {
4576
- this.pages = new Array();
4577
- this.regions = new Array();
4578
4684
  let reader = new TextureAtlasReader(atlasText);
4579
4685
  let entry = new Array(4);
4580
4686
  let pageFields = {};
@@ -4722,15 +4828,15 @@ var spine = (() => {
4722
4828
  page.setTexture(assetManager.get(pathPrefix + page.name));
4723
4829
  }
4724
4830
  dispose() {
4725
- var _a;
4726
4831
  for (let i = 0; i < this.pages.length; i++) {
4727
- (_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
4832
+ this.pages[i].texture?.dispose();
4728
4833
  }
4729
4834
  }
4730
4835
  };
4731
4836
  var TextureAtlasReader = class {
4837
+ lines;
4838
+ index = 0;
4732
4839
  constructor(text) {
4733
- this.index = 0;
4734
4840
  this.lines = text.split(/\r\n|\r|\n/);
4735
4841
  }
4736
4842
  readLine() {
@@ -4762,16 +4868,17 @@ var spine = (() => {
4762
4868
  }
4763
4869
  };
4764
4870
  var TextureAtlasPage = class {
4871
+ name;
4872
+ minFilter = 9728 /* Nearest */;
4873
+ magFilter = 9728 /* Nearest */;
4874
+ uWrap = 33071 /* ClampToEdge */;
4875
+ vWrap = 33071 /* ClampToEdge */;
4876
+ texture = null;
4877
+ width = 0;
4878
+ height = 0;
4879
+ pma = false;
4880
+ regions = new Array();
4765
4881
  constructor(name) {
4766
- this.minFilter = 9728 /* Nearest */;
4767
- this.magFilter = 9728 /* Nearest */;
4768
- this.uWrap = 33071 /* ClampToEdge */;
4769
- this.vWrap = 33071 /* ClampToEdge */;
4770
- this.texture = null;
4771
- this.width = 0;
4772
- this.height = 0;
4773
- this.pma = false;
4774
- this.regions = new Array();
4775
4882
  this.name = name;
4776
4883
  }
4777
4884
  setTexture(texture) {
@@ -4783,18 +4890,20 @@ var spine = (() => {
4783
4890
  }
4784
4891
  };
4785
4892
  var TextureAtlasRegion = class extends TextureRegion {
4893
+ page;
4894
+ name;
4895
+ x = 0;
4896
+ y = 0;
4897
+ offsetX = 0;
4898
+ offsetY = 0;
4899
+ originalWidth = 0;
4900
+ originalHeight = 0;
4901
+ index = 0;
4902
+ degrees = 0;
4903
+ names = null;
4904
+ values = null;
4786
4905
  constructor(page, name) {
4787
4906
  super();
4788
- this.x = 0;
4789
- this.y = 0;
4790
- this.offsetX = 0;
4791
- this.offsetY = 0;
4792
- this.originalWidth = 0;
4793
- this.originalHeight = 0;
4794
- this.index = 0;
4795
- this.degrees = 0;
4796
- this.names = null;
4797
- this.values = null;
4798
4907
  this.page = page;
4799
4908
  this.name = name;
4800
4909
  page.regions.push(this);
@@ -4803,31 +4912,33 @@ var spine = (() => {
4803
4912
 
4804
4913
  // spine-core/src/attachments/MeshAttachment.ts
4805
4914
  var MeshAttachment = class extends VertexAttachment {
4915
+ region = null;
4916
+ /** The name of the texture region for this attachment. */
4917
+ path;
4918
+ /** The UV pair for each vertex, normalized within the texture region. */
4919
+ regionUVs = [];
4920
+ /** The UV pair for each vertex, normalized within the entire texture.
4921
+ *
4922
+ * See {@link #updateUVs}. */
4923
+ uvs = [];
4924
+ /** Triplets of vertex indices which describe the mesh's triangulation. */
4925
+ triangles = [];
4926
+ /** The color to tint the mesh. */
4927
+ color = new Color(1, 1, 1, 1);
4928
+ /** The width of the mesh's image. Available only when nonessential data was exported. */
4929
+ width = 0;
4930
+ /** The height of the mesh's image. Available only when nonessential data was exported. */
4931
+ height = 0;
4932
+ /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
4933
+ hullLength = 0;
4934
+ /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4935
+ * nonessential data was exported. Triangulation is not performed at runtime. */
4936
+ edges = [];
4937
+ parentMesh = null;
4938
+ sequence = null;
4939
+ tempColor = new Color(0, 0, 0, 0);
4806
4940
  constructor(name, path) {
4807
4941
  super(name);
4808
- this.region = null;
4809
- /** The UV pair for each vertex, normalized within the texture region. */
4810
- this.regionUVs = [];
4811
- /** The UV pair for each vertex, normalized within the entire texture.
4812
- *
4813
- * See {@link #updateUVs}. */
4814
- this.uvs = [];
4815
- /** Triplets of vertex indices which describe the mesh's triangulation. */
4816
- this.triangles = [];
4817
- /** The color to tint the mesh. */
4818
- this.color = new Color(1, 1, 1, 1);
4819
- /** The width of the mesh's image. Available only when nonessential data was exported. */
4820
- this.width = 0;
4821
- /** The height of the mesh's image. Available only when nonessential data was exported. */
4822
- this.height = 0;
4823
- /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
4824
- this.hullLength = 0;
4825
- /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4826
- * nonessential data was exported. Triangulation is not performed at runtime. */
4827
- this.edges = [];
4828
- this.parentMesh = null;
4829
- this.sequence = null;
4830
- this.tempColor = new Color(0, 0, 0, 0);
4831
4942
  this.path = path;
4832
4943
  }
4833
4944
  /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
@@ -4954,18 +5065,18 @@ var spine = (() => {
4954
5065
 
4955
5066
  // spine-core/src/attachments/PathAttachment.ts
4956
5067
  var PathAttachment = class extends VertexAttachment {
5068
+ /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5069
+ lengths = [];
5070
+ /** If true, the start and end knots are connected. */
5071
+ closed = false;
5072
+ /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
5073
+ * calculations are performed but calculating positions along the path is less accurate. */
5074
+ constantSpeed = false;
5075
+ /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
5076
+ * rendered at runtime. */
5077
+ color = new Color(1, 1, 1, 1);
4957
5078
  constructor(name) {
4958
5079
  super(name);
4959
- /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
4960
- this.lengths = [];
4961
- /** If true, the start and end knots are connected. */
4962
- this.closed = false;
4963
- /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
4964
- * calculations are performed but calculating positions along the path is less accurate. */
4965
- this.constantSpeed = false;
4966
- /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
4967
- * rendered at runtime. */
4968
- this.color = new Color(1, 1, 1, 1);
4969
5080
  }
4970
5081
  copy() {
4971
5082
  let copy = new PathAttachment(this.name);
@@ -4981,14 +5092,14 @@ var spine = (() => {
4981
5092
 
4982
5093
  // spine-core/src/attachments/PointAttachment.ts
4983
5094
  var PointAttachment = class extends VertexAttachment {
5095
+ x = 0;
5096
+ y = 0;
5097
+ rotation = 0;
5098
+ /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
5099
+ * are not usually rendered at runtime. */
5100
+ color = new Color(0.38, 0.94, 0, 1);
4984
5101
  constructor(name) {
4985
5102
  super(name);
4986
- this.x = 0;
4987
- this.y = 0;
4988
- this.rotation = 0;
4989
- /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
4990
- * are not usually rendered at runtime. */
4991
- this.color = new Color(0.38, 0.94, 0, 1);
4992
5103
  }
4993
5104
  computeWorldPosition(bone, point) {
4994
5105
  point.x = this.x * bone.a + this.y * bone.b + bone.worldX;
@@ -4996,10 +5107,10 @@ var spine = (() => {
4996
5107
  return point;
4997
5108
  }
4998
5109
  computeWorldRotation(bone) {
4999
- let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
5000
- let x = cos * bone.a + sin * bone.b;
5001
- let y = cos * bone.c + sin * bone.d;
5002
- return Math.atan2(y, x) * MathUtils.radDeg;
5110
+ const r = this.rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
5111
+ const x = cos * bone.a + sin * bone.b;
5112
+ const y = cos * bone.c + sin * bone.d;
5113
+ return MathUtils.atan2Deg(y, x);
5003
5114
  }
5004
5115
  copy() {
5005
5116
  let copy = new PointAttachment(this.name);
@@ -5013,32 +5124,34 @@ var spine = (() => {
5013
5124
 
5014
5125
  // spine-core/src/attachments/RegionAttachment.ts
5015
5126
  var _RegionAttachment = class extends Attachment {
5127
+ /** The local x translation. */
5128
+ x = 0;
5129
+ /** The local y translation. */
5130
+ y = 0;
5131
+ /** The local scaleX. */
5132
+ scaleX = 1;
5133
+ /** The local scaleY. */
5134
+ scaleY = 1;
5135
+ /** The local rotation. */
5136
+ rotation = 0;
5137
+ /** The width of the region attachment in Spine. */
5138
+ width = 0;
5139
+ /** The height of the region attachment in Spine. */
5140
+ height = 0;
5141
+ /** The color to tint the region attachment. */
5142
+ color = new Color(1, 1, 1, 1);
5143
+ /** The name of the texture region for this attachment. */
5144
+ path;
5145
+ region = null;
5146
+ sequence = null;
5147
+ /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5148
+ *
5149
+ * See {@link #updateOffset()}. */
5150
+ offset = Utils.newFloatArray(8);
5151
+ uvs = Utils.newFloatArray(8);
5152
+ tempColor = new Color(1, 1, 1, 1);
5016
5153
  constructor(name, path) {
5017
5154
  super(name);
5018
- /** The local x translation. */
5019
- this.x = 0;
5020
- /** The local y translation. */
5021
- this.y = 0;
5022
- /** The local scaleX. */
5023
- this.scaleX = 1;
5024
- /** The local scaleY. */
5025
- this.scaleY = 1;
5026
- /** The local rotation. */
5027
- this.rotation = 0;
5028
- /** The width of the region attachment in Spine. */
5029
- this.width = 0;
5030
- /** The height of the region attachment in Spine. */
5031
- this.height = 0;
5032
- /** The color to tint the region attachment. */
5033
- this.color = new Color(1, 1, 1, 1);
5034
- this.region = null;
5035
- this.sequence = null;
5036
- /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5037
- *
5038
- * See {@link #updateOffset()}. */
5039
- this.offset = Utils.newFloatArray(8);
5040
- this.uvs = Utils.newFloatArray(8);
5041
- this.tempColor = new Color(1, 1, 1, 1);
5042
5155
  this.path = path;
5043
5156
  }
5044
5157
  /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
@@ -5064,7 +5177,7 @@ var spine = (() => {
5064
5177
  let localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
5065
5178
  let localX2 = localX + this.region.width * regionScaleX;
5066
5179
  let localY2 = localY + this.region.height * regionScaleY;
5067
- let radians = this.rotation * Math.PI / 180;
5180
+ let radians = this.rotation * MathUtils.degRad;
5068
5181
  let cos = Math.cos(radians);
5069
5182
  let sin = Math.sin(radians);
5070
5183
  let x = this.x, y = this.y;
@@ -5159,41 +5272,42 @@ var spine = (() => {
5159
5272
  }
5160
5273
  };
5161
5274
  var RegionAttachment = _RegionAttachment;
5162
- RegionAttachment.X1 = 0;
5163
- RegionAttachment.Y1 = 1;
5164
- RegionAttachment.C1R = 2;
5165
- RegionAttachment.C1G = 3;
5166
- RegionAttachment.C1B = 4;
5167
- RegionAttachment.C1A = 5;
5168
- RegionAttachment.U1 = 6;
5169
- RegionAttachment.V1 = 7;
5170
- RegionAttachment.X2 = 8;
5171
- RegionAttachment.Y2 = 9;
5172
- RegionAttachment.C2R = 10;
5173
- RegionAttachment.C2G = 11;
5174
- RegionAttachment.C2B = 12;
5175
- RegionAttachment.C2A = 13;
5176
- RegionAttachment.U2 = 14;
5177
- RegionAttachment.V2 = 15;
5178
- RegionAttachment.X3 = 16;
5179
- RegionAttachment.Y3 = 17;
5180
- RegionAttachment.C3R = 18;
5181
- RegionAttachment.C3G = 19;
5182
- RegionAttachment.C3B = 20;
5183
- RegionAttachment.C3A = 21;
5184
- RegionAttachment.U3 = 22;
5185
- RegionAttachment.V3 = 23;
5186
- RegionAttachment.X4 = 24;
5187
- RegionAttachment.Y4 = 25;
5188
- RegionAttachment.C4R = 26;
5189
- RegionAttachment.C4G = 27;
5190
- RegionAttachment.C4B = 28;
5191
- RegionAttachment.C4A = 29;
5192
- RegionAttachment.U4 = 30;
5193
- RegionAttachment.V4 = 31;
5275
+ __publicField(RegionAttachment, "X1", 0);
5276
+ __publicField(RegionAttachment, "Y1", 1);
5277
+ __publicField(RegionAttachment, "C1R", 2);
5278
+ __publicField(RegionAttachment, "C1G", 3);
5279
+ __publicField(RegionAttachment, "C1B", 4);
5280
+ __publicField(RegionAttachment, "C1A", 5);
5281
+ __publicField(RegionAttachment, "U1", 6);
5282
+ __publicField(RegionAttachment, "V1", 7);
5283
+ __publicField(RegionAttachment, "X2", 8);
5284
+ __publicField(RegionAttachment, "Y2", 9);
5285
+ __publicField(RegionAttachment, "C2R", 10);
5286
+ __publicField(RegionAttachment, "C2G", 11);
5287
+ __publicField(RegionAttachment, "C2B", 12);
5288
+ __publicField(RegionAttachment, "C2A", 13);
5289
+ __publicField(RegionAttachment, "U2", 14);
5290
+ __publicField(RegionAttachment, "V2", 15);
5291
+ __publicField(RegionAttachment, "X3", 16);
5292
+ __publicField(RegionAttachment, "Y3", 17);
5293
+ __publicField(RegionAttachment, "C3R", 18);
5294
+ __publicField(RegionAttachment, "C3G", 19);
5295
+ __publicField(RegionAttachment, "C3B", 20);
5296
+ __publicField(RegionAttachment, "C3A", 21);
5297
+ __publicField(RegionAttachment, "U3", 22);
5298
+ __publicField(RegionAttachment, "V3", 23);
5299
+ __publicField(RegionAttachment, "X4", 24);
5300
+ __publicField(RegionAttachment, "Y4", 25);
5301
+ __publicField(RegionAttachment, "C4R", 26);
5302
+ __publicField(RegionAttachment, "C4G", 27);
5303
+ __publicField(RegionAttachment, "C4B", 28);
5304
+ __publicField(RegionAttachment, "C4A", 29);
5305
+ __publicField(RegionAttachment, "U4", 30);
5306
+ __publicField(RegionAttachment, "V4", 31);
5194
5307
 
5195
5308
  // spine-core/src/AtlasAttachmentLoader.ts
5196
5309
  var AtlasAttachmentLoader = class {
5310
+ atlas;
5197
5311
  constructor(atlas) {
5198
5312
  this.atlas = atlas;
5199
5313
  }
@@ -5247,36 +5361,42 @@ var spine = (() => {
5247
5361
 
5248
5362
  // spine-core/src/BoneData.ts
5249
5363
  var BoneData = class {
5364
+ /** The index of the bone in {@link Skeleton#getBones()}. */
5365
+ index = 0;
5366
+ /** The name of the bone, which is unique across all bones in the skeleton. */
5367
+ name;
5368
+ /** @returns May be null. */
5369
+ parent = null;
5370
+ /** The bone's length. */
5371
+ length = 0;
5372
+ /** The local x translation. */
5373
+ x = 0;
5374
+ /** The local y translation. */
5375
+ y = 0;
5376
+ /** The local rotation in degrees, counter clockwise. */
5377
+ rotation = 0;
5378
+ /** The local scaleX. */
5379
+ scaleX = 1;
5380
+ /** The local scaleY. */
5381
+ scaleY = 1;
5382
+ /** The local shearX. */
5383
+ shearX = 0;
5384
+ /** The local shearX. */
5385
+ shearY = 0;
5386
+ /** The transform mode for how parent world transforms affect this bone. */
5387
+ transformMode = TransformMode.Normal;
5388
+ /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5389
+ * bone.
5390
+ * @see Skin#bones */
5391
+ skinRequired = false;
5392
+ /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5393
+ * rendered at runtime. */
5394
+ color = new Color();
5395
+ /** The bone icon as it was in Spine, or null if nonessential data was not exported. */
5396
+ icon;
5397
+ /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
5398
+ visible = false;
5250
5399
  constructor(index, name, parent) {
5251
- /** The index of the bone in {@link Skeleton#getBones()}. */
5252
- this.index = 0;
5253
- /** @returns May be null. */
5254
- this.parent = null;
5255
- /** The bone's length. */
5256
- this.length = 0;
5257
- /** The local x translation. */
5258
- this.x = 0;
5259
- /** The local y translation. */
5260
- this.y = 0;
5261
- /** The local rotation. */
5262
- this.rotation = 0;
5263
- /** The local scaleX. */
5264
- this.scaleX = 1;
5265
- /** The local scaleY. */
5266
- this.scaleY = 1;
5267
- /** The local shearX. */
5268
- this.shearX = 0;
5269
- /** The local shearX. */
5270
- this.shearY = 0;
5271
- /** The transform mode for how parent world transforms affect this bone. */
5272
- this.transformMode = TransformMode.Normal;
5273
- /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5274
- * bone.
5275
- * @see Skin#bones */
5276
- this.skinRequired = false;
5277
- /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5278
- * rendered at runtime. */
5279
- this.color = new Color();
5280
5400
  if (index < 0)
5281
5401
  throw new Error("index must be >= 0.");
5282
5402
  if (!name)
@@ -5297,54 +5417,58 @@ var spine = (() => {
5297
5417
 
5298
5418
  // spine-core/src/Bone.ts
5299
5419
  var Bone = class {
5420
+ /** The bone's setup pose data. */
5421
+ data;
5422
+ /** The skeleton this bone belongs to. */
5423
+ skeleton;
5424
+ /** The parent bone, or null if this is the root bone. */
5425
+ parent = null;
5426
+ /** The immediate children of this bone. */
5427
+ children = new Array();
5428
+ /** The local x translation. */
5429
+ x = 0;
5430
+ /** The local y translation. */
5431
+ y = 0;
5432
+ /** The local rotation in degrees, counter clockwise. */
5433
+ rotation = 0;
5434
+ /** The local scaleX. */
5435
+ scaleX = 0;
5436
+ /** The local scaleY. */
5437
+ scaleY = 0;
5438
+ /** The local shearX. */
5439
+ shearX = 0;
5440
+ /** The local shearY. */
5441
+ shearY = 0;
5442
+ /** The applied local x translation. */
5443
+ ax = 0;
5444
+ /** The applied local y translation. */
5445
+ ay = 0;
5446
+ /** The applied local rotation in degrees, counter clockwise. */
5447
+ arotation = 0;
5448
+ /** The applied local scaleX. */
5449
+ ascaleX = 0;
5450
+ /** The applied local scaleY. */
5451
+ ascaleY = 0;
5452
+ /** The applied local shearX. */
5453
+ ashearX = 0;
5454
+ /** The applied local shearY. */
5455
+ ashearY = 0;
5456
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5457
+ a = 0;
5458
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5459
+ b = 0;
5460
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5461
+ c = 0;
5462
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5463
+ d = 0;
5464
+ /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
5465
+ worldY = 0;
5466
+ /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
5467
+ worldX = 0;
5468
+ sorted = false;
5469
+ active = false;
5300
5470
  /** @param parent May be null. */
5301
5471
  constructor(data, skeleton, parent) {
5302
- /** The parent bone, or null if this is the root bone. */
5303
- this.parent = null;
5304
- /** The immediate children of this bone. */
5305
- this.children = new Array();
5306
- /** The local x translation. */
5307
- this.x = 0;
5308
- /** The local y translation. */
5309
- this.y = 0;
5310
- /** The local rotation in degrees, counter clockwise. */
5311
- this.rotation = 0;
5312
- /** The local scaleX. */
5313
- this.scaleX = 0;
5314
- /** The local scaleY. */
5315
- this.scaleY = 0;
5316
- /** The local shearX. */
5317
- this.shearX = 0;
5318
- /** The local shearY. */
5319
- this.shearY = 0;
5320
- /** The applied local x translation. */
5321
- this.ax = 0;
5322
- /** The applied local y translation. */
5323
- this.ay = 0;
5324
- /** The applied local rotation in degrees, counter clockwise. */
5325
- this.arotation = 0;
5326
- /** The applied local scaleX. */
5327
- this.ascaleX = 0;
5328
- /** The applied local scaleY. */
5329
- this.ascaleY = 0;
5330
- /** The applied local shearX. */
5331
- this.ashearX = 0;
5332
- /** The applied local shearY. */
5333
- this.ashearY = 0;
5334
- /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5335
- this.a = 0;
5336
- /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5337
- this.b = 0;
5338
- /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5339
- this.c = 0;
5340
- /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5341
- this.d = 0;
5342
- /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
5343
- this.worldY = 0;
5344
- /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
5345
- this.worldX = 0;
5346
- this.sorted = false;
5347
- this.active = false;
5348
5472
  if (!data)
5349
5473
  throw new Error("data cannot be null.");
5350
5474
  if (!skeleton)
@@ -5360,7 +5484,7 @@ var spine = (() => {
5360
5484
  return this.active;
5361
5485
  }
5362
5486
  /** Computes the world transform using the parent bone and this bone's local applied transform. */
5363
- update() {
5487
+ update(physics) {
5364
5488
  this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
5365
5489
  }
5366
5490
  /** Computes the world transform using the parent bone and this bone's local transform.
@@ -5385,13 +5509,13 @@ var spine = (() => {
5385
5509
  let parent = this.parent;
5386
5510
  if (!parent) {
5387
5511
  let skeleton = this.skeleton;
5388
- let rotationY = rotation + 90 + shearY;
5389
- let sx = skeleton.scaleX;
5390
- let sy = skeleton.scaleY;
5391
- this.a = MathUtils.cosDeg(rotation + shearX) * scaleX * sx;
5392
- this.b = MathUtils.cosDeg(rotationY) * scaleY * sx;
5393
- this.c = MathUtils.sinDeg(rotation + shearX) * scaleX * sy;
5394
- this.d = MathUtils.sinDeg(rotationY) * scaleY * sy;
5512
+ const sx = skeleton.scaleX, sy = skeleton.scaleY;
5513
+ const rx = (rotation + shearX) * MathUtils.degRad;
5514
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5515
+ this.a = Math.cos(rx) * scaleX * sx;
5516
+ this.b = Math.cos(ry) * scaleY * sx;
5517
+ this.c = Math.sin(rx) * scaleX * sy;
5518
+ this.d = Math.sin(ry) * scaleY * sy;
5395
5519
  this.worldX = x * sx + skeleton.x;
5396
5520
  this.worldY = y * sy + skeleton.y;
5397
5521
  return;
@@ -5401,11 +5525,12 @@ var spine = (() => {
5401
5525
  this.worldY = pc * x + pd * y + parent.worldY;
5402
5526
  switch (this.data.transformMode) {
5403
5527
  case 0 /* Normal */: {
5404
- let rotationY = rotation + 90 + shearY;
5405
- let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
5406
- let lb = MathUtils.cosDeg(rotationY) * scaleY;
5407
- let lc = MathUtils.sinDeg(rotation + shearX) * scaleX;
5408
- let ld = MathUtils.sinDeg(rotationY) * scaleY;
5528
+ const rx = (rotation + shearX) * MathUtils.degRad;
5529
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5530
+ const la = Math.cos(rx) * scaleX;
5531
+ const lb = Math.cos(ry) * scaleY;
5532
+ const lc = Math.sin(rx) * scaleX;
5533
+ const ld = Math.sin(ry) * scaleY;
5409
5534
  this.a = pa * la + pb * lc;
5410
5535
  this.b = pa * lb + pb * ld;
5411
5536
  this.c = pc * la + pd * lc;
@@ -5413,11 +5538,12 @@ var spine = (() => {
5413
5538
  return;
5414
5539
  }
5415
5540
  case 1 /* OnlyTranslation */: {
5416
- let rotationY = rotation + 90 + shearY;
5417
- this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
5418
- this.b = MathUtils.cosDeg(rotationY) * scaleY;
5419
- this.c = MathUtils.sinDeg(rotation + shearX) * scaleX;
5420
- this.d = MathUtils.sinDeg(rotationY) * scaleY;
5541
+ const rx = (rotation + shearX) * MathUtils.degRad;
5542
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5543
+ this.a = Math.cos(rx) * scaleX;
5544
+ this.b = Math.cos(ry) * scaleY;
5545
+ this.c = Math.sin(rx) * scaleX;
5546
+ this.d = Math.sin(ry) * scaleY;
5421
5547
  break;
5422
5548
  }
5423
5549
  case 2 /* NoRotationOrReflection */: {
@@ -5435,12 +5561,12 @@ var spine = (() => {
5435
5561
  pc = 0;
5436
5562
  prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;
5437
5563
  }
5438
- let rx = rotation + shearX - prx;
5439
- let ry = rotation + shearY - prx + 90;
5440
- let la = MathUtils.cosDeg(rx) * scaleX;
5441
- let lb = MathUtils.cosDeg(ry) * scaleY;
5442
- let lc = MathUtils.sinDeg(rx) * scaleX;
5443
- let ld = MathUtils.sinDeg(ry) * scaleY;
5564
+ const rx = (rotation + shearX - prx) * MathUtils.degRad;
5565
+ const ry = (rotation + shearY - prx + 90) * MathUtils.degRad;
5566
+ const la = Math.cos(rx) * scaleX;
5567
+ const lb = Math.cos(ry) * scaleY;
5568
+ const lc = Math.sin(rx) * scaleX;
5569
+ const ld = Math.sin(ry) * scaleY;
5444
5570
  this.a = pa * la - pb * lc;
5445
5571
  this.b = pa * lb - pb * ld;
5446
5572
  this.c = pc * la + pd * lc;
@@ -5449,8 +5575,8 @@ var spine = (() => {
5449
5575
  }
5450
5576
  case 3 /* NoScale */:
5451
5577
  case 4 /* NoScaleOrReflection */: {
5452
- let cos = MathUtils.cosDeg(rotation);
5453
- let sin = MathUtils.sinDeg(rotation);
5578
+ rotation *= MathUtils.degRad;
5579
+ const cos = Math.cos(rotation), sin = Math.sin(rotation);
5454
5580
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
5455
5581
  let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5456
5582
  let s = Math.sqrt(za * za + zc * zc);
@@ -5461,13 +5587,15 @@ var spine = (() => {
5461
5587
  s = Math.sqrt(za * za + zc * zc);
5462
5588
  if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5463
5589
  s = -s;
5464
- let r = Math.PI / 2 + Math.atan2(zc, za);
5465
- let zb = Math.cos(r) * s;
5466
- let zd = Math.sin(r) * s;
5467
- let la = MathUtils.cosDeg(shearX) * scaleX;
5468
- let lb = MathUtils.cosDeg(90 + shearY) * scaleY;
5469
- let lc = MathUtils.sinDeg(shearX) * scaleX;
5470
- let ld = MathUtils.sinDeg(90 + shearY) * scaleY;
5590
+ rotation = Math.PI / 2 + Math.atan2(zc, za);
5591
+ const zb = Math.cos(rotation) * s;
5592
+ const zd = Math.sin(rotation) * s;
5593
+ shearX *= MathUtils.degRad;
5594
+ shearY = (90 + shearY) * MathUtils.degRad;
5595
+ const la = Math.cos(shearX) * scaleX;
5596
+ const lb = Math.cos(shearY) * scaleY;
5597
+ const lc = Math.sin(shearX) * scaleX;
5598
+ const ld = Math.sin(shearY) * scaleY;
5471
5599
  this.a = za * la + zb * lc;
5472
5600
  this.b = za * lb + zb * ld;
5473
5601
  this.c = zc * la + zd * lc;
@@ -5491,22 +5619,6 @@ var spine = (() => {
5491
5619
  this.shearX = data.shearX;
5492
5620
  this.shearY = data.shearY;
5493
5621
  }
5494
- /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
5495
- getWorldRotationX() {
5496
- return Math.atan2(this.c, this.a) * MathUtils.radDeg;
5497
- }
5498
- /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
5499
- getWorldRotationY() {
5500
- return Math.atan2(this.d, this.b) * MathUtils.radDeg;
5501
- }
5502
- /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
5503
- getWorldScaleX() {
5504
- return Math.sqrt(this.a * this.a + this.c * this.c);
5505
- }
5506
- /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
5507
- getWorldScaleY() {
5508
- return Math.sqrt(this.b * this.b + this.d * this.d);
5509
- }
5510
5622
  /** Computes the applied transform values from the world transform.
5511
5623
  *
5512
5624
  * If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
@@ -5593,6 +5705,22 @@ var spine = (() => {
5593
5705
  this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
5594
5706
  }
5595
5707
  }
5708
+ /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
5709
+ getWorldRotationX() {
5710
+ return Math.atan2(this.c, this.a) * MathUtils.radDeg;
5711
+ }
5712
+ /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
5713
+ getWorldRotationY() {
5714
+ return Math.atan2(this.d, this.b) * MathUtils.radDeg;
5715
+ }
5716
+ /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
5717
+ getWorldScaleX() {
5718
+ return Math.sqrt(this.a * this.a + this.c * this.c);
5719
+ }
5720
+ /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
5721
+ getWorldScaleY() {
5722
+ return Math.sqrt(this.b * this.b + this.d * this.d);
5723
+ }
5596
5724
  /** Transforms a point from world coordinates to the bone's local coordinates. */
5597
5725
  worldToLocal(world) {
5598
5726
  let invDet = 1 / (this.a * this.d - this.b * this.c);
@@ -5608,6 +5736,18 @@ var spine = (() => {
5608
5736
  local.y = x * this.c + y * this.d + this.worldY;
5609
5737
  return local;
5610
5738
  }
5739
+ /** Transforms a point from world coordinates to the parent bone's local coordinates. */
5740
+ worldToParent(world) {
5741
+ if (world == null)
5742
+ throw new Error("world cannot be null.");
5743
+ return this.parent == null ? world : this.parent.worldToLocal(world);
5744
+ }
5745
+ /** Transforms a point from the parent bone's coordinates to world coordinates. */
5746
+ parentToWorld(world) {
5747
+ if (world == null)
5748
+ throw new Error("world cannot be null.");
5749
+ return this.parent == null ? world : this.parent.localToWorld(world);
5750
+ }
5611
5751
  /** Transforms a world rotation to a local rotation. */
5612
5752
  worldToLocalRotation(worldRotation) {
5613
5753
  let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
@@ -5621,15 +5761,16 @@ var spine = (() => {
5621
5761
  }
5622
5762
  /** Rotates the world transform the specified amount.
5623
5763
  * <p>
5624
- * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
5625
- * need to be called on any child bones, recursively. */
5764
+ * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
5765
+ * {@link #update(Physics)} will need to be called on any child bones, recursively. */
5626
5766
  rotateWorld(degrees) {
5627
- let a = this.a, b = this.b, c = this.c, d = this.d;
5628
- let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
5629
- this.a = cos * a - sin * c;
5630
- this.b = cos * b - sin * d;
5631
- this.c = sin * a + cos * c;
5632
- this.d = sin * b + cos * d;
5767
+ degrees *= MathUtils.degRad;
5768
+ const sin = Math.sin(degrees), cos = Math.cos(degrees);
5769
+ const ra = this.a, rb = this.b;
5770
+ this.a = cos * ra - sin * this.c;
5771
+ this.b = cos * rb - sin * this.d;
5772
+ this.c = sin * ra + cos * this.c;
5773
+ this.d = sin * rb + cos * this.d;
5633
5774
  }
5634
5775
  };
5635
5776
 
@@ -5644,12 +5785,14 @@ var spine = (() => {
5644
5785
 
5645
5786
  // spine-core/src/AssetManagerBase.ts
5646
5787
  var AssetManagerBase = class {
5788
+ pathPrefix = "";
5789
+ textureLoader;
5790
+ downloader;
5791
+ assets = {};
5792
+ errors = {};
5793
+ toLoad = 0;
5794
+ loaded = 0;
5647
5795
  constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
5648
- this.pathPrefix = "";
5649
- this.assets = {};
5650
- this.errors = {};
5651
- this.toLoad = 0;
5652
- this.loaded = 0;
5653
5796
  this.textureLoader = textureLoader;
5654
5797
  this.pathPrefix = pathPrefix;
5655
5798
  this.downloader = downloader;
@@ -5834,10 +5977,8 @@ var spine = (() => {
5834
5977
  }
5835
5978
  };
5836
5979
  var Downloader = class {
5837
- constructor() {
5838
- this.callbacks = {};
5839
- this.rawDataUris = {};
5840
- }
5980
+ callbacks = {};
5981
+ rawDataUris = {};
5841
5982
  dataUriToString(dataUri) {
5842
5983
  if (!dataUri.startsWith("data:")) {
5843
5984
  throw new Error("Not a data URI.");
@@ -5944,13 +6085,14 @@ var spine = (() => {
5944
6085
 
5945
6086
  // spine-core/src/Event.ts
5946
6087
  var Event = class {
6088
+ data;
6089
+ intValue = 0;
6090
+ floatValue = 0;
6091
+ stringValue = null;
6092
+ time = 0;
6093
+ volume = 0;
6094
+ balance = 0;
5947
6095
  constructor(time, data) {
5948
- this.intValue = 0;
5949
- this.floatValue = 0;
5950
- this.stringValue = null;
5951
- this.time = 0;
5952
- this.volume = 0;
5953
- this.balance = 0;
5954
6096
  if (!data)
5955
6097
  throw new Error("data cannot be null.");
5956
6098
  this.time = time;
@@ -5960,32 +6102,39 @@ var spine = (() => {
5960
6102
 
5961
6103
  // spine-core/src/EventData.ts
5962
6104
  var EventData = class {
6105
+ name;
6106
+ intValue = 0;
6107
+ floatValue = 0;
6108
+ stringValue = null;
6109
+ audioPath = null;
6110
+ volume = 0;
6111
+ balance = 0;
5963
6112
  constructor(name) {
5964
- this.intValue = 0;
5965
- this.floatValue = 0;
5966
- this.stringValue = null;
5967
- this.audioPath = null;
5968
- this.volume = 0;
5969
- this.balance = 0;
5970
6113
  this.name = name;
5971
6114
  }
5972
6115
  };
5973
6116
 
5974
6117
  // spine-core/src/IkConstraint.ts
5975
6118
  var IkConstraint = class {
6119
+ /** The IK constraint's setup pose data. */
6120
+ data;
6121
+ /** The bones that will be modified by this IK constraint. */
6122
+ bones;
6123
+ /** The bone that is the IK target. */
6124
+ target;
6125
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
6126
+ bendDirection = 0;
6127
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6128
+ compress = false;
6129
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6130
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
6131
+ stretch = false;
6132
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6133
+ mix = 1;
6134
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6135
+ softness = 0;
6136
+ active = false;
5976
6137
  constructor(data, skeleton) {
5977
- /** Controls the bend direction of the IK bones, either 1 or -1. */
5978
- this.bendDirection = 0;
5979
- /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
5980
- this.compress = false;
5981
- /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
5982
- * and the parent bone has local nonuniform scale, stretch is not applied. */
5983
- this.stretch = false;
5984
- /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
5985
- this.mix = 1;
5986
- /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
5987
- this.softness = 0;
5988
- this.active = false;
5989
6138
  if (!data)
5990
6139
  throw new Error("data cannot be null.");
5991
6140
  if (!skeleton)
@@ -6011,7 +6160,15 @@ var spine = (() => {
6011
6160
  isActive() {
6012
6161
  return this.active;
6013
6162
  }
6014
- update() {
6163
+ setToSetupPose() {
6164
+ const data = this.data;
6165
+ this.mix = data.mix;
6166
+ this.softness = data.softness;
6167
+ this.bendDirection = data.bendDirection;
6168
+ this.compress = data.compress;
6169
+ this.stretch = data.stretch;
6170
+ }
6171
+ update(physics) {
6015
6172
  if (this.mix == 0)
6016
6173
  return;
6017
6174
  let target = this.target;
@@ -6070,12 +6227,15 @@ var spine = (() => {
6070
6227
  tx = targetX - bone.worldX;
6071
6228
  ty = targetY - bone.worldY;
6072
6229
  }
6073
- let b = bone.data.length * sx, dd = Math.sqrt(tx * tx + ty * ty);
6074
- if (compress && dd < b || stretch && dd > b && b > 1e-4) {
6075
- let s = (dd / b - 1) * alpha + 1;
6076
- sx *= s;
6077
- if (uniform)
6078
- sy *= s;
6230
+ const b = bone.data.length * sx;
6231
+ if (b > 1e-4) {
6232
+ const dd = tx * tx + ty * ty;
6233
+ if (compress && dd < b * b || stretch && dd > b * b) {
6234
+ const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
6235
+ sx *= s;
6236
+ if (uniform)
6237
+ sy *= s;
6238
+ }
6079
6239
  }
6080
6240
  }
6081
6241
  bone.updateWorldTransformWith(
@@ -6243,27 +6403,10 @@ var spine = (() => {
6243
6403
 
6244
6404
  // spine-core/src/IkConstraintData.ts
6245
6405
  var IkConstraintData = class extends ConstraintData {
6246
- constructor(name) {
6247
- super(name, 0, false);
6248
- /** The bones that are constrained by this IK constraint. */
6249
- this.bones = new Array();
6250
- /** The bone that is the IK target. */
6251
- this._target = null;
6252
- /** Controls the bend direction of the IK bones, either 1 or -1. */
6253
- this.bendDirection = 1;
6254
- /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6255
- this.compress = false;
6256
- /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6257
- * and the parent bone has local nonuniform scale, stretch is not applied. */
6258
- this.stretch = false;
6259
- /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6260
- * is scaled on both the X and Y axes. */
6261
- this.uniform = false;
6262
- /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6263
- this.mix = 1;
6264
- /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6265
- this.softness = 0;
6266
- }
6406
+ /** The bones that are constrained by this IK constraint. */
6407
+ bones = new Array();
6408
+ /** The bone that is the IK target. */
6409
+ _target = null;
6267
6410
  set target(boneData) {
6268
6411
  this._target = boneData;
6269
6412
  }
@@ -6273,32 +6416,31 @@ var spine = (() => {
6273
6416
  else
6274
6417
  return this._target;
6275
6418
  }
6419
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
6420
+ bendDirection = 1;
6421
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6422
+ compress = false;
6423
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6424
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
6425
+ stretch = false;
6426
+ /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6427
+ * is scaled on both the X and Y axes. */
6428
+ uniform = false;
6429
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6430
+ mix = 1;
6431
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6432
+ softness = 0;
6433
+ constructor(name) {
6434
+ super(name, 0, false);
6435
+ }
6276
6436
  };
6277
6437
 
6278
6438
  // spine-core/src/PathConstraintData.ts
6279
6439
  var PathConstraintData = class extends ConstraintData {
6280
- constructor(name) {
6281
- super(name, 0, false);
6282
- /** The bones that will be modified by this path constraint. */
6283
- this.bones = new Array();
6284
- /** The slot whose path attachment will be used to constrained the bones. */
6285
- this._target = null;
6286
- /** The mode for positioning the first bone on the path. */
6287
- this.positionMode = PositionMode.Fixed;
6288
- /** The mode for positioning the bones after the first bone on the path. */
6289
- this.spacingMode = SpacingMode.Fixed;
6290
- /** The mode for adjusting the rotation of the bones. */
6291
- this.rotateMode = RotateMode.Chain;
6292
- /** An offset added to the constrained bone rotation. */
6293
- this.offsetRotation = 0;
6294
- /** The position along the path. */
6295
- this.position = 0;
6296
- /** The spacing between bones. */
6297
- this.spacing = 0;
6298
- this.mixRotate = 0;
6299
- this.mixX = 0;
6300
- this.mixY = 0;
6301
- }
6440
+ /** The bones that will be modified by this path constraint. */
6441
+ bones = new Array();
6442
+ /** The slot whose path attachment will be used to constrained the bones. */
6443
+ _target = null;
6302
6444
  set target(slotData) {
6303
6445
  this._target = slotData;
6304
6446
  }
@@ -6308,6 +6450,24 @@ var spine = (() => {
6308
6450
  else
6309
6451
  return this._target;
6310
6452
  }
6453
+ /** The mode for positioning the first bone on the path. */
6454
+ positionMode = PositionMode.Fixed;
6455
+ /** The mode for positioning the bones after the first bone on the path. */
6456
+ spacingMode = SpacingMode.Fixed;
6457
+ /** The mode for adjusting the rotation of the bones. */
6458
+ rotateMode = RotateMode.Chain;
6459
+ /** An offset added to the constrained bone rotation. */
6460
+ offsetRotation = 0;
6461
+ /** The position along the path. */
6462
+ position = 0;
6463
+ /** The spacing between bones. */
6464
+ spacing = 0;
6465
+ mixRotate = 0;
6466
+ mixX = 0;
6467
+ mixY = 0;
6468
+ constructor(name) {
6469
+ super(name, 0, false);
6470
+ }
6311
6471
  };
6312
6472
  var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
6313
6473
  PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
@@ -6330,21 +6490,27 @@ var spine = (() => {
6330
6490
 
6331
6491
  // spine-core/src/PathConstraint.ts
6332
6492
  var _PathConstraint = class {
6493
+ /** The path constraint's setup pose data. */
6494
+ data;
6495
+ /** The bones that will be modified by this path constraint. */
6496
+ bones;
6497
+ /** The slot whose path attachment will be used to constrained the bones. */
6498
+ target;
6499
+ /** The position along the path. */
6500
+ position = 0;
6501
+ /** The spacing between bones. */
6502
+ spacing = 0;
6503
+ mixRotate = 0;
6504
+ mixX = 0;
6505
+ mixY = 0;
6506
+ spaces = new Array();
6507
+ positions = new Array();
6508
+ world = new Array();
6509
+ curves = new Array();
6510
+ lengths = new Array();
6511
+ segments = new Array();
6512
+ active = false;
6333
6513
  constructor(data, skeleton) {
6334
- /** The position along the path. */
6335
- this.position = 0;
6336
- /** The spacing between bones. */
6337
- this.spacing = 0;
6338
- this.mixRotate = 0;
6339
- this.mixX = 0;
6340
- this.mixY = 0;
6341
- this.spaces = new Array();
6342
- this.positions = new Array();
6343
- this.world = new Array();
6344
- this.curves = new Array();
6345
- this.lengths = new Array();
6346
- this.segments = new Array();
6347
- this.active = false;
6348
6514
  if (!data)
6349
6515
  throw new Error("data cannot be null.");
6350
6516
  if (!skeleton)
@@ -6370,7 +6536,15 @@ var spine = (() => {
6370
6536
  isActive() {
6371
6537
  return this.active;
6372
6538
  }
6373
- update() {
6539
+ setToSetupPose() {
6540
+ const data = this.data;
6541
+ this.position = data.position;
6542
+ this.spacing = data.spacing;
6543
+ this.mixRotate = data.mixRotate;
6544
+ this.mixX = data.mixX;
6545
+ this.mixY = data.mixY;
6546
+ }
6547
+ update(physics) {
6374
6548
  let attachment = this.target.getAttachment();
6375
6549
  if (!(attachment instanceof PathAttachment))
6376
6550
  return;
@@ -6389,12 +6563,8 @@ var spine = (() => {
6389
6563
  for (let i = 0, n = spacesCount - 1; i < n; i++) {
6390
6564
  let bone = bones[i];
6391
6565
  let setupLength = bone.data.length;
6392
- if (setupLength < _PathConstraint.epsilon)
6393
- lengths[i] = 0;
6394
- else {
6395
- let x = setupLength * bone.a, y = setupLength * bone.c;
6396
- lengths[i] = Math.sqrt(x * x + y * y);
6397
- }
6566
+ let x = setupLength * bone.a, y = setupLength * bone.c;
6567
+ lengths[i] = Math.sqrt(x * x + y * y);
6398
6568
  }
6399
6569
  }
6400
6570
  Utils.arrayFill(spaces, 1, spacesCount, spacing);
@@ -6764,27 +6934,266 @@ var spine = (() => {
6764
6934
  }
6765
6935
  };
6766
6936
  var PathConstraint = _PathConstraint;
6767
- PathConstraint.NONE = -1;
6768
- PathConstraint.BEFORE = -2;
6769
- PathConstraint.AFTER = -3;
6770
- PathConstraint.epsilon = 1e-5;
6937
+ __publicField(PathConstraint, "NONE", -1);
6938
+ __publicField(PathConstraint, "BEFORE", -2);
6939
+ __publicField(PathConstraint, "AFTER", -3);
6940
+ __publicField(PathConstraint, "epsilon", 1e-5);
6941
+
6942
+ // spine-core/src/PhysicsConstraint.ts
6943
+ var PhysicsConstraint = class {
6944
+ data;
6945
+ _bone = null;
6946
+ /** The bone constrained by this physics constraint. */
6947
+ set bone(bone) {
6948
+ this._bone = bone;
6949
+ }
6950
+ get bone() {
6951
+ if (!this._bone)
6952
+ throw new Error("Bone not set.");
6953
+ else
6954
+ return this._bone;
6955
+ }
6956
+ inertia = 0;
6957
+ strength = 0;
6958
+ damping = 0;
6959
+ massInverse = 0;
6960
+ wind = 0;
6961
+ gravity = 0;
6962
+ mix = 0;
6963
+ _reset = true;
6964
+ ux = 0;
6965
+ uy = 0;
6966
+ cx = 0;
6967
+ cy = 0;
6968
+ tx = 0;
6969
+ ty = 0;
6970
+ xOffset = 0;
6971
+ xVelocity = 0;
6972
+ yOffset = 0;
6973
+ yVelocity = 0;
6974
+ rotateOffset = 0;
6975
+ rotateVelocity = 0;
6976
+ scaleOffset = 0;
6977
+ scaleVelocity = 0;
6978
+ active = false;
6979
+ skeleton;
6980
+ remaining = 0;
6981
+ lastTime = 0;
6982
+ constructor(data, skeleton) {
6983
+ this.data = data;
6984
+ this.skeleton = skeleton;
6985
+ this.bone = skeleton.bones[data.bone.index];
6986
+ this.inertia = data.inertia;
6987
+ this.strength = data.strength;
6988
+ this.damping = data.damping;
6989
+ this.massInverse = data.massInverse;
6990
+ this.wind = data.wind;
6991
+ this.gravity = data.gravity;
6992
+ this.mix = data.mix;
6993
+ }
6994
+ reset() {
6995
+ this.remaining = 0;
6996
+ this.lastTime = this.skeleton.time;
6997
+ this._reset = true;
6998
+ this.xOffset = 0;
6999
+ this.xVelocity = 0;
7000
+ this.yOffset = 0;
7001
+ this.yVelocity = 0;
7002
+ this.rotateOffset = 0;
7003
+ this.rotateVelocity = 0;
7004
+ this.scaleOffset = 0;
7005
+ this.scaleVelocity = 0;
7006
+ }
7007
+ setToSetupPose() {
7008
+ const data = this.data;
7009
+ this.inertia = data.inertia;
7010
+ this.strength = data.strength;
7011
+ this.damping = data.damping;
7012
+ this.massInverse = data.massInverse;
7013
+ this.wind = data.wind;
7014
+ this.gravity = data.gravity;
7015
+ this.mix = data.mix;
7016
+ }
7017
+ isActive() {
7018
+ return this.active;
7019
+ }
7020
+ /** Applies the constraint to the constrained bones. */
7021
+ update(physics) {
7022
+ const mix = this.mix;
7023
+ if (mix == 0)
7024
+ return;
7025
+ const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
7026
+ const bone = this.bone;
7027
+ const l = bone.data.length;
7028
+ switch (physics) {
7029
+ case 0 /* none */:
7030
+ return;
7031
+ case 1 /* reset */:
7032
+ this.reset();
7033
+ case 2 /* update */:
7034
+ this.remaining += Math.max(this.skeleton.time - this.lastTime, 0);
7035
+ this.lastTime = this.skeleton.time;
7036
+ const bx = bone.worldX, by = bone.worldY;
7037
+ if (this._reset) {
7038
+ this._reset = false;
7039
+ this.ux = bx;
7040
+ this.uy = by;
7041
+ } else {
7042
+ let remaining = this.remaining, i = this.inertia, step = this.data.step;
7043
+ if (x || y) {
7044
+ if (x) {
7045
+ this.xOffset += (this.ux - bx) * i;
7046
+ this.ux = bx;
7047
+ }
7048
+ if (y) {
7049
+ this.yOffset += (this.uy - by) * i;
7050
+ this.uy = by;
7051
+ }
7052
+ if (remaining >= step) {
7053
+ const m = this.massInverse * step, e = this.strength, w = this.wind * 100, g = this.gravity * -100;
7054
+ const d = Math.pow(this.damping, 60 * step);
7055
+ do {
7056
+ if (x) {
7057
+ this.xVelocity += (w - this.xOffset * e) * m;
7058
+ this.xOffset += this.xVelocity * step;
7059
+ this.xVelocity *= d;
7060
+ }
7061
+ if (y) {
7062
+ this.yVelocity += (g - this.yOffset * e) * m;
7063
+ this.yOffset += this.yVelocity * step;
7064
+ this.yVelocity *= d;
7065
+ }
7066
+ remaining -= step;
7067
+ } while (remaining >= step);
7068
+ }
7069
+ if (x)
7070
+ bone.worldX += this.xOffset * mix * this.data.x;
7071
+ if (y)
7072
+ bone.worldY += this.yOffset * mix * this.data.y;
7073
+ }
7074
+ if (rotateOrShearX || scaleX) {
7075
+ let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
7076
+ if (rotateOrShearX) {
7077
+ mr = mix * this.data.rotate;
7078
+ let dx = this.cx - bone.worldX, dy = this.cy - bone.worldY, r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
7079
+ this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
7080
+ r = this.rotateOffset * mr + ca;
7081
+ c = Math.cos(r);
7082
+ s = Math.sin(r);
7083
+ if (scaleX) {
7084
+ r = l * bone.getWorldScaleX();
7085
+ if (r > 0)
7086
+ this.scaleOffset += (dx * c + dy * s) * i / r;
7087
+ }
7088
+ } else {
7089
+ c = Math.cos(ca);
7090
+ s = Math.sin(ca);
7091
+ const r = l * bone.getWorldScaleX();
7092
+ if (r > 0)
7093
+ this.scaleOffset += ((this.cx - bone.worldX) * c + (this.cy - bone.worldY) * s) * i / r;
7094
+ }
7095
+ remaining = this.remaining;
7096
+ if (remaining >= step) {
7097
+ const m = this.massInverse * step, e = this.strength, w = this.wind, g = this.gravity;
7098
+ const d = Math.pow(this.damping, 60 * step);
7099
+ while (true) {
7100
+ remaining -= step;
7101
+ if (scaleX) {
7102
+ this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
7103
+ this.scaleOffset += this.scaleVelocity * step;
7104
+ this.scaleVelocity *= d;
7105
+ }
7106
+ if (rotateOrShearX) {
7107
+ this.rotateVelocity += (-0.01 * l * (w * s + g * c) - this.rotateOffset * e) * m;
7108
+ this.rotateOffset += this.rotateVelocity * step;
7109
+ this.rotateVelocity *= d;
7110
+ if (remaining < step)
7111
+ break;
7112
+ const r = this.rotateOffset * mr + ca;
7113
+ c = Math.cos(r);
7114
+ s = Math.sin(r);
7115
+ } else if (remaining < step)
7116
+ break;
7117
+ }
7118
+ }
7119
+ }
7120
+ this.remaining = remaining;
7121
+ }
7122
+ this.cx = bone.worldX;
7123
+ this.cy = bone.worldY;
7124
+ break;
7125
+ case 3 /* pose */:
7126
+ if (x)
7127
+ bone.worldX += this.xOffset * mix * this.data.x;
7128
+ if (y)
7129
+ bone.worldY += this.yOffset * mix * this.data.y;
7130
+ }
7131
+ if (rotateOrShearX) {
7132
+ let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
7133
+ if (this.data.shearX > 0) {
7134
+ let r = 0;
7135
+ if (this.data.rotate > 0) {
7136
+ r = o * this.data.rotate;
7137
+ s = Math.sin(r);
7138
+ c = Math.cos(r);
7139
+ a = bone.b;
7140
+ bone.b = c * a - s * bone.d;
7141
+ bone.d = s * a + c * bone.d;
7142
+ }
7143
+ r += o * this.data.shearX;
7144
+ s = Math.sin(r);
7145
+ c = Math.cos(r);
7146
+ a = bone.a;
7147
+ bone.a = c * a - s * bone.c;
7148
+ bone.c = s * a + c * bone.c;
7149
+ } else {
7150
+ o *= this.data.rotate;
7151
+ s = Math.sin(o);
7152
+ c = Math.cos(o);
7153
+ a = bone.a;
7154
+ bone.a = c * a - s * bone.c;
7155
+ bone.c = s * a + c * bone.c;
7156
+ a = bone.b;
7157
+ bone.b = c * a - s * bone.d;
7158
+ bone.d = s * a + c * bone.d;
7159
+ }
7160
+ }
7161
+ if (scaleX) {
7162
+ const s = 1 + this.scaleOffset * mix * this.data.scaleX;
7163
+ bone.a *= s;
7164
+ bone.c *= s;
7165
+ }
7166
+ if (physics != 3 /* pose */) {
7167
+ this.tx = l * bone.a;
7168
+ this.ty = l * bone.c;
7169
+ }
7170
+ bone.updateAppliedTransform();
7171
+ }
7172
+ };
6771
7173
 
6772
7174
  // spine-core/src/Slot.ts
6773
7175
  var Slot = class {
7176
+ /** The slot's setup pose data. */
7177
+ data;
7178
+ /** The bone this slot belongs to. */
7179
+ bone;
7180
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7181
+ * color tinting. */
7182
+ color;
7183
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
7184
+ * color's alpha is not used. */
7185
+ darkColor = null;
7186
+ attachment = null;
7187
+ attachmentState = 0;
7188
+ /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
7189
+ * {@link Sequence#getSetupIndex()}. */
7190
+ sequenceIndex = -1;
7191
+ /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
7192
+ * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
7193
+ *
7194
+ * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
7195
+ deform = new Array();
6774
7196
  constructor(data, bone) {
6775
- /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
6776
- * color's alpha is not used. */
6777
- this.darkColor = null;
6778
- this.attachment = null;
6779
- this.attachmentState = 0;
6780
- /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
6781
- * {@link Sequence#getSetupIndex()}. */
6782
- this.sequenceIndex = -1;
6783
- /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
6784
- * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
6785
- *
6786
- * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
6787
- this.deform = new Array();
6788
7197
  if (!data)
6789
7198
  throw new Error("data cannot be null.");
6790
7199
  if (!bone)
@@ -6831,15 +7240,21 @@ var spine = (() => {
6831
7240
 
6832
7241
  // spine-core/src/TransformConstraint.ts
6833
7242
  var TransformConstraint = class {
7243
+ /** The transform constraint's setup pose data. */
7244
+ data;
7245
+ /** The bones that will be modified by this transform constraint. */
7246
+ bones;
7247
+ /** The target bone whose world transform will be copied to the constrained bones. */
7248
+ target;
7249
+ mixRotate = 0;
7250
+ mixX = 0;
7251
+ mixY = 0;
7252
+ mixScaleX = 0;
7253
+ mixScaleY = 0;
7254
+ mixShearY = 0;
7255
+ temp = new Vector2();
7256
+ active = false;
6834
7257
  constructor(data, skeleton) {
6835
- this.mixRotate = 0;
6836
- this.mixX = 0;
6837
- this.mixY = 0;
6838
- this.mixScaleX = 0;
6839
- this.mixScaleY = 0;
6840
- this.mixShearY = 0;
6841
- this.temp = new Vector2();
6842
- this.active = false;
6843
7258
  if (!data)
6844
7259
  throw new Error("data cannot be null.");
6845
7260
  if (!skeleton)
@@ -6866,7 +7281,16 @@ var spine = (() => {
6866
7281
  isActive() {
6867
7282
  return this.active;
6868
7283
  }
6869
- update() {
7284
+ setToSetupPose() {
7285
+ const data = this.data;
7286
+ this.mixRotate = data.mixRotate;
7287
+ this.mixX = data.mixX;
7288
+ this.mixY = data.mixY;
7289
+ this.mixScaleX = data.mixScaleX;
7290
+ this.mixScaleY = data.mixScaleY;
7291
+ this.mixShearY = data.mixShearY;
7292
+ }
7293
+ update(physics) {
6870
7294
  if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
6871
7295
  return;
6872
7296
  if (this.data.local) {
@@ -7006,7 +7430,7 @@ var spine = (() => {
7006
7430
  let rotation = bone.arotation;
7007
7431
  if (mixRotate != 0) {
7008
7432
  let r = target.arotation - rotation + this.data.offsetRotation;
7009
- r -= (16384 - (16384.499999999996 - r / 360 | 0)) * 360;
7433
+ r -= Math.ceil(r / 360 - 0.5) * 360;
7010
7434
  rotation += r * mixRotate;
7011
7435
  }
7012
7436
  let x = bone.ax, y = bone.ay;
@@ -7020,7 +7444,7 @@ var spine = (() => {
7020
7444
  let shearY = bone.ashearY;
7021
7445
  if (mixShearY != 0) {
7022
7446
  let r = target.ashearY - shearY + this.data.offsetShearY;
7023
- r -= (16384 - (16384.499999999996 - r / 360 | 0)) * 360;
7447
+ r -= Math.ceil(r / 360 - 0.5) * 360;
7024
7448
  shearY += r * mixShearY;
7025
7449
  }
7026
7450
  bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
@@ -7045,21 +7469,49 @@ var spine = (() => {
7045
7469
 
7046
7470
  // spine-core/src/Skeleton.ts
7047
7471
  var _Skeleton = class {
7472
+ /** The skeleton's setup pose data. */
7473
+ data;
7474
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
7475
+ bones;
7476
+ /** The skeleton's slots. */
7477
+ slots;
7478
+ /** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
7479
+ drawOrder;
7480
+ /** The skeleton's IK constraints. */
7481
+ ikConstraints;
7482
+ /** The skeleton's transform constraints. */
7483
+ transformConstraints;
7484
+ /** The skeleton's path constraints. */
7485
+ pathConstraints;
7486
+ /** The skeleton's physics constraints. */
7487
+ physicsConstraints;
7488
+ /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
7489
+ _updateCache = new Array();
7490
+ /** The skeleton's current skin. May be null. */
7491
+ skin = null;
7492
+ /** The color to tint all the skeleton's attachments. */
7493
+ color;
7494
+ /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7495
+ * inheritance. */
7496
+ scaleX = 1;
7497
+ /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7498
+ * inheritance. */
7499
+ _scaleY = 1;
7500
+ get scaleY() {
7501
+ return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7502
+ }
7503
+ set scaleY(scaleY) {
7504
+ this._scaleY = scaleY;
7505
+ }
7506
+ /** Sets the skeleton X position, which is added to the root bone worldX position. */
7507
+ x = 0;
7508
+ /** Sets the skeleton Y position, which is added to the root bone worldY position. */
7509
+ y = 0;
7510
+ /** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
7511
+ * <p>
7512
+ * See {@link #update(float)}. */
7513
+ time = 0;
7048
7514
  constructor(data) {
7049
- /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
7050
- this._updateCache = new Array();
7051
- /** The skeleton's current skin. May be null. */
7052
- this.skin = null;
7053
- /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7054
- * inheritance. */
7055
- this.scaleX = 1;
7056
- /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7057
- * inheritance. */
7058
- this._scaleY = 1;
7059
- /** Sets the skeleton X position, which is added to the root bone worldX position. */
7060
- this.x = 0;
7061
- /** Sets the skeleton Y position, which is added to the root bone worldY position. */
7062
- this.y = 0;
7063
7515
  if (!data)
7064
7516
  throw new Error("data cannot be null.");
7065
7517
  this.data = data;
@@ -7100,15 +7552,14 @@ var spine = (() => {
7100
7552
  let pathConstraintData = data.pathConstraints[i];
7101
7553
  this.pathConstraints.push(new PathConstraint(pathConstraintData, this));
7102
7554
  }
7555
+ this.physicsConstraints = new Array();
7556
+ for (let i = 0; i < data.physicsConstraints.length; i++) {
7557
+ let physicsConstraintData = data.physicsConstraints[i];
7558
+ this.physicsConstraints.push(new PhysicsConstraint(physicsConstraintData, this));
7559
+ }
7103
7560
  this.color = new Color(1, 1, 1, 1);
7104
7561
  this.updateCache();
7105
7562
  }
7106
- get scaleY() {
7107
- return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7108
- }
7109
- set scaleY(scaleY) {
7110
- this._scaleY = scaleY;
7111
- }
7112
7563
  /** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
7113
7564
  * constraints, or weighted path attachments are added or removed. */
7114
7565
  updateCache() {
@@ -7134,8 +7585,9 @@ var spine = (() => {
7134
7585
  let ikConstraints = this.ikConstraints;
7135
7586
  let transformConstraints = this.transformConstraints;
7136
7587
  let pathConstraints = this.pathConstraints;
7137
- let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length;
7138
- let constraintCount = ikCount + transformCount + pathCount;
7588
+ let physicsConstraints = this.physicsConstraints;
7589
+ let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length, physicsCount = this.physicsConstraints.length;
7590
+ let constraintCount = ikCount + transformCount + pathCount + physicsCount;
7139
7591
  outer:
7140
7592
  for (let i = 0; i < constraintCount; i++) {
7141
7593
  for (let ii = 0; ii < ikCount; ii++) {
@@ -7159,6 +7611,13 @@ var spine = (() => {
7159
7611
  continue outer;
7160
7612
  }
7161
7613
  }
7614
+ for (let ii = 0; ii < physicsCount; ii++) {
7615
+ const constraint = physicsConstraints[ii];
7616
+ if (constraint.data.order == i) {
7617
+ this.sortPhysicsConstraint(constraint);
7618
+ continue outer;
7619
+ }
7620
+ }
7162
7621
  }
7163
7622
  for (let i = 0, n = bones.length; i < n; i++)
7164
7623
  this.sortBone(bones[i]);
@@ -7257,6 +7716,16 @@ var spine = (() => {
7257
7716
  }
7258
7717
  }
7259
7718
  }
7719
+ sortPhysicsConstraint(constraint) {
7720
+ const bone = constraint.bone;
7721
+ constraint.active = bone.active && !constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true);
7722
+ if (!constraint.active)
7723
+ return;
7724
+ this.sortBone(bone);
7725
+ this._updateCache.push(constraint);
7726
+ this.sortReset(bone.children);
7727
+ bone.sorted = true;
7728
+ }
7260
7729
  sortBone(bone) {
7261
7730
  if (!bone)
7262
7731
  return;
@@ -7282,7 +7751,9 @@ var spine = (() => {
7282
7751
  *
7283
7752
  * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7284
7753
  * Runtimes Guide. */
7285
- updateWorldTransform() {
7754
+ updateWorldTransform(physics) {
7755
+ if (!physics)
7756
+ throw new Error("physics is undefined");
7286
7757
  let bones = this.bones;
7287
7758
  for (let i = 0, n = bones.length; i < n; i++) {
7288
7759
  let bone = bones[i];
@@ -7296,20 +7767,21 @@ var spine = (() => {
7296
7767
  }
7297
7768
  let updateCache = this._updateCache;
7298
7769
  for (let i = 0, n = updateCache.length; i < n; i++)
7299
- updateCache[i].update();
7770
+ updateCache[i].update(physics);
7300
7771
  }
7301
- updateWorldTransformWith(parent) {
7772
+ updateWorldTransformWith(physics, parent) {
7302
7773
  let rootBone = this.getRootBone();
7303
7774
  if (!rootBone)
7304
7775
  throw new Error("Root bone must not be null.");
7305
7776
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
7306
7777
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
7307
7778
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
7308
- let rotationY = rootBone.rotation + 90 + rootBone.shearY;
7309
- let la = MathUtils.cosDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
7310
- let lb = MathUtils.cosDeg(rotationY) * rootBone.scaleY;
7311
- let lc = MathUtils.sinDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
7312
- let ld = MathUtils.sinDeg(rotationY) * rootBone.scaleY;
7779
+ const rx = (rootBone.rotation + rootBone.shearX) * MathUtils.degRad;
7780
+ const ry = (rootBone.rotation + 90 + rootBone.shearY) * MathUtils.degRad;
7781
+ const la = Math.cos(rx) * rootBone.scaleX;
7782
+ const lb = Math.cos(ry) * rootBone.scaleY;
7783
+ const lc = Math.sin(rx) * rootBone.scaleX;
7784
+ const ld = Math.sin(ry) * rootBone.scaleY;
7313
7785
  rootBone.a = (pa * la + pb * lc) * this.scaleX;
7314
7786
  rootBone.b = (pa * lb + pb * ld) * this.scaleX;
7315
7787
  rootBone.c = (pc * la + pd * lc) * this.scaleY;
@@ -7318,7 +7790,7 @@ var spine = (() => {
7318
7790
  for (let i = 0, n = updateCache.length; i < n; i++) {
7319
7791
  let updatable = updateCache[i];
7320
7792
  if (updatable != rootBone)
7321
- updatable.update();
7793
+ updatable.update(physics);
7322
7794
  }
7323
7795
  }
7324
7796
  /** Sets the bones, constraints, and slots to their setup pose values. */
@@ -7328,39 +7800,16 @@ var spine = (() => {
7328
7800
  }
7329
7801
  /** Sets the bones and constraints to their setup pose values. */
7330
7802
  setBonesToSetupPose() {
7331
- let bones = this.bones;
7332
- for (let i = 0, n = bones.length; i < n; i++)
7333
- bones[i].setToSetupPose();
7334
- let ikConstraints = this.ikConstraints;
7335
- for (let i = 0, n = ikConstraints.length; i < n; i++) {
7336
- let constraint = ikConstraints[i];
7337
- constraint.mix = constraint.data.mix;
7338
- constraint.softness = constraint.data.softness;
7339
- constraint.bendDirection = constraint.data.bendDirection;
7340
- constraint.compress = constraint.data.compress;
7341
- constraint.stretch = constraint.data.stretch;
7342
- }
7343
- let transformConstraints = this.transformConstraints;
7344
- for (let i = 0, n = transformConstraints.length; i < n; i++) {
7345
- let constraint = transformConstraints[i];
7346
- let data = constraint.data;
7347
- constraint.mixRotate = data.mixRotate;
7348
- constraint.mixX = data.mixX;
7349
- constraint.mixY = data.mixY;
7350
- constraint.mixScaleX = data.mixScaleX;
7351
- constraint.mixScaleY = data.mixScaleY;
7352
- constraint.mixShearY = data.mixShearY;
7353
- }
7354
- let pathConstraints = this.pathConstraints;
7355
- for (let i = 0, n = pathConstraints.length; i < n; i++) {
7356
- let constraint = pathConstraints[i];
7357
- let data = constraint.data;
7358
- constraint.position = data.position;
7359
- constraint.spacing = data.spacing;
7360
- constraint.mixRotate = data.mixRotate;
7361
- constraint.mixX = data.mixX;
7362
- constraint.mixY = data.mixY;
7363
- }
7803
+ for (const bone of this.bones)
7804
+ bone.setToSetupPose();
7805
+ for (const constraint of this.ikConstraints)
7806
+ constraint.setToSetupPose();
7807
+ for (const constraint of this.transformConstraints)
7808
+ constraint.setToSetupPose();
7809
+ for (const constraint of this.pathConstraints)
7810
+ constraint.setToSetupPose();
7811
+ for (const constraint of this.physicsConstraints)
7812
+ constraint.setToSetupPose();
7364
7813
  }
7365
7814
  /** Sets the slots and draw order to their setup pose values. */
7366
7815
  setSlotsToSetupPose() {
@@ -7498,13 +7947,7 @@ var spine = (() => {
7498
7947
  findIkConstraint(constraintName) {
7499
7948
  if (!constraintName)
7500
7949
  throw new Error("constraintName cannot be null.");
7501
- let ikConstraints = this.ikConstraints;
7502
- for (let i = 0, n = ikConstraints.length; i < n; i++) {
7503
- let ikConstraint = ikConstraints[i];
7504
- if (ikConstraint.data.name == constraintName)
7505
- return ikConstraint;
7506
- }
7507
- return null;
7950
+ return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7508
7951
  }
7509
7952
  /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7510
7953
  * this method than to call it repeatedly.
@@ -7512,13 +7955,7 @@ var spine = (() => {
7512
7955
  findTransformConstraint(constraintName) {
7513
7956
  if (!constraintName)
7514
7957
  throw new Error("constraintName cannot be null.");
7515
- let transformConstraints = this.transformConstraints;
7516
- for (let i = 0, n = transformConstraints.length; i < n; i++) {
7517
- let constraint = transformConstraints[i];
7518
- if (constraint.data.name == constraintName)
7519
- return constraint;
7520
- }
7521
- return null;
7958
+ return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7522
7959
  }
7523
7960
  /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7524
7961
  * than to call it repeatedly.
@@ -7526,13 +7963,14 @@ var spine = (() => {
7526
7963
  findPathConstraint(constraintName) {
7527
7964
  if (!constraintName)
7528
7965
  throw new Error("constraintName cannot be null.");
7529
- let pathConstraints = this.pathConstraints;
7530
- for (let i = 0, n = pathConstraints.length; i < n; i++) {
7531
- let constraint = pathConstraints[i];
7532
- if (constraint.data.name == constraintName)
7533
- return constraint;
7534
- }
7535
- return null;
7966
+ return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7967
+ }
7968
+ /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
7969
+ * method than to call it repeatedly. */
7970
+ findPhysicsConstraint(constraintName) {
7971
+ if (constraintName == null)
7972
+ throw new Error("constraintName cannot be null.");
7973
+ return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7536
7974
  }
7537
7975
  /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
7538
7976
  * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
@@ -7583,57 +8021,68 @@ var spine = (() => {
7583
8021
  offset.set(minX, minY);
7584
8022
  size.set(maxX - minX, maxY - minY);
7585
8023
  }
8024
+ /** Increments the skeleton's {@link #time}. */
8025
+ update(delta) {
8026
+ this.time += delta;
8027
+ }
7586
8028
  };
7587
- var Skeleton = _Skeleton;
7588
- Skeleton.yDown = false;
8029
+ var Skeleton2 = _Skeleton;
8030
+ __publicField(Skeleton2, "yDown", false);
8031
+ var Physics = /* @__PURE__ */ ((Physics2) => {
8032
+ Physics2[Physics2["none"] = 0] = "none";
8033
+ Physics2[Physics2["reset"] = 1] = "reset";
8034
+ Physics2[Physics2["update"] = 2] = "update";
8035
+ Physics2[Physics2["pose"] = 3] = "pose";
8036
+ return Physics2;
8037
+ })(Physics || {});
7589
8038
 
7590
8039
  // spine-core/src/SkeletonData.ts
7591
8040
  var SkeletonData = class {
7592
- constructor() {
7593
- /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
7594
- this.name = null;
7595
- /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
7596
- this.bones = new Array();
7597
- // Ordered parents first.
7598
- /** The skeleton's slots. */
7599
- this.slots = new Array();
7600
- // Setup pose draw order.
7601
- this.skins = new Array();
7602
- /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
7603
- *
7604
- * See {@link Skeleton#getAttachmentByName()}.
7605
- * May be null. */
7606
- this.defaultSkin = null;
7607
- /** The skeleton's events. */
7608
- this.events = new Array();
7609
- /** The skeleton's animations. */
7610
- this.animations = new Array();
7611
- /** The skeleton's IK constraints. */
7612
- this.ikConstraints = new Array();
7613
- /** The skeleton's transform constraints. */
7614
- this.transformConstraints = new Array();
7615
- /** The skeleton's path constraints. */
7616
- this.pathConstraints = new Array();
7617
- /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
7618
- this.x = 0;
7619
- /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
7620
- this.y = 0;
7621
- /** The width of the skeleton's axis aligned bounding box in the setup pose. */
7622
- this.width = 0;
7623
- /** The height of the skeleton's axis aligned bounding box in the setup pose. */
7624
- this.height = 0;
7625
- /** The Spine version used to export the skeleton data, or null. */
7626
- this.version = null;
7627
- /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
7628
- this.hash = null;
7629
- // Nonessential
7630
- /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
7631
- this.fps = 0;
7632
- /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
7633
- this.imagesPath = null;
7634
- /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
7635
- this.audioPath = null;
7636
- }
8041
+ /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
8042
+ name = null;
8043
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
8044
+ bones = new Array();
8045
+ // Ordered parents first.
8046
+ /** The skeleton's slots. */
8047
+ slots = new Array();
8048
+ // Setup pose draw order.
8049
+ skins = new Array();
8050
+ /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
8051
+ *
8052
+ * See {@link Skeleton#getAttachmentByName()}.
8053
+ * May be null. */
8054
+ defaultSkin = null;
8055
+ /** The skeleton's events. */
8056
+ events = new Array();
8057
+ /** The skeleton's animations. */
8058
+ animations = new Array();
8059
+ /** The skeleton's IK constraints. */
8060
+ ikConstraints = new Array();
8061
+ /** The skeleton's transform constraints. */
8062
+ transformConstraints = new Array();
8063
+ /** The skeleton's path constraints. */
8064
+ pathConstraints = new Array();
8065
+ /** The skeleton's physics constraints. */
8066
+ physicsConstraints = new Array();
8067
+ /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
8068
+ x = 0;
8069
+ /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
8070
+ y = 0;
8071
+ /** The width of the skeleton's axis aligned bounding box in the setup pose. */
8072
+ width = 0;
8073
+ /** The height of the skeleton's axis aligned bounding box in the setup pose. */
8074
+ height = 0;
8075
+ /** The Spine version used to export the skeleton data, or null. */
8076
+ version = null;
8077
+ /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
8078
+ hash = null;
8079
+ // Nonessential
8080
+ /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
8081
+ fps = 0;
8082
+ /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
8083
+ imagesPath = null;
8084
+ /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
8085
+ audioPath = null;
7637
8086
  /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
7638
8087
  * multiple times.
7639
8088
  * @returns May be null. */
@@ -7710,9 +8159,9 @@ var spine = (() => {
7710
8159
  findIkConstraint(constraintName) {
7711
8160
  if (!constraintName)
7712
8161
  throw new Error("constraintName cannot be null.");
7713
- let ikConstraints = this.ikConstraints;
8162
+ const ikConstraints = this.ikConstraints;
7714
8163
  for (let i = 0, n = ikConstraints.length; i < n; i++) {
7715
- let constraint = ikConstraints[i];
8164
+ const constraint = ikConstraints[i];
7716
8165
  if (constraint.name == constraintName)
7717
8166
  return constraint;
7718
8167
  }
@@ -7724,9 +8173,9 @@ var spine = (() => {
7724
8173
  findTransformConstraint(constraintName) {
7725
8174
  if (!constraintName)
7726
8175
  throw new Error("constraintName cannot be null.");
7727
- let transformConstraints = this.transformConstraints;
8176
+ const transformConstraints = this.transformConstraints;
7728
8177
  for (let i = 0, n = transformConstraints.length; i < n; i++) {
7729
- let constraint = transformConstraints[i];
8178
+ const constraint = transformConstraints[i];
7730
8179
  if (constraint.name == constraintName)
7731
8180
  return constraint;
7732
8181
  }
@@ -7738,9 +8187,23 @@ var spine = (() => {
7738
8187
  findPathConstraint(constraintName) {
7739
8188
  if (!constraintName)
7740
8189
  throw new Error("constraintName cannot be null.");
7741
- let pathConstraints = this.pathConstraints;
8190
+ const pathConstraints = this.pathConstraints;
7742
8191
  for (let i = 0, n = pathConstraints.length; i < n; i++) {
7743
- let constraint = pathConstraints[i];
8192
+ const constraint = pathConstraints[i];
8193
+ if (constraint.name == constraintName)
8194
+ return constraint;
8195
+ }
8196
+ return null;
8197
+ }
8198
+ /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
8199
+ * than to call it multiple times.
8200
+ * @return May be null. */
8201
+ findPhysicsConstraint(constraintName) {
8202
+ if (!constraintName)
8203
+ throw new Error("constraintName cannot be null.");
8204
+ const physicsConstraints = this.physicsConstraints;
8205
+ for (let i = 0, n = physicsConstraints.length; i < n; i++) {
8206
+ const constraint = physicsConstraints[i];
7744
8207
  if (constraint.name == constraintName)
7745
8208
  return constraint;
7746
8209
  }
@@ -7757,10 +8220,15 @@ var spine = (() => {
7757
8220
  }
7758
8221
  };
7759
8222
  var Skin = class {
8223
+ /** The skin's name, which is unique across all skins in the skeleton. */
8224
+ name;
8225
+ attachments = new Array();
8226
+ bones = Array();
8227
+ constraints = new Array();
8228
+ /** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
8229
+ color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
8230
+ // fe9e4fff
7760
8231
  constructor(name) {
7761
- this.attachments = new Array();
7762
- this.bones = Array();
7763
- this.constraints = new Array();
7764
8232
  if (!name)
7765
8233
  throw new Error("name cannot be null.");
7766
8234
  this.name = name;
@@ -7917,19 +8385,25 @@ var spine = (() => {
7917
8385
 
7918
8386
  // spine-core/src/SlotData.ts
7919
8387
  var SlotData = class {
8388
+ /** The index of the slot in {@link Skeleton#getSlots()}. */
8389
+ index = 0;
8390
+ /** The name of the slot, which is unique across all slots in the skeleton. */
8391
+ name;
8392
+ /** The bone this slot belongs to. */
8393
+ boneData;
8394
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
8395
+ * color tinting. */
8396
+ color = new Color(1, 1, 1, 1);
8397
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
8398
+ * color's alpha is not used. */
8399
+ darkColor = null;
8400
+ /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
8401
+ attachmentName = null;
8402
+ /** The blend mode for drawing the slot's attachment. */
8403
+ blendMode = BlendMode.Normal;
8404
+ /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
8405
+ visible = true;
7920
8406
  constructor(index, name, boneData) {
7921
- /** The index of the slot in {@link Skeleton#getSlots()}. */
7922
- this.index = 0;
7923
- /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7924
- * color tinting. */
7925
- this.color = new Color(1, 1, 1, 1);
7926
- /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
7927
- * color's alpha is not used. */
7928
- this.darkColor = null;
7929
- /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
7930
- this.attachmentName = null;
7931
- /** The blend mode for drawing the slot's attachment. */
7932
- this.blendMode = BlendMode.Normal;
7933
8407
  if (index < 0)
7934
8408
  throw new Error("index must be >= 0.");
7935
8409
  if (!name)
@@ -7951,33 +8425,10 @@ var spine = (() => {
7951
8425
 
7952
8426
  // spine-core/src/TransformConstraintData.ts
7953
8427
  var TransformConstraintData = class extends ConstraintData {
7954
- constructor(name) {
7955
- super(name, 0, false);
7956
- /** The bones that will be modified by this transform constraint. */
7957
- this.bones = new Array();
7958
- /** The target bone whose world transform will be copied to the constrained bones. */
7959
- this._target = null;
7960
- this.mixRotate = 0;
7961
- this.mixX = 0;
7962
- this.mixY = 0;
7963
- this.mixScaleX = 0;
7964
- this.mixScaleY = 0;
7965
- this.mixShearY = 0;
7966
- /** An offset added to the constrained bone rotation. */
7967
- this.offsetRotation = 0;
7968
- /** An offset added to the constrained bone X translation. */
7969
- this.offsetX = 0;
7970
- /** An offset added to the constrained bone Y translation. */
7971
- this.offsetY = 0;
7972
- /** An offset added to the constrained bone scaleX. */
7973
- this.offsetScaleX = 0;
7974
- /** An offset added to the constrained bone scaleY. */
7975
- this.offsetScaleY = 0;
7976
- /** An offset added to the constrained bone shearY. */
7977
- this.offsetShearY = 0;
7978
- this.relative = false;
7979
- this.local = false;
7980
- }
8428
+ /** The bones that will be modified by this transform constraint. */
8429
+ bones = new Array();
8430
+ /** The target bone whose world transform will be copied to the constrained bones. */
8431
+ _target = null;
7981
8432
  set target(boneData) {
7982
8433
  this._target = boneData;
7983
8434
  }
@@ -7987,17 +8438,41 @@ var spine = (() => {
7987
8438
  else
7988
8439
  return this._target;
7989
8440
  }
8441
+ mixRotate = 0;
8442
+ mixX = 0;
8443
+ mixY = 0;
8444
+ mixScaleX = 0;
8445
+ mixScaleY = 0;
8446
+ mixShearY = 0;
8447
+ /** An offset added to the constrained bone rotation. */
8448
+ offsetRotation = 0;
8449
+ /** An offset added to the constrained bone X translation. */
8450
+ offsetX = 0;
8451
+ /** An offset added to the constrained bone Y translation. */
8452
+ offsetY = 0;
8453
+ /** An offset added to the constrained bone scaleX. */
8454
+ offsetScaleX = 0;
8455
+ /** An offset added to the constrained bone scaleY. */
8456
+ offsetScaleY = 0;
8457
+ /** An offset added to the constrained bone shearY. */
8458
+ offsetShearY = 0;
8459
+ relative = false;
8460
+ local = false;
8461
+ constructor(name) {
8462
+ super(name, 0, false);
8463
+ }
7990
8464
  };
7991
8465
 
7992
8466
  // spine-core/src/SkeletonBinary.ts
7993
8467
  var SkeletonBinary = class {
8468
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
8469
+ * runtime than were used in Spine.
8470
+ *
8471
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
8472
+ scale = 1;
8473
+ attachmentLoader;
8474
+ linkedMeshes = new Array();
7994
8475
  constructor(attachmentLoader) {
7995
- /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
7996
- * runtime than were used in Spine.
7997
- *
7998
- * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
7999
- this.scale = 1;
8000
- this.linkedMeshes = new Array();
8001
8476
  this.attachmentLoader = attachmentLoader;
8002
8477
  }
8003
8478
  readSkeletonData(binary) {
@@ -9011,6 +9486,11 @@ var spine = (() => {
9011
9486
  }
9012
9487
  };
9013
9488
  var LinkedMesh = class {
9489
+ parent;
9490
+ skin;
9491
+ slotIndex;
9492
+ mesh;
9493
+ inheritTimeline;
9014
9494
  constructor(mesh, skin, slotIndex, parent, inheritDeform) {
9015
9495
  this.mesh = mesh;
9016
9496
  this.skin = skin;
@@ -9104,23 +9584,21 @@ var spine = (() => {
9104
9584
 
9105
9585
  // spine-core/src/SkeletonBounds.ts
9106
9586
  var SkeletonBounds = class {
9107
- constructor() {
9108
- /** The left edge of the axis aligned bounding box. */
9109
- this.minX = 0;
9110
- /** The bottom edge of the axis aligned bounding box. */
9111
- this.minY = 0;
9112
- /** The right edge of the axis aligned bounding box. */
9113
- this.maxX = 0;
9114
- /** The top edge of the axis aligned bounding box. */
9115
- this.maxY = 0;
9116
- /** The visible bounding boxes. */
9117
- this.boundingBoxes = new Array();
9118
- /** The world vertices for the bounding box polygons. */
9119
- this.polygons = new Array();
9120
- this.polygonPool = new Pool(() => {
9121
- return Utils.newFloatArray(16);
9122
- });
9123
- }
9587
+ /** The left edge of the axis aligned bounding box. */
9588
+ minX = 0;
9589
+ /** The bottom edge of the axis aligned bounding box. */
9590
+ minY = 0;
9591
+ /** The right edge of the axis aligned bounding box. */
9592
+ maxX = 0;
9593
+ /** The top edge of the axis aligned bounding box. */
9594
+ maxY = 0;
9595
+ /** The visible bounding boxes. */
9596
+ boundingBoxes = new Array();
9597
+ /** The world vertices for the bounding box polygons. */
9598
+ polygons = new Array();
9599
+ polygonPool = new Pool(() => {
9600
+ return Utils.newFloatArray(16);
9601
+ });
9124
9602
  /** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
9125
9603
  * box's polygon.
9126
9604
  * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
@@ -9291,19 +9769,17 @@ var spine = (() => {
9291
9769
 
9292
9770
  // spine-core/src/Triangulator.ts
9293
9771
  var Triangulator = class {
9294
- constructor() {
9295
- this.convexPolygons = new Array();
9296
- this.convexPolygonsIndices = new Array();
9297
- this.indicesArray = new Array();
9298
- this.isConcaveArray = new Array();
9299
- this.triangles = new Array();
9300
- this.polygonPool = new Pool(() => {
9301
- return new Array();
9302
- });
9303
- this.polygonIndicesPool = new Pool(() => {
9304
- return new Array();
9305
- });
9306
- }
9772
+ convexPolygons = new Array();
9773
+ convexPolygonsIndices = new Array();
9774
+ indicesArray = new Array();
9775
+ isConcaveArray = new Array();
9776
+ triangles = new Array();
9777
+ polygonPool = new Pool(() => {
9778
+ return new Array();
9779
+ });
9780
+ polygonIndicesPool = new Pool(() => {
9781
+ return new Array();
9782
+ });
9307
9783
  triangulate(verticesArray) {
9308
9784
  let vertices = verticesArray;
9309
9785
  let vertexCount = verticesArray.length >> 1;
@@ -9507,16 +9983,14 @@ var spine = (() => {
9507
9983
 
9508
9984
  // spine-core/src/SkeletonClipping.ts
9509
9985
  var SkeletonClipping = class {
9510
- constructor() {
9511
- this.triangulator = new Triangulator();
9512
- this.clippingPolygon = new Array();
9513
- this.clipOutput = new Array();
9514
- this.clippedVertices = new Array();
9515
- this.clippedTriangles = new Array();
9516
- this.scratch = new Array();
9517
- this.clipAttachment = null;
9518
- this.clippingPolygons = null;
9519
- }
9986
+ triangulator = new Triangulator();
9987
+ clippingPolygon = new Array();
9988
+ clipOutput = new Array();
9989
+ clippedVertices = new Array();
9990
+ clippedTriangles = new Array();
9991
+ scratch = new Array();
9992
+ clipAttachment = null;
9993
+ clippingPolygons = null;
9520
9994
  clipStart(slot, clip) {
9521
9995
  if (this.clipAttachment)
9522
9996
  return 0;
@@ -9796,13 +10270,14 @@ var spine = (() => {
9796
10270
 
9797
10271
  // spine-core/src/SkeletonJson.ts
9798
10272
  var SkeletonJson = class {
10273
+ attachmentLoader;
10274
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
10275
+ * runtime than were used in Spine.
10276
+ *
10277
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
10278
+ scale = 1;
10279
+ linkedMeshes = new Array();
9799
10280
  constructor(attachmentLoader) {
9800
- /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
9801
- * runtime than were used in Spine.
9802
- *
9803
- * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
9804
- this.scale = 1;
9805
- this.linkedMeshes = new Array();
9806
10281
  this.attachmentLoader = attachmentLoader;
9807
10282
  }
9808
10283
  readSkeletonData(json) {
@@ -10664,6 +11139,11 @@ var spine = (() => {
10664
11139
  }
10665
11140
  };
10666
11141
  var LinkedMesh2 = class {
11142
+ parent;
11143
+ skin;
11144
+ slotIndex;
11145
+ mesh;
11146
+ inheritTimeline;
10667
11147
  constructor(mesh, skin, slotIndex, parent, inheritDeform) {
10668
11148
  this.mesh = mesh;
10669
11149
  this.skin = skin;