@esotericsoftware/spine-core 4.2.10 → 4.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/AtlasAttachmentLoader.js +1 -4
- package/dist/IkConstraint.js +12 -5
- package/dist/Skeleton.d.ts +4 -1
- package/dist/Skeleton.js +10 -2
- package/dist/Texture.d.ts +1 -1
- package/dist/TextureAtlas.d.ts +1 -0
- package/dist/TextureAtlas.js +5 -1
- package/dist/TransformConstraint.js +1 -1
- package/dist/attachments/MeshAttachment.js +3 -3
- package/dist/attachments/RegionAttachment.d.ts +0 -1
- package/dist/attachments/RegionAttachment.js +1 -3
- package/dist/iife/spine-core.js +2023 -507
- package/dist/iife/spine-core.js.map +3 -3
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
package/dist/iife/spine-core.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var spine = (() => {
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __export = (target, all) => {
|
|
5
|
-
__markAsModule(target);
|
|
6
8
|
for (var name in all)
|
|
7
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
10
|
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
9
20
|
|
|
10
21
|
// spine-core/src/index.ts
|
|
11
22
|
var src_exports = {};
|
|
@@ -369,6 +380,7 @@ var spine = (() => {
|
|
|
369
380
|
static toSinglePrecision(value) {
|
|
370
381
|
return _Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
|
371
382
|
}
|
|
383
|
+
// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
|
|
372
384
|
static webkit602BugfixHelper(alpha, blend) {
|
|
373
385
|
}
|
|
374
386
|
static contains(array, element, identity = true) {
|
|
@@ -507,12 +519,34 @@ var spine = (() => {
|
|
|
507
519
|
var _VertexAttachment = class extends Attachment {
|
|
508
520
|
constructor(name) {
|
|
509
521
|
super(name);
|
|
522
|
+
/** The unique ID for this attachment. */
|
|
510
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. */
|
|
511
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. */
|
|
512
531
|
this.vertices = [];
|
|
532
|
+
/** The maximum number of world vertex values that can be output by
|
|
533
|
+
* {@link #computeWorldVertices()} using the `count` parameter. */
|
|
513
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. */
|
|
514
537
|
this.timelineAttachment = this;
|
|
515
538
|
}
|
|
539
|
+
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
|
|
540
|
+
* not empty, it is used to deform the vertices.
|
|
541
|
+
*
|
|
542
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
543
|
+
* Runtimes Guide.
|
|
544
|
+
* @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
|
|
545
|
+
* @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
|
|
546
|
+
* @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
|
|
547
|
+
* `stride` / 2.
|
|
548
|
+
* @param offset The `worldVertices` index to begin writing values.
|
|
549
|
+
* @param stride The number of `worldVertices` entries between the value pairs written. */
|
|
516
550
|
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
|
|
517
551
|
count = offset + (count >> 1) * stride;
|
|
518
552
|
let skeleton = slot.bone.skeleton;
|
|
@@ -571,6 +605,7 @@ var spine = (() => {
|
|
|
571
605
|
}
|
|
572
606
|
}
|
|
573
607
|
}
|
|
608
|
+
/** Does not copy id (generated) or name (set on construction). **/
|
|
574
609
|
copyTo(attachment) {
|
|
575
610
|
if (this.bones) {
|
|
576
611
|
attachment.bones = new Array(this.bones.length);
|
|
@@ -594,6 +629,7 @@ var spine = (() => {
|
|
|
594
629
|
this.id = _Sequence.nextID();
|
|
595
630
|
this.start = 0;
|
|
596
631
|
this.digits = 0;
|
|
632
|
+
/** The index of the region to show for the setup pose. */
|
|
597
633
|
this.setupIndex = 0;
|
|
598
634
|
this.regions = new Array(count);
|
|
599
635
|
}
|
|
@@ -631,8 +667,7 @@ var spine = (() => {
|
|
|
631
667
|
};
|
|
632
668
|
var Sequence = _Sequence;
|
|
633
669
|
Sequence._nextID = 0;
|
|
634
|
-
var SequenceMode
|
|
635
|
-
(function(SequenceMode2) {
|
|
670
|
+
var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
|
|
636
671
|
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
637
672
|
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
638
673
|
SequenceMode2[SequenceMode2["loop"] = 2] = "loop";
|
|
@@ -640,15 +675,16 @@ var spine = (() => {
|
|
|
640
675
|
SequenceMode2[SequenceMode2["onceReverse"] = 4] = "onceReverse";
|
|
641
676
|
SequenceMode2[SequenceMode2["loopReverse"] = 5] = "loopReverse";
|
|
642
677
|
SequenceMode2[SequenceMode2["pingpongReverse"] = 6] = "pingpongReverse";
|
|
643
|
-
|
|
678
|
+
return SequenceMode2;
|
|
679
|
+
})(SequenceMode || {});
|
|
644
680
|
var SequenceModeValues = [
|
|
645
|
-
0
|
|
646
|
-
1
|
|
647
|
-
2
|
|
648
|
-
3
|
|
649
|
-
4
|
|
650
|
-
5
|
|
651
|
-
6
|
|
681
|
+
0 /* hold */,
|
|
682
|
+
1 /* once */,
|
|
683
|
+
2 /* loop */,
|
|
684
|
+
3 /* pingpong */,
|
|
685
|
+
4 /* onceReverse */,
|
|
686
|
+
5 /* loopReverse */,
|
|
687
|
+
6 /* pingpongReverse */
|
|
652
688
|
];
|
|
653
689
|
|
|
654
690
|
// spine-core/src/Animation.ts
|
|
@@ -676,6 +712,11 @@ var spine = (() => {
|
|
|
676
712
|
return true;
|
|
677
713
|
return false;
|
|
678
714
|
}
|
|
715
|
+
/** Applies all the animation's timelines to the specified skeleton.
|
|
716
|
+
*
|
|
717
|
+
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
|
|
718
|
+
* @param loop If true, the animation repeats after {@link #getDuration()}.
|
|
719
|
+
* @param events May be null to ignore fired events. */
|
|
679
720
|
apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
|
680
721
|
if (!skeleton)
|
|
681
722
|
throw new Error("skeleton cannot be null.");
|
|
@@ -689,18 +730,18 @@ var spine = (() => {
|
|
|
689
730
|
timelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction);
|
|
690
731
|
}
|
|
691
732
|
};
|
|
692
|
-
var MixBlend
|
|
693
|
-
(function(MixBlend2) {
|
|
733
|
+
var MixBlend = /* @__PURE__ */ ((MixBlend2) => {
|
|
694
734
|
MixBlend2[MixBlend2["setup"] = 0] = "setup";
|
|
695
735
|
MixBlend2[MixBlend2["first"] = 1] = "first";
|
|
696
736
|
MixBlend2[MixBlend2["replace"] = 2] = "replace";
|
|
697
737
|
MixBlend2[MixBlend2["add"] = 3] = "add";
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
(
|
|
738
|
+
return MixBlend2;
|
|
739
|
+
})(MixBlend || {});
|
|
740
|
+
var MixDirection = /* @__PURE__ */ ((MixDirection2) => {
|
|
701
741
|
MixDirection2[MixDirection2["mixIn"] = 0] = "mixIn";
|
|
702
742
|
MixDirection2[MixDirection2["mixOut"] = 1] = "mixOut";
|
|
703
|
-
|
|
743
|
+
return MixDirection2;
|
|
744
|
+
})(MixDirection || {});
|
|
704
745
|
var Property = {
|
|
705
746
|
rotate: 0,
|
|
706
747
|
x: 1,
|
|
@@ -756,17 +797,25 @@ var spine = (() => {
|
|
|
756
797
|
}
|
|
757
798
|
};
|
|
758
799
|
var CurveTimeline = class extends Timeline {
|
|
800
|
+
// type, x, y, ...
|
|
759
801
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
760
802
|
super(frameCount, propertyIds);
|
|
761
|
-
this.curves = Utils.newFloatArray(
|
|
803
|
+
this.curves = Utils.newFloatArray(
|
|
804
|
+
frameCount + bezierCount * 18
|
|
805
|
+
/*BEZIER_SIZE*/
|
|
806
|
+
);
|
|
762
807
|
this.curves[frameCount - 1] = 1;
|
|
763
808
|
}
|
|
809
|
+
/** Sets the specified key frame to linear interpolation. */
|
|
764
810
|
setLinear(frame) {
|
|
765
811
|
this.curves[frame] = 0;
|
|
766
812
|
}
|
|
813
|
+
/** Sets the specified key frame to stepped interpolation. */
|
|
767
814
|
setStepped(frame) {
|
|
768
815
|
this.curves[frame] = 1;
|
|
769
816
|
}
|
|
817
|
+
/** Shrinks the storage for Bezier curves, for use when <code>bezierCount</code> (specified in the constructor) was larger
|
|
818
|
+
* than the actual number of Bezier curves. */
|
|
770
819
|
shrink(bezierCount) {
|
|
771
820
|
let size = this.getFrameCount() + bezierCount * 18;
|
|
772
821
|
if (this.curves.length > size) {
|
|
@@ -775,6 +824,20 @@ var spine = (() => {
|
|
|
775
824
|
this.curves = newCurves;
|
|
776
825
|
}
|
|
777
826
|
}
|
|
827
|
+
/** Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
|
|
828
|
+
* one curve per frame.
|
|
829
|
+
* @param bezier The ordinal of this Bezier curve for this timeline, between 0 and <code>bezierCount - 1</code> (specified
|
|
830
|
+
* in the constructor), inclusive.
|
|
831
|
+
* @param frame Between 0 and <code>frameCount - 1</code>, inclusive.
|
|
832
|
+
* @param value The index of the value for this frame that this curve is used for.
|
|
833
|
+
* @param time1 The time for the first key.
|
|
834
|
+
* @param value1 The value for the first key.
|
|
835
|
+
* @param cx1 The time for the first Bezier handle.
|
|
836
|
+
* @param cy1 The value for the first Bezier handle.
|
|
837
|
+
* @param cx2 The time of the second Bezier handle.
|
|
838
|
+
* @param cy2 The value for the second Bezier handle.
|
|
839
|
+
* @param time2 The time for the second key.
|
|
840
|
+
* @param value2 The value for the second key. */
|
|
778
841
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
779
842
|
let curves = this.curves;
|
|
780
843
|
let i = this.getFrameCount() + bezier * 18;
|
|
@@ -796,6 +859,10 @@ var spine = (() => {
|
|
|
796
859
|
y += dy;
|
|
797
860
|
}
|
|
798
861
|
}
|
|
862
|
+
/** Returns the Bezier interpolated value for the specified time.
|
|
863
|
+
* @param frameIndex The index into {@link #getFrames()} for the values of the frame before <code>time</code>.
|
|
864
|
+
* @param valueOffset The offset from <code>frameIndex</code> to the value this curve is used for.
|
|
865
|
+
* @param i The index of the Bezier segments. See {@link #getCurveType(int)}. */
|
|
799
866
|
getBezierValue(time, frameIndex, valueOffset, i) {
|
|
800
867
|
let curves = this.curves;
|
|
801
868
|
if (curves[i] > time) {
|
|
@@ -821,11 +888,18 @@ var spine = (() => {
|
|
|
821
888
|
getFrameEntries() {
|
|
822
889
|
return 2;
|
|
823
890
|
}
|
|
891
|
+
/** Sets the time and value for the specified frame.
|
|
892
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
893
|
+
* @param time The frame time in seconds. */
|
|
824
894
|
setFrame(frame, time, value) {
|
|
825
895
|
frame <<= 1;
|
|
826
896
|
this.frames[frame] = time;
|
|
827
|
-
this.frames[
|
|
897
|
+
this.frames[
|
|
898
|
+
frame + 1
|
|
899
|
+
/*VALUE*/
|
|
900
|
+
] = value;
|
|
828
901
|
}
|
|
902
|
+
/** Returns the interpolated value for the specified time. */
|
|
829
903
|
getCurveValue(time) {
|
|
830
904
|
let frames = this.frames;
|
|
831
905
|
let i = frames.length - 2;
|
|
@@ -838,26 +912,55 @@ var spine = (() => {
|
|
|
838
912
|
let curveType = this.curves[i >> 1];
|
|
839
913
|
switch (curveType) {
|
|
840
914
|
case 0:
|
|
841
|
-
let before = frames[i], value = frames[
|
|
842
|
-
|
|
915
|
+
let before = frames[i], value = frames[
|
|
916
|
+
i + 1
|
|
917
|
+
/*VALUE*/
|
|
918
|
+
];
|
|
919
|
+
return value + (time - before) / (frames[
|
|
920
|
+
i + 2
|
|
921
|
+
/*ENTRIES*/
|
|
922
|
+
] - before) * (frames[
|
|
923
|
+
i + 2 + 1
|
|
924
|
+
/*VALUE*/
|
|
925
|
+
] - value);
|
|
843
926
|
case 1:
|
|
844
|
-
return frames[
|
|
845
|
-
|
|
846
|
-
|
|
927
|
+
return frames[
|
|
928
|
+
i + 1
|
|
929
|
+
/*VALUE*/
|
|
930
|
+
];
|
|
931
|
+
}
|
|
932
|
+
return this.getBezierValue(
|
|
933
|
+
time,
|
|
934
|
+
i,
|
|
935
|
+
1,
|
|
936
|
+
curveType - 2
|
|
937
|
+
/*BEZIER*/
|
|
938
|
+
);
|
|
847
939
|
}
|
|
848
940
|
};
|
|
849
941
|
var CurveTimeline2 = class extends CurveTimeline {
|
|
942
|
+
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
|
|
943
|
+
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
|
|
850
944
|
constructor(frameCount, bezierCount, propertyId1, propertyId2) {
|
|
851
945
|
super(frameCount, bezierCount, [propertyId1, propertyId2]);
|
|
852
946
|
}
|
|
853
947
|
getFrameEntries() {
|
|
854
948
|
return 3;
|
|
855
949
|
}
|
|
950
|
+
/** Sets the time and values for the specified frame.
|
|
951
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
952
|
+
* @param time The frame time in seconds. */
|
|
856
953
|
setFrame(frame, time, value1, value2) {
|
|
857
954
|
frame *= 3;
|
|
858
955
|
this.frames[frame] = time;
|
|
859
|
-
this.frames[
|
|
860
|
-
|
|
956
|
+
this.frames[
|
|
957
|
+
frame + 1
|
|
958
|
+
/*VALUE1*/
|
|
959
|
+
] = value1;
|
|
960
|
+
this.frames[
|
|
961
|
+
frame + 2
|
|
962
|
+
/*VALUE2*/
|
|
963
|
+
] = value2;
|
|
861
964
|
}
|
|
862
965
|
};
|
|
863
966
|
var RotateTimeline = class extends CurveTimeline1 {
|
|
@@ -873,30 +976,35 @@ var spine = (() => {
|
|
|
873
976
|
let frames = this.frames;
|
|
874
977
|
if (time < frames[0]) {
|
|
875
978
|
switch (blend) {
|
|
876
|
-
case 0
|
|
979
|
+
case 0 /* setup */:
|
|
877
980
|
bone.rotation = bone.data.rotation;
|
|
878
981
|
return;
|
|
879
|
-
case 1
|
|
982
|
+
case 1 /* first */:
|
|
880
983
|
bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
|
|
881
984
|
}
|
|
882
985
|
return;
|
|
883
986
|
}
|
|
884
987
|
let r = this.getCurveValue(time);
|
|
885
988
|
switch (blend) {
|
|
886
|
-
case 0
|
|
989
|
+
case 0 /* setup */:
|
|
887
990
|
bone.rotation = bone.data.rotation + r * alpha;
|
|
888
991
|
break;
|
|
889
|
-
case 1
|
|
890
|
-
case 2
|
|
992
|
+
case 1 /* first */:
|
|
993
|
+
case 2 /* replace */:
|
|
891
994
|
r += bone.data.rotation - bone.rotation;
|
|
892
|
-
case 3
|
|
995
|
+
case 3 /* add */:
|
|
893
996
|
bone.rotation += r * alpha;
|
|
894
997
|
}
|
|
895
998
|
}
|
|
896
999
|
};
|
|
897
1000
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
898
1001
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
899
|
-
super(
|
|
1002
|
+
super(
|
|
1003
|
+
frameCount,
|
|
1004
|
+
bezierCount,
|
|
1005
|
+
Property.x + "|" + boneIndex,
|
|
1006
|
+
Property.y + "|" + boneIndex
|
|
1007
|
+
);
|
|
900
1008
|
this.boneIndex = 0;
|
|
901
1009
|
this.boneIndex = boneIndex;
|
|
902
1010
|
}
|
|
@@ -907,47 +1015,88 @@ var spine = (() => {
|
|
|
907
1015
|
let frames = this.frames;
|
|
908
1016
|
if (time < frames[0]) {
|
|
909
1017
|
switch (blend) {
|
|
910
|
-
case 0
|
|
1018
|
+
case 0 /* setup */:
|
|
911
1019
|
bone.x = bone.data.x;
|
|
912
1020
|
bone.y = bone.data.y;
|
|
913
1021
|
return;
|
|
914
|
-
case 1
|
|
1022
|
+
case 1 /* first */:
|
|
915
1023
|
bone.x += (bone.data.x - bone.x) * alpha;
|
|
916
1024
|
bone.y += (bone.data.y - bone.y) * alpha;
|
|
917
1025
|
}
|
|
918
1026
|
return;
|
|
919
1027
|
}
|
|
920
1028
|
let x = 0, y = 0;
|
|
921
|
-
let i = Timeline.search(
|
|
922
|
-
|
|
1029
|
+
let i = Timeline.search(
|
|
1030
|
+
frames,
|
|
1031
|
+
time,
|
|
1032
|
+
3
|
|
1033
|
+
/*ENTRIES*/
|
|
1034
|
+
);
|
|
1035
|
+
let curveType = this.curves[
|
|
1036
|
+
i / 3
|
|
1037
|
+
/*ENTRIES*/
|
|
1038
|
+
];
|
|
923
1039
|
switch (curveType) {
|
|
924
1040
|
case 0:
|
|
925
1041
|
let before = frames[i];
|
|
926
|
-
x = frames[
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
y
|
|
1042
|
+
x = frames[
|
|
1043
|
+
i + 1
|
|
1044
|
+
/*VALUE1*/
|
|
1045
|
+
];
|
|
1046
|
+
y = frames[
|
|
1047
|
+
i + 2
|
|
1048
|
+
/*VALUE2*/
|
|
1049
|
+
];
|
|
1050
|
+
let t = (time - before) / (frames[
|
|
1051
|
+
i + 3
|
|
1052
|
+
/*ENTRIES*/
|
|
1053
|
+
] - before);
|
|
1054
|
+
x += (frames[
|
|
1055
|
+
i + 3 + 1
|
|
1056
|
+
/*VALUE1*/
|
|
1057
|
+
] - x) * t;
|
|
1058
|
+
y += (frames[
|
|
1059
|
+
i + 3 + 2
|
|
1060
|
+
/*VALUE2*/
|
|
1061
|
+
] - y) * t;
|
|
931
1062
|
break;
|
|
932
1063
|
case 1:
|
|
933
|
-
x = frames[
|
|
934
|
-
|
|
1064
|
+
x = frames[
|
|
1065
|
+
i + 1
|
|
1066
|
+
/*VALUE1*/
|
|
1067
|
+
];
|
|
1068
|
+
y = frames[
|
|
1069
|
+
i + 2
|
|
1070
|
+
/*VALUE2*/
|
|
1071
|
+
];
|
|
935
1072
|
break;
|
|
936
1073
|
default:
|
|
937
|
-
x = this.getBezierValue(
|
|
938
|
-
|
|
1074
|
+
x = this.getBezierValue(
|
|
1075
|
+
time,
|
|
1076
|
+
i,
|
|
1077
|
+
1,
|
|
1078
|
+
curveType - 2
|
|
1079
|
+
/*BEZIER*/
|
|
1080
|
+
);
|
|
1081
|
+
y = this.getBezierValue(
|
|
1082
|
+
time,
|
|
1083
|
+
i,
|
|
1084
|
+
2,
|
|
1085
|
+
curveType + 18 - 2
|
|
1086
|
+
/*BEZIER*/
|
|
1087
|
+
);
|
|
939
1088
|
}
|
|
940
1089
|
switch (blend) {
|
|
941
|
-
case 0
|
|
1090
|
+
case 0 /* setup */:
|
|
942
1091
|
bone.x = bone.data.x + x * alpha;
|
|
943
1092
|
bone.y = bone.data.y + y * alpha;
|
|
944
1093
|
break;
|
|
945
|
-
case 1
|
|
946
|
-
case 2
|
|
1094
|
+
case 1 /* first */:
|
|
1095
|
+
case 2 /* replace */:
|
|
947
1096
|
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
948
1097
|
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
949
1098
|
break;
|
|
950
|
-
case 3
|
|
1099
|
+
case 3 /* add */:
|
|
951
1100
|
bone.x += x * alpha;
|
|
952
1101
|
bone.y += y * alpha;
|
|
953
1102
|
}
|
|
@@ -966,24 +1115,24 @@ var spine = (() => {
|
|
|
966
1115
|
let frames = this.frames;
|
|
967
1116
|
if (time < frames[0]) {
|
|
968
1117
|
switch (blend) {
|
|
969
|
-
case 0
|
|
1118
|
+
case 0 /* setup */:
|
|
970
1119
|
bone.x = bone.data.x;
|
|
971
1120
|
return;
|
|
972
|
-
case 1
|
|
1121
|
+
case 1 /* first */:
|
|
973
1122
|
bone.x += (bone.data.x - bone.x) * alpha;
|
|
974
1123
|
}
|
|
975
1124
|
return;
|
|
976
1125
|
}
|
|
977
1126
|
let x = this.getCurveValue(time);
|
|
978
1127
|
switch (blend) {
|
|
979
|
-
case 0
|
|
1128
|
+
case 0 /* setup */:
|
|
980
1129
|
bone.x = bone.data.x + x * alpha;
|
|
981
1130
|
break;
|
|
982
|
-
case 1
|
|
983
|
-
case 2
|
|
1131
|
+
case 1 /* first */:
|
|
1132
|
+
case 2 /* replace */:
|
|
984
1133
|
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
985
1134
|
break;
|
|
986
|
-
case 3
|
|
1135
|
+
case 3 /* add */:
|
|
987
1136
|
bone.x += x * alpha;
|
|
988
1137
|
}
|
|
989
1138
|
}
|
|
@@ -1001,31 +1150,36 @@ var spine = (() => {
|
|
|
1001
1150
|
let frames = this.frames;
|
|
1002
1151
|
if (time < frames[0]) {
|
|
1003
1152
|
switch (blend) {
|
|
1004
|
-
case 0
|
|
1153
|
+
case 0 /* setup */:
|
|
1005
1154
|
bone.y = bone.data.y;
|
|
1006
1155
|
return;
|
|
1007
|
-
case 1
|
|
1156
|
+
case 1 /* first */:
|
|
1008
1157
|
bone.y += (bone.data.y - bone.y) * alpha;
|
|
1009
1158
|
}
|
|
1010
1159
|
return;
|
|
1011
1160
|
}
|
|
1012
1161
|
let y = this.getCurveValue(time);
|
|
1013
1162
|
switch (blend) {
|
|
1014
|
-
case 0
|
|
1163
|
+
case 0 /* setup */:
|
|
1015
1164
|
bone.y = bone.data.y + y * alpha;
|
|
1016
1165
|
break;
|
|
1017
|
-
case 1
|
|
1018
|
-
case 2
|
|
1166
|
+
case 1 /* first */:
|
|
1167
|
+
case 2 /* replace */:
|
|
1019
1168
|
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
1020
1169
|
break;
|
|
1021
|
-
case 3
|
|
1170
|
+
case 3 /* add */:
|
|
1022
1171
|
bone.y += y * alpha;
|
|
1023
1172
|
}
|
|
1024
1173
|
}
|
|
1025
1174
|
};
|
|
1026
1175
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
1027
1176
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
1028
|
-
super(
|
|
1177
|
+
super(
|
|
1178
|
+
frameCount,
|
|
1179
|
+
bezierCount,
|
|
1180
|
+
Property.scaleX + "|" + boneIndex,
|
|
1181
|
+
Property.scaleY + "|" + boneIndex
|
|
1182
|
+
);
|
|
1029
1183
|
this.boneIndex = 0;
|
|
1030
1184
|
this.boneIndex = boneIndex;
|
|
1031
1185
|
}
|
|
@@ -1036,40 +1190,81 @@ var spine = (() => {
|
|
|
1036
1190
|
let frames = this.frames;
|
|
1037
1191
|
if (time < frames[0]) {
|
|
1038
1192
|
switch (blend) {
|
|
1039
|
-
case 0
|
|
1193
|
+
case 0 /* setup */:
|
|
1040
1194
|
bone.scaleX = bone.data.scaleX;
|
|
1041
1195
|
bone.scaleY = bone.data.scaleY;
|
|
1042
1196
|
return;
|
|
1043
|
-
case 1
|
|
1197
|
+
case 1 /* first */:
|
|
1044
1198
|
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1045
1199
|
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1046
1200
|
}
|
|
1047
1201
|
return;
|
|
1048
1202
|
}
|
|
1049
1203
|
let x, y;
|
|
1050
|
-
let i = Timeline.search(
|
|
1051
|
-
|
|
1204
|
+
let i = Timeline.search(
|
|
1205
|
+
frames,
|
|
1206
|
+
time,
|
|
1207
|
+
3
|
|
1208
|
+
/*ENTRIES*/
|
|
1209
|
+
);
|
|
1210
|
+
let curveType = this.curves[
|
|
1211
|
+
i / 3
|
|
1212
|
+
/*ENTRIES*/
|
|
1213
|
+
];
|
|
1052
1214
|
switch (curveType) {
|
|
1053
1215
|
case 0:
|
|
1054
1216
|
let before = frames[i];
|
|
1055
|
-
x = frames[
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
y
|
|
1217
|
+
x = frames[
|
|
1218
|
+
i + 1
|
|
1219
|
+
/*VALUE1*/
|
|
1220
|
+
];
|
|
1221
|
+
y = frames[
|
|
1222
|
+
i + 2
|
|
1223
|
+
/*VALUE2*/
|
|
1224
|
+
];
|
|
1225
|
+
let t = (time - before) / (frames[
|
|
1226
|
+
i + 3
|
|
1227
|
+
/*ENTRIES*/
|
|
1228
|
+
] - before);
|
|
1229
|
+
x += (frames[
|
|
1230
|
+
i + 3 + 1
|
|
1231
|
+
/*VALUE1*/
|
|
1232
|
+
] - x) * t;
|
|
1233
|
+
y += (frames[
|
|
1234
|
+
i + 3 + 2
|
|
1235
|
+
/*VALUE2*/
|
|
1236
|
+
] - y) * t;
|
|
1060
1237
|
break;
|
|
1061
1238
|
case 1:
|
|
1062
|
-
x = frames[
|
|
1063
|
-
|
|
1239
|
+
x = frames[
|
|
1240
|
+
i + 1
|
|
1241
|
+
/*VALUE1*/
|
|
1242
|
+
];
|
|
1243
|
+
y = frames[
|
|
1244
|
+
i + 2
|
|
1245
|
+
/*VALUE2*/
|
|
1246
|
+
];
|
|
1064
1247
|
break;
|
|
1065
1248
|
default:
|
|
1066
|
-
x = this.getBezierValue(
|
|
1067
|
-
|
|
1249
|
+
x = this.getBezierValue(
|
|
1250
|
+
time,
|
|
1251
|
+
i,
|
|
1252
|
+
1,
|
|
1253
|
+
curveType - 2
|
|
1254
|
+
/*BEZIER*/
|
|
1255
|
+
);
|
|
1256
|
+
y = this.getBezierValue(
|
|
1257
|
+
time,
|
|
1258
|
+
i,
|
|
1259
|
+
2,
|
|
1260
|
+
curveType + 18 - 2
|
|
1261
|
+
/*BEZIER*/
|
|
1262
|
+
);
|
|
1068
1263
|
}
|
|
1069
1264
|
x *= bone.data.scaleX;
|
|
1070
1265
|
y *= bone.data.scaleY;
|
|
1071
1266
|
if (alpha == 1) {
|
|
1072
|
-
if (blend == 3) {
|
|
1267
|
+
if (blend == 3 /* add */) {
|
|
1073
1268
|
bone.scaleX += x - bone.data.scaleX;
|
|
1074
1269
|
bone.scaleY += y - bone.data.scaleY;
|
|
1075
1270
|
} else {
|
|
@@ -1078,41 +1273,41 @@ var spine = (() => {
|
|
|
1078
1273
|
}
|
|
1079
1274
|
} else {
|
|
1080
1275
|
let bx = 0, by = 0;
|
|
1081
|
-
if (direction == 1) {
|
|
1276
|
+
if (direction == 1 /* mixOut */) {
|
|
1082
1277
|
switch (blend) {
|
|
1083
|
-
case 0
|
|
1278
|
+
case 0 /* setup */:
|
|
1084
1279
|
bx = bone.data.scaleX;
|
|
1085
1280
|
by = bone.data.scaleY;
|
|
1086
1281
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1087
1282
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1088
1283
|
break;
|
|
1089
|
-
case 1
|
|
1090
|
-
case 2
|
|
1284
|
+
case 1 /* first */:
|
|
1285
|
+
case 2 /* replace */:
|
|
1091
1286
|
bx = bone.scaleX;
|
|
1092
1287
|
by = bone.scaleY;
|
|
1093
1288
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1094
1289
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1095
1290
|
break;
|
|
1096
|
-
case 3
|
|
1291
|
+
case 3 /* add */:
|
|
1097
1292
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1098
1293
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1099
1294
|
}
|
|
1100
1295
|
} else {
|
|
1101
1296
|
switch (blend) {
|
|
1102
|
-
case 0
|
|
1297
|
+
case 0 /* setup */:
|
|
1103
1298
|
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1104
1299
|
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1105
1300
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1106
1301
|
bone.scaleY = by + (y - by) * alpha;
|
|
1107
1302
|
break;
|
|
1108
|
-
case 1
|
|
1109
|
-
case 2
|
|
1303
|
+
case 1 /* first */:
|
|
1304
|
+
case 2 /* replace */:
|
|
1110
1305
|
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1111
1306
|
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1112
1307
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1113
1308
|
bone.scaleY = by + (y - by) * alpha;
|
|
1114
1309
|
break;
|
|
1115
|
-
case 3
|
|
1310
|
+
case 3 /* add */:
|
|
1116
1311
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1117
1312
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1118
1313
|
}
|
|
@@ -1133,48 +1328,48 @@ var spine = (() => {
|
|
|
1133
1328
|
let frames = this.frames;
|
|
1134
1329
|
if (time < frames[0]) {
|
|
1135
1330
|
switch (blend) {
|
|
1136
|
-
case 0
|
|
1331
|
+
case 0 /* setup */:
|
|
1137
1332
|
bone.scaleX = bone.data.scaleX;
|
|
1138
1333
|
return;
|
|
1139
|
-
case 1
|
|
1334
|
+
case 1 /* first */:
|
|
1140
1335
|
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1141
1336
|
}
|
|
1142
1337
|
return;
|
|
1143
1338
|
}
|
|
1144
1339
|
let x = this.getCurveValue(time) * bone.data.scaleX;
|
|
1145
1340
|
if (alpha == 1) {
|
|
1146
|
-
if (blend == 3)
|
|
1341
|
+
if (blend == 3 /* add */)
|
|
1147
1342
|
bone.scaleX += x - bone.data.scaleX;
|
|
1148
1343
|
else
|
|
1149
1344
|
bone.scaleX = x;
|
|
1150
1345
|
} else {
|
|
1151
1346
|
let bx = 0;
|
|
1152
|
-
if (direction == 1) {
|
|
1347
|
+
if (direction == 1 /* mixOut */) {
|
|
1153
1348
|
switch (blend) {
|
|
1154
|
-
case 0
|
|
1349
|
+
case 0 /* setup */:
|
|
1155
1350
|
bx = bone.data.scaleX;
|
|
1156
1351
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1157
1352
|
break;
|
|
1158
|
-
case 1
|
|
1159
|
-
case 2
|
|
1353
|
+
case 1 /* first */:
|
|
1354
|
+
case 2 /* replace */:
|
|
1160
1355
|
bx = bone.scaleX;
|
|
1161
1356
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1162
1357
|
break;
|
|
1163
|
-
case 3
|
|
1358
|
+
case 3 /* add */:
|
|
1164
1359
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1165
1360
|
}
|
|
1166
1361
|
} else {
|
|
1167
1362
|
switch (blend) {
|
|
1168
|
-
case 0
|
|
1363
|
+
case 0 /* setup */:
|
|
1169
1364
|
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1170
1365
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1171
1366
|
break;
|
|
1172
|
-
case 1
|
|
1173
|
-
case 2
|
|
1367
|
+
case 1 /* first */:
|
|
1368
|
+
case 2 /* replace */:
|
|
1174
1369
|
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1175
1370
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1176
1371
|
break;
|
|
1177
|
-
case 3
|
|
1372
|
+
case 3 /* add */:
|
|
1178
1373
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1179
1374
|
}
|
|
1180
1375
|
}
|
|
@@ -1194,48 +1389,48 @@ var spine = (() => {
|
|
|
1194
1389
|
let frames = this.frames;
|
|
1195
1390
|
if (time < frames[0]) {
|
|
1196
1391
|
switch (blend) {
|
|
1197
|
-
case 0
|
|
1392
|
+
case 0 /* setup */:
|
|
1198
1393
|
bone.scaleY = bone.data.scaleY;
|
|
1199
1394
|
return;
|
|
1200
|
-
case 1
|
|
1395
|
+
case 1 /* first */:
|
|
1201
1396
|
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1202
1397
|
}
|
|
1203
1398
|
return;
|
|
1204
1399
|
}
|
|
1205
1400
|
let y = this.getCurveValue(time) * bone.data.scaleY;
|
|
1206
1401
|
if (alpha == 1) {
|
|
1207
|
-
if (blend == 3)
|
|
1402
|
+
if (blend == 3 /* add */)
|
|
1208
1403
|
bone.scaleY += y - bone.data.scaleY;
|
|
1209
1404
|
else
|
|
1210
1405
|
bone.scaleY = y;
|
|
1211
1406
|
} else {
|
|
1212
1407
|
let by = 0;
|
|
1213
|
-
if (direction == 1) {
|
|
1408
|
+
if (direction == 1 /* mixOut */) {
|
|
1214
1409
|
switch (blend) {
|
|
1215
|
-
case 0
|
|
1410
|
+
case 0 /* setup */:
|
|
1216
1411
|
by = bone.data.scaleY;
|
|
1217
1412
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1218
1413
|
break;
|
|
1219
|
-
case 1
|
|
1220
|
-
case 2
|
|
1414
|
+
case 1 /* first */:
|
|
1415
|
+
case 2 /* replace */:
|
|
1221
1416
|
by = bone.scaleY;
|
|
1222
1417
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1223
1418
|
break;
|
|
1224
|
-
case 3
|
|
1419
|
+
case 3 /* add */:
|
|
1225
1420
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1226
1421
|
}
|
|
1227
1422
|
} else {
|
|
1228
1423
|
switch (blend) {
|
|
1229
|
-
case 0
|
|
1424
|
+
case 0 /* setup */:
|
|
1230
1425
|
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1231
1426
|
bone.scaleY = by + (y - by) * alpha;
|
|
1232
1427
|
break;
|
|
1233
|
-
case 1
|
|
1234
|
-
case 2
|
|
1428
|
+
case 1 /* first */:
|
|
1429
|
+
case 2 /* replace */:
|
|
1235
1430
|
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1236
1431
|
bone.scaleY = by + (y - by) * alpha;
|
|
1237
1432
|
break;
|
|
1238
|
-
case 3
|
|
1433
|
+
case 3 /* add */:
|
|
1239
1434
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1240
1435
|
}
|
|
1241
1436
|
}
|
|
@@ -1244,7 +1439,12 @@ var spine = (() => {
|
|
|
1244
1439
|
};
|
|
1245
1440
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
1246
1441
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
1247
|
-
super(
|
|
1442
|
+
super(
|
|
1443
|
+
frameCount,
|
|
1444
|
+
bezierCount,
|
|
1445
|
+
Property.shearX + "|" + boneIndex,
|
|
1446
|
+
Property.shearY + "|" + boneIndex
|
|
1447
|
+
);
|
|
1248
1448
|
this.boneIndex = 0;
|
|
1249
1449
|
this.boneIndex = boneIndex;
|
|
1250
1450
|
}
|
|
@@ -1255,47 +1455,88 @@ var spine = (() => {
|
|
|
1255
1455
|
let frames = this.frames;
|
|
1256
1456
|
if (time < frames[0]) {
|
|
1257
1457
|
switch (blend) {
|
|
1258
|
-
case 0
|
|
1458
|
+
case 0 /* setup */:
|
|
1259
1459
|
bone.shearX = bone.data.shearX;
|
|
1260
1460
|
bone.shearY = bone.data.shearY;
|
|
1261
1461
|
return;
|
|
1262
|
-
case 1
|
|
1462
|
+
case 1 /* first */:
|
|
1263
1463
|
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1264
1464
|
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1265
1465
|
}
|
|
1266
1466
|
return;
|
|
1267
1467
|
}
|
|
1268
1468
|
let x = 0, y = 0;
|
|
1269
|
-
let i = Timeline.search(
|
|
1270
|
-
|
|
1469
|
+
let i = Timeline.search(
|
|
1470
|
+
frames,
|
|
1471
|
+
time,
|
|
1472
|
+
3
|
|
1473
|
+
/*ENTRIES*/
|
|
1474
|
+
);
|
|
1475
|
+
let curveType = this.curves[
|
|
1476
|
+
i / 3
|
|
1477
|
+
/*ENTRIES*/
|
|
1478
|
+
];
|
|
1271
1479
|
switch (curveType) {
|
|
1272
1480
|
case 0:
|
|
1273
1481
|
let before = frames[i];
|
|
1274
|
-
x = frames[
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
y
|
|
1482
|
+
x = frames[
|
|
1483
|
+
i + 1
|
|
1484
|
+
/*VALUE1*/
|
|
1485
|
+
];
|
|
1486
|
+
y = frames[
|
|
1487
|
+
i + 2
|
|
1488
|
+
/*VALUE2*/
|
|
1489
|
+
];
|
|
1490
|
+
let t = (time - before) / (frames[
|
|
1491
|
+
i + 3
|
|
1492
|
+
/*ENTRIES*/
|
|
1493
|
+
] - before);
|
|
1494
|
+
x += (frames[
|
|
1495
|
+
i + 3 + 1
|
|
1496
|
+
/*VALUE1*/
|
|
1497
|
+
] - x) * t;
|
|
1498
|
+
y += (frames[
|
|
1499
|
+
i + 3 + 2
|
|
1500
|
+
/*VALUE2*/
|
|
1501
|
+
] - y) * t;
|
|
1279
1502
|
break;
|
|
1280
1503
|
case 1:
|
|
1281
|
-
x = frames[
|
|
1282
|
-
|
|
1504
|
+
x = frames[
|
|
1505
|
+
i + 1
|
|
1506
|
+
/*VALUE1*/
|
|
1507
|
+
];
|
|
1508
|
+
y = frames[
|
|
1509
|
+
i + 2
|
|
1510
|
+
/*VALUE2*/
|
|
1511
|
+
];
|
|
1283
1512
|
break;
|
|
1284
1513
|
default:
|
|
1285
|
-
x = this.getBezierValue(
|
|
1286
|
-
|
|
1514
|
+
x = this.getBezierValue(
|
|
1515
|
+
time,
|
|
1516
|
+
i,
|
|
1517
|
+
1,
|
|
1518
|
+
curveType - 2
|
|
1519
|
+
/*BEZIER*/
|
|
1520
|
+
);
|
|
1521
|
+
y = this.getBezierValue(
|
|
1522
|
+
time,
|
|
1523
|
+
i,
|
|
1524
|
+
2,
|
|
1525
|
+
curveType + 18 - 2
|
|
1526
|
+
/*BEZIER*/
|
|
1527
|
+
);
|
|
1287
1528
|
}
|
|
1288
1529
|
switch (blend) {
|
|
1289
|
-
case 0
|
|
1530
|
+
case 0 /* setup */:
|
|
1290
1531
|
bone.shearX = bone.data.shearX + x * alpha;
|
|
1291
1532
|
bone.shearY = bone.data.shearY + y * alpha;
|
|
1292
1533
|
break;
|
|
1293
|
-
case 1
|
|
1294
|
-
case 2
|
|
1534
|
+
case 1 /* first */:
|
|
1535
|
+
case 2 /* replace */:
|
|
1295
1536
|
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1296
1537
|
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1297
1538
|
break;
|
|
1298
|
-
case 3
|
|
1539
|
+
case 3 /* add */:
|
|
1299
1540
|
bone.shearX += x * alpha;
|
|
1300
1541
|
bone.shearY += y * alpha;
|
|
1301
1542
|
}
|
|
@@ -1314,24 +1555,24 @@ var spine = (() => {
|
|
|
1314
1555
|
let frames = this.frames;
|
|
1315
1556
|
if (time < frames[0]) {
|
|
1316
1557
|
switch (blend) {
|
|
1317
|
-
case 0
|
|
1558
|
+
case 0 /* setup */:
|
|
1318
1559
|
bone.shearX = bone.data.shearX;
|
|
1319
1560
|
return;
|
|
1320
|
-
case 1
|
|
1561
|
+
case 1 /* first */:
|
|
1321
1562
|
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1322
1563
|
}
|
|
1323
1564
|
return;
|
|
1324
1565
|
}
|
|
1325
1566
|
let x = this.getCurveValue(time);
|
|
1326
1567
|
switch (blend) {
|
|
1327
|
-
case 0
|
|
1568
|
+
case 0 /* setup */:
|
|
1328
1569
|
bone.shearX = bone.data.shearX + x * alpha;
|
|
1329
1570
|
break;
|
|
1330
|
-
case 1
|
|
1331
|
-
case 2
|
|
1571
|
+
case 1 /* first */:
|
|
1572
|
+
case 2 /* replace */:
|
|
1332
1573
|
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1333
1574
|
break;
|
|
1334
|
-
case 3
|
|
1575
|
+
case 3 /* add */:
|
|
1335
1576
|
bone.shearX += x * alpha;
|
|
1336
1577
|
}
|
|
1337
1578
|
}
|
|
@@ -1349,24 +1590,24 @@ var spine = (() => {
|
|
|
1349
1590
|
let frames = this.frames;
|
|
1350
1591
|
if (time < frames[0]) {
|
|
1351
1592
|
switch (blend) {
|
|
1352
|
-
case 0
|
|
1593
|
+
case 0 /* setup */:
|
|
1353
1594
|
bone.shearY = bone.data.shearY;
|
|
1354
1595
|
return;
|
|
1355
|
-
case 1
|
|
1596
|
+
case 1 /* first */:
|
|
1356
1597
|
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1357
1598
|
}
|
|
1358
1599
|
return;
|
|
1359
1600
|
}
|
|
1360
1601
|
let y = this.getCurveValue(time);
|
|
1361
1602
|
switch (blend) {
|
|
1362
|
-
case 0
|
|
1603
|
+
case 0 /* setup */:
|
|
1363
1604
|
bone.shearY = bone.data.shearY + y * alpha;
|
|
1364
1605
|
break;
|
|
1365
|
-
case 1
|
|
1366
|
-
case 2
|
|
1606
|
+
case 1 /* first */:
|
|
1607
|
+
case 2 /* replace */:
|
|
1367
1608
|
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1368
1609
|
break;
|
|
1369
|
-
case 3
|
|
1610
|
+
case 3 /* add */:
|
|
1370
1611
|
bone.shearY += y * alpha;
|
|
1371
1612
|
}
|
|
1372
1613
|
}
|
|
@@ -1383,13 +1624,26 @@ var spine = (() => {
|
|
|
1383
1624
|
getFrameEntries() {
|
|
1384
1625
|
return 5;
|
|
1385
1626
|
}
|
|
1627
|
+
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
|
|
1386
1628
|
setFrame(frame, time, r, g, b, a) {
|
|
1387
1629
|
frame *= 5;
|
|
1388
1630
|
this.frames[frame] = time;
|
|
1389
|
-
this.frames[
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1631
|
+
this.frames[
|
|
1632
|
+
frame + 1
|
|
1633
|
+
/*R*/
|
|
1634
|
+
] = r;
|
|
1635
|
+
this.frames[
|
|
1636
|
+
frame + 2
|
|
1637
|
+
/*G*/
|
|
1638
|
+
] = g;
|
|
1639
|
+
this.frames[
|
|
1640
|
+
frame + 3
|
|
1641
|
+
/*B*/
|
|
1642
|
+
] = b;
|
|
1643
|
+
this.frames[
|
|
1644
|
+
frame + 4
|
|
1645
|
+
/*A*/
|
|
1646
|
+
] = a;
|
|
1393
1647
|
}
|
|
1394
1648
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1395
1649
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1400,46 +1654,122 @@ var spine = (() => {
|
|
|
1400
1654
|
if (time < frames[0]) {
|
|
1401
1655
|
let setup = slot.data.color;
|
|
1402
1656
|
switch (blend) {
|
|
1403
|
-
case 0
|
|
1657
|
+
case 0 /* setup */:
|
|
1404
1658
|
color.setFromColor(setup);
|
|
1405
1659
|
return;
|
|
1406
|
-
case 1
|
|
1407
|
-
color.add(
|
|
1660
|
+
case 1 /* first */:
|
|
1661
|
+
color.add(
|
|
1662
|
+
(setup.r - color.r) * alpha,
|
|
1663
|
+
(setup.g - color.g) * alpha,
|
|
1664
|
+
(setup.b - color.b) * alpha,
|
|
1665
|
+
(setup.a - color.a) * alpha
|
|
1666
|
+
);
|
|
1408
1667
|
}
|
|
1409
1668
|
return;
|
|
1410
1669
|
}
|
|
1411
1670
|
let r = 0, g = 0, b = 0, a = 0;
|
|
1412
|
-
let i = Timeline.search(
|
|
1413
|
-
|
|
1671
|
+
let i = Timeline.search(
|
|
1672
|
+
frames,
|
|
1673
|
+
time,
|
|
1674
|
+
5
|
|
1675
|
+
/*ENTRIES*/
|
|
1676
|
+
);
|
|
1677
|
+
let curveType = this.curves[
|
|
1678
|
+
i / 5
|
|
1679
|
+
/*ENTRIES*/
|
|
1680
|
+
];
|
|
1414
1681
|
switch (curveType) {
|
|
1415
1682
|
case 0:
|
|
1416
1683
|
let before = frames[i];
|
|
1417
|
-
r = frames[
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1684
|
+
r = frames[
|
|
1685
|
+
i + 1
|
|
1686
|
+
/*R*/
|
|
1687
|
+
];
|
|
1688
|
+
g = frames[
|
|
1689
|
+
i + 2
|
|
1690
|
+
/*G*/
|
|
1691
|
+
];
|
|
1692
|
+
b = frames[
|
|
1693
|
+
i + 3
|
|
1694
|
+
/*B*/
|
|
1695
|
+
];
|
|
1696
|
+
a = frames[
|
|
1697
|
+
i + 4
|
|
1698
|
+
/*A*/
|
|
1699
|
+
];
|
|
1700
|
+
let t = (time - before) / (frames[
|
|
1701
|
+
i + 5
|
|
1702
|
+
/*ENTRIES*/
|
|
1703
|
+
] - before);
|
|
1704
|
+
r += (frames[
|
|
1705
|
+
i + 5 + 1
|
|
1706
|
+
/*R*/
|
|
1707
|
+
] - r) * t;
|
|
1708
|
+
g += (frames[
|
|
1709
|
+
i + 5 + 2
|
|
1710
|
+
/*G*/
|
|
1711
|
+
] - g) * t;
|
|
1712
|
+
b += (frames[
|
|
1713
|
+
i + 5 + 3
|
|
1714
|
+
/*B*/
|
|
1715
|
+
] - b) * t;
|
|
1716
|
+
a += (frames[
|
|
1717
|
+
i + 5 + 4
|
|
1718
|
+
/*A*/
|
|
1719
|
+
] - a) * t;
|
|
1426
1720
|
break;
|
|
1427
1721
|
case 1:
|
|
1428
|
-
r = frames[
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1722
|
+
r = frames[
|
|
1723
|
+
i + 1
|
|
1724
|
+
/*R*/
|
|
1725
|
+
];
|
|
1726
|
+
g = frames[
|
|
1727
|
+
i + 2
|
|
1728
|
+
/*G*/
|
|
1729
|
+
];
|
|
1730
|
+
b = frames[
|
|
1731
|
+
i + 3
|
|
1732
|
+
/*B*/
|
|
1733
|
+
];
|
|
1734
|
+
a = frames[
|
|
1735
|
+
i + 4
|
|
1736
|
+
/*A*/
|
|
1737
|
+
];
|
|
1432
1738
|
break;
|
|
1433
1739
|
default:
|
|
1434
|
-
r = this.getBezierValue(
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1740
|
+
r = this.getBezierValue(
|
|
1741
|
+
time,
|
|
1742
|
+
i,
|
|
1743
|
+
1,
|
|
1744
|
+
curveType - 2
|
|
1745
|
+
/*BEZIER*/
|
|
1746
|
+
);
|
|
1747
|
+
g = this.getBezierValue(
|
|
1748
|
+
time,
|
|
1749
|
+
i,
|
|
1750
|
+
2,
|
|
1751
|
+
curveType + 18 - 2
|
|
1752
|
+
/*BEZIER*/
|
|
1753
|
+
);
|
|
1754
|
+
b = this.getBezierValue(
|
|
1755
|
+
time,
|
|
1756
|
+
i,
|
|
1757
|
+
3,
|
|
1758
|
+
curveType + 18 * 2 - 2
|
|
1759
|
+
/*BEZIER*/
|
|
1760
|
+
);
|
|
1761
|
+
a = this.getBezierValue(
|
|
1762
|
+
time,
|
|
1763
|
+
i,
|
|
1764
|
+
4,
|
|
1765
|
+
curveType + 18 * 3 - 2
|
|
1766
|
+
/*BEZIER*/
|
|
1767
|
+
);
|
|
1438
1768
|
}
|
|
1439
1769
|
if (alpha == 1)
|
|
1440
1770
|
color.set(r, g, b, a);
|
|
1441
1771
|
else {
|
|
1442
|
-
if (blend == 0)
|
|
1772
|
+
if (blend == 0 /* setup */)
|
|
1443
1773
|
color.setFromColor(slot.data.color);
|
|
1444
1774
|
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
|
1445
1775
|
}
|
|
@@ -1456,12 +1786,22 @@ var spine = (() => {
|
|
|
1456
1786
|
getFrameEntries() {
|
|
1457
1787
|
return 4;
|
|
1458
1788
|
}
|
|
1789
|
+
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
|
|
1459
1790
|
setFrame(frame, time, r, g, b) {
|
|
1460
1791
|
frame <<= 2;
|
|
1461
1792
|
this.frames[frame] = time;
|
|
1462
|
-
this.frames[
|
|
1463
|
-
|
|
1464
|
-
|
|
1793
|
+
this.frames[
|
|
1794
|
+
frame + 1
|
|
1795
|
+
/*R*/
|
|
1796
|
+
] = r;
|
|
1797
|
+
this.frames[
|
|
1798
|
+
frame + 2
|
|
1799
|
+
/*G*/
|
|
1800
|
+
] = g;
|
|
1801
|
+
this.frames[
|
|
1802
|
+
frame + 3
|
|
1803
|
+
/*B*/
|
|
1804
|
+
] = b;
|
|
1465
1805
|
}
|
|
1466
1806
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1467
1807
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1472,12 +1812,12 @@ var spine = (() => {
|
|
|
1472
1812
|
if (time < frames[0]) {
|
|
1473
1813
|
let setup = slot.data.color;
|
|
1474
1814
|
switch (blend) {
|
|
1475
|
-
case 0
|
|
1815
|
+
case 0 /* setup */:
|
|
1476
1816
|
color.r = setup.r;
|
|
1477
1817
|
color.g = setup.g;
|
|
1478
1818
|
color.b = setup.b;
|
|
1479
1819
|
return;
|
|
1480
|
-
case 1
|
|
1820
|
+
case 1 /* first */:
|
|
1481
1821
|
color.r += (setup.r - color.r) * alpha;
|
|
1482
1822
|
color.g += (setup.g - color.g) * alpha;
|
|
1483
1823
|
color.b += (setup.b - color.b) * alpha;
|
|
@@ -1485,35 +1825,88 @@ var spine = (() => {
|
|
|
1485
1825
|
return;
|
|
1486
1826
|
}
|
|
1487
1827
|
let r = 0, g = 0, b = 0;
|
|
1488
|
-
let i = Timeline.search(
|
|
1828
|
+
let i = Timeline.search(
|
|
1829
|
+
frames,
|
|
1830
|
+
time,
|
|
1831
|
+
4
|
|
1832
|
+
/*ENTRIES*/
|
|
1833
|
+
);
|
|
1489
1834
|
let curveType = this.curves[i >> 2];
|
|
1490
1835
|
switch (curveType) {
|
|
1491
1836
|
case 0:
|
|
1492
1837
|
let before = frames[i];
|
|
1493
|
-
r = frames[
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1838
|
+
r = frames[
|
|
1839
|
+
i + 1
|
|
1840
|
+
/*R*/
|
|
1841
|
+
];
|
|
1842
|
+
g = frames[
|
|
1843
|
+
i + 2
|
|
1844
|
+
/*G*/
|
|
1845
|
+
];
|
|
1846
|
+
b = frames[
|
|
1847
|
+
i + 3
|
|
1848
|
+
/*B*/
|
|
1849
|
+
];
|
|
1850
|
+
let t = (time - before) / (frames[
|
|
1851
|
+
i + 4
|
|
1852
|
+
/*ENTRIES*/
|
|
1853
|
+
] - before);
|
|
1854
|
+
r += (frames[
|
|
1855
|
+
i + 4 + 1
|
|
1856
|
+
/*R*/
|
|
1857
|
+
] - r) * t;
|
|
1858
|
+
g += (frames[
|
|
1859
|
+
i + 4 + 2
|
|
1860
|
+
/*G*/
|
|
1861
|
+
] - g) * t;
|
|
1862
|
+
b += (frames[
|
|
1863
|
+
i + 4 + 3
|
|
1864
|
+
/*B*/
|
|
1865
|
+
] - b) * t;
|
|
1500
1866
|
break;
|
|
1501
1867
|
case 1:
|
|
1502
|
-
r = frames[
|
|
1503
|
-
|
|
1504
|
-
|
|
1868
|
+
r = frames[
|
|
1869
|
+
i + 1
|
|
1870
|
+
/*R*/
|
|
1871
|
+
];
|
|
1872
|
+
g = frames[
|
|
1873
|
+
i + 2
|
|
1874
|
+
/*G*/
|
|
1875
|
+
];
|
|
1876
|
+
b = frames[
|
|
1877
|
+
i + 3
|
|
1878
|
+
/*B*/
|
|
1879
|
+
];
|
|
1505
1880
|
break;
|
|
1506
1881
|
default:
|
|
1507
|
-
r = this.getBezierValue(
|
|
1508
|
-
|
|
1509
|
-
|
|
1882
|
+
r = this.getBezierValue(
|
|
1883
|
+
time,
|
|
1884
|
+
i,
|
|
1885
|
+
1,
|
|
1886
|
+
curveType - 2
|
|
1887
|
+
/*BEZIER*/
|
|
1888
|
+
);
|
|
1889
|
+
g = this.getBezierValue(
|
|
1890
|
+
time,
|
|
1891
|
+
i,
|
|
1892
|
+
2,
|
|
1893
|
+
curveType + 18 - 2
|
|
1894
|
+
/*BEZIER*/
|
|
1895
|
+
);
|
|
1896
|
+
b = this.getBezierValue(
|
|
1897
|
+
time,
|
|
1898
|
+
i,
|
|
1899
|
+
3,
|
|
1900
|
+
curveType + 18 * 2 - 2
|
|
1901
|
+
/*BEZIER*/
|
|
1902
|
+
);
|
|
1510
1903
|
}
|
|
1511
1904
|
if (alpha == 1) {
|
|
1512
1905
|
color.r = r;
|
|
1513
1906
|
color.g = g;
|
|
1514
1907
|
color.b = b;
|
|
1515
1908
|
} else {
|
|
1516
|
-
if (blend == 0) {
|
|
1909
|
+
if (blend == 0 /* setup */) {
|
|
1517
1910
|
let setup = slot.data.color;
|
|
1518
1911
|
color.r = setup.r;
|
|
1519
1912
|
color.g = setup.g;
|
|
@@ -1539,10 +1932,10 @@ var spine = (() => {
|
|
|
1539
1932
|
if (time < this.frames[0]) {
|
|
1540
1933
|
let setup = slot.data.color;
|
|
1541
1934
|
switch (blend) {
|
|
1542
|
-
case 0
|
|
1935
|
+
case 0 /* setup */:
|
|
1543
1936
|
color.a = setup.a;
|
|
1544
1937
|
return;
|
|
1545
|
-
case 1
|
|
1938
|
+
case 1 /* first */:
|
|
1546
1939
|
color.a += (setup.a - color.a) * alpha;
|
|
1547
1940
|
}
|
|
1548
1941
|
return;
|
|
@@ -1551,7 +1944,7 @@ var spine = (() => {
|
|
|
1551
1944
|
if (alpha == 1)
|
|
1552
1945
|
color.a = a;
|
|
1553
1946
|
else {
|
|
1554
|
-
if (blend == 0)
|
|
1947
|
+
if (blend == 0 /* setup */)
|
|
1555
1948
|
color.a = slot.data.color.a;
|
|
1556
1949
|
color.a += (a - color.a) * alpha;
|
|
1557
1950
|
}
|
|
@@ -1570,16 +1963,38 @@ var spine = (() => {
|
|
|
1570
1963
|
getFrameEntries() {
|
|
1571
1964
|
return 8;
|
|
1572
1965
|
}
|
|
1966
|
+
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
|
|
1573
1967
|
setFrame(frame, time, r, g, b, a, r2, g2, b2) {
|
|
1574
1968
|
frame <<= 3;
|
|
1575
1969
|
this.frames[frame] = time;
|
|
1576
|
-
this.frames[
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
this.frames[
|
|
1581
|
-
|
|
1582
|
-
|
|
1970
|
+
this.frames[
|
|
1971
|
+
frame + 1
|
|
1972
|
+
/*R*/
|
|
1973
|
+
] = r;
|
|
1974
|
+
this.frames[
|
|
1975
|
+
frame + 2
|
|
1976
|
+
/*G*/
|
|
1977
|
+
] = g;
|
|
1978
|
+
this.frames[
|
|
1979
|
+
frame + 3
|
|
1980
|
+
/*B*/
|
|
1981
|
+
] = b;
|
|
1982
|
+
this.frames[
|
|
1983
|
+
frame + 4
|
|
1984
|
+
/*A*/
|
|
1985
|
+
] = a;
|
|
1986
|
+
this.frames[
|
|
1987
|
+
frame + 5
|
|
1988
|
+
/*R2*/
|
|
1989
|
+
] = r2;
|
|
1990
|
+
this.frames[
|
|
1991
|
+
frame + 6
|
|
1992
|
+
/*G2*/
|
|
1993
|
+
] = g2;
|
|
1994
|
+
this.frames[
|
|
1995
|
+
frame + 7
|
|
1996
|
+
/*B2*/
|
|
1997
|
+
] = b2;
|
|
1583
1998
|
}
|
|
1584
1999
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1585
2000
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1590,14 +2005,19 @@ var spine = (() => {
|
|
|
1590
2005
|
if (time < frames[0]) {
|
|
1591
2006
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1592
2007
|
switch (blend) {
|
|
1593
|
-
case 0
|
|
2008
|
+
case 0 /* setup */:
|
|
1594
2009
|
light.setFromColor(setupLight);
|
|
1595
2010
|
dark.r = setupDark.r;
|
|
1596
2011
|
dark.g = setupDark.g;
|
|
1597
2012
|
dark.b = setupDark.b;
|
|
1598
2013
|
return;
|
|
1599
|
-
case 1
|
|
1600
|
-
light.add(
|
|
2014
|
+
case 1 /* first */:
|
|
2015
|
+
light.add(
|
|
2016
|
+
(setupLight.r - light.r) * alpha,
|
|
2017
|
+
(setupLight.g - light.g) * alpha,
|
|
2018
|
+
(setupLight.b - light.b) * alpha,
|
|
2019
|
+
(setupLight.a - light.a) * alpha
|
|
2020
|
+
);
|
|
1601
2021
|
dark.r += (setupDark.r - dark.r) * alpha;
|
|
1602
2022
|
dark.g += (setupDark.g - dark.g) * alpha;
|
|
1603
2023
|
dark.b += (setupDark.b - dark.b) * alpha;
|
|
@@ -1605,44 +2025,157 @@ var spine = (() => {
|
|
|
1605
2025
|
return;
|
|
1606
2026
|
}
|
|
1607
2027
|
let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
|
|
1608
|
-
let i = Timeline.search(
|
|
2028
|
+
let i = Timeline.search(
|
|
2029
|
+
frames,
|
|
2030
|
+
time,
|
|
2031
|
+
8
|
|
2032
|
+
/*ENTRIES*/
|
|
2033
|
+
);
|
|
1609
2034
|
let curveType = this.curves[i >> 3];
|
|
1610
2035
|
switch (curveType) {
|
|
1611
2036
|
case 0:
|
|
1612
2037
|
let before = frames[i];
|
|
1613
|
-
r = frames[
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
2038
|
+
r = frames[
|
|
2039
|
+
i + 1
|
|
2040
|
+
/*R*/
|
|
2041
|
+
];
|
|
2042
|
+
g = frames[
|
|
2043
|
+
i + 2
|
|
2044
|
+
/*G*/
|
|
2045
|
+
];
|
|
2046
|
+
b = frames[
|
|
2047
|
+
i + 3
|
|
2048
|
+
/*B*/
|
|
2049
|
+
];
|
|
2050
|
+
a = frames[
|
|
2051
|
+
i + 4
|
|
2052
|
+
/*A*/
|
|
2053
|
+
];
|
|
2054
|
+
r2 = frames[
|
|
2055
|
+
i + 5
|
|
2056
|
+
/*R2*/
|
|
2057
|
+
];
|
|
2058
|
+
g2 = frames[
|
|
2059
|
+
i + 6
|
|
2060
|
+
/*G2*/
|
|
2061
|
+
];
|
|
2062
|
+
b2 = frames[
|
|
2063
|
+
i + 7
|
|
2064
|
+
/*B2*/
|
|
2065
|
+
];
|
|
2066
|
+
let t = (time - before) / (frames[
|
|
2067
|
+
i + 8
|
|
2068
|
+
/*ENTRIES*/
|
|
2069
|
+
] - before);
|
|
2070
|
+
r += (frames[
|
|
2071
|
+
i + 8 + 1
|
|
2072
|
+
/*R*/
|
|
2073
|
+
] - r) * t;
|
|
2074
|
+
g += (frames[
|
|
2075
|
+
i + 8 + 2
|
|
2076
|
+
/*G*/
|
|
2077
|
+
] - g) * t;
|
|
2078
|
+
b += (frames[
|
|
2079
|
+
i + 8 + 3
|
|
2080
|
+
/*B*/
|
|
2081
|
+
] - b) * t;
|
|
2082
|
+
a += (frames[
|
|
2083
|
+
i + 8 + 4
|
|
2084
|
+
/*A*/
|
|
2085
|
+
] - a) * t;
|
|
2086
|
+
r2 += (frames[
|
|
2087
|
+
i + 8 + 5
|
|
2088
|
+
/*R2*/
|
|
2089
|
+
] - r2) * t;
|
|
2090
|
+
g2 += (frames[
|
|
2091
|
+
i + 8 + 6
|
|
2092
|
+
/*G2*/
|
|
2093
|
+
] - g2) * t;
|
|
2094
|
+
b2 += (frames[
|
|
2095
|
+
i + 8 + 7
|
|
2096
|
+
/*B2*/
|
|
2097
|
+
] - b2) * t;
|
|
1628
2098
|
break;
|
|
1629
2099
|
case 1:
|
|
1630
|
-
r = frames[
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
2100
|
+
r = frames[
|
|
2101
|
+
i + 1
|
|
2102
|
+
/*R*/
|
|
2103
|
+
];
|
|
2104
|
+
g = frames[
|
|
2105
|
+
i + 2
|
|
2106
|
+
/*G*/
|
|
2107
|
+
];
|
|
2108
|
+
b = frames[
|
|
2109
|
+
i + 3
|
|
2110
|
+
/*B*/
|
|
2111
|
+
];
|
|
2112
|
+
a = frames[
|
|
2113
|
+
i + 4
|
|
2114
|
+
/*A*/
|
|
2115
|
+
];
|
|
2116
|
+
r2 = frames[
|
|
2117
|
+
i + 5
|
|
2118
|
+
/*R2*/
|
|
2119
|
+
];
|
|
2120
|
+
g2 = frames[
|
|
2121
|
+
i + 6
|
|
2122
|
+
/*G2*/
|
|
2123
|
+
];
|
|
2124
|
+
b2 = frames[
|
|
2125
|
+
i + 7
|
|
2126
|
+
/*B2*/
|
|
2127
|
+
];
|
|
1637
2128
|
break;
|
|
1638
2129
|
default:
|
|
1639
|
-
r = this.getBezierValue(
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
2130
|
+
r = this.getBezierValue(
|
|
2131
|
+
time,
|
|
2132
|
+
i,
|
|
2133
|
+
1,
|
|
2134
|
+
curveType - 2
|
|
2135
|
+
/*BEZIER*/
|
|
2136
|
+
);
|
|
2137
|
+
g = this.getBezierValue(
|
|
2138
|
+
time,
|
|
2139
|
+
i,
|
|
2140
|
+
2,
|
|
2141
|
+
curveType + 18 - 2
|
|
2142
|
+
/*BEZIER*/
|
|
2143
|
+
);
|
|
2144
|
+
b = this.getBezierValue(
|
|
2145
|
+
time,
|
|
2146
|
+
i,
|
|
2147
|
+
3,
|
|
2148
|
+
curveType + 18 * 2 - 2
|
|
2149
|
+
/*BEZIER*/
|
|
2150
|
+
);
|
|
2151
|
+
a = this.getBezierValue(
|
|
2152
|
+
time,
|
|
2153
|
+
i,
|
|
2154
|
+
4,
|
|
2155
|
+
curveType + 18 * 3 - 2
|
|
2156
|
+
/*BEZIER*/
|
|
2157
|
+
);
|
|
2158
|
+
r2 = this.getBezierValue(
|
|
2159
|
+
time,
|
|
2160
|
+
i,
|
|
2161
|
+
5,
|
|
2162
|
+
curveType + 18 * 4 - 2
|
|
2163
|
+
/*BEZIER*/
|
|
2164
|
+
);
|
|
2165
|
+
g2 = this.getBezierValue(
|
|
2166
|
+
time,
|
|
2167
|
+
i,
|
|
2168
|
+
6,
|
|
2169
|
+
curveType + 18 * 5 - 2
|
|
2170
|
+
/*BEZIER*/
|
|
2171
|
+
);
|
|
2172
|
+
b2 = this.getBezierValue(
|
|
2173
|
+
time,
|
|
2174
|
+
i,
|
|
2175
|
+
7,
|
|
2176
|
+
curveType + 18 * 6 - 2
|
|
2177
|
+
/*BEZIER*/
|
|
2178
|
+
);
|
|
1646
2179
|
}
|
|
1647
2180
|
if (alpha == 1) {
|
|
1648
2181
|
light.set(r, g, b, a);
|
|
@@ -1650,7 +2183,7 @@ var spine = (() => {
|
|
|
1650
2183
|
dark.g = g2;
|
|
1651
2184
|
dark.b = b2;
|
|
1652
2185
|
} else {
|
|
1653
|
-
if (blend == 0) {
|
|
2186
|
+
if (blend == 0 /* setup */) {
|
|
1654
2187
|
light.setFromColor(slot.data.color);
|
|
1655
2188
|
let setupDark = slot.data.darkColor;
|
|
1656
2189
|
dark.r = setupDark.r;
|
|
@@ -1676,15 +2209,34 @@ var spine = (() => {
|
|
|
1676
2209
|
getFrameEntries() {
|
|
1677
2210
|
return 7;
|
|
1678
2211
|
}
|
|
2212
|
+
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
|
|
1679
2213
|
setFrame(frame, time, r, g, b, r2, g2, b2) {
|
|
1680
2214
|
frame *= 7;
|
|
1681
2215
|
this.frames[frame] = time;
|
|
1682
|
-
this.frames[
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
this.frames[
|
|
1687
|
-
|
|
2216
|
+
this.frames[
|
|
2217
|
+
frame + 1
|
|
2218
|
+
/*R*/
|
|
2219
|
+
] = r;
|
|
2220
|
+
this.frames[
|
|
2221
|
+
frame + 2
|
|
2222
|
+
/*G*/
|
|
2223
|
+
] = g;
|
|
2224
|
+
this.frames[
|
|
2225
|
+
frame + 3
|
|
2226
|
+
/*B*/
|
|
2227
|
+
] = b;
|
|
2228
|
+
this.frames[
|
|
2229
|
+
frame + 4
|
|
2230
|
+
/*R2*/
|
|
2231
|
+
] = r2;
|
|
2232
|
+
this.frames[
|
|
2233
|
+
frame + 5
|
|
2234
|
+
/*G2*/
|
|
2235
|
+
] = g2;
|
|
2236
|
+
this.frames[
|
|
2237
|
+
frame + 6
|
|
2238
|
+
/*B2*/
|
|
2239
|
+
] = b2;
|
|
1688
2240
|
}
|
|
1689
2241
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1690
2242
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1695,7 +2247,7 @@ var spine = (() => {
|
|
|
1695
2247
|
if (time < frames[0]) {
|
|
1696
2248
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1697
2249
|
switch (blend) {
|
|
1698
|
-
case 0
|
|
2250
|
+
case 0 /* setup */:
|
|
1699
2251
|
light.r = setupLight.r;
|
|
1700
2252
|
light.g = setupLight.g;
|
|
1701
2253
|
light.b = setupLight.b;
|
|
@@ -1703,7 +2255,7 @@ var spine = (() => {
|
|
|
1703
2255
|
dark.g = setupDark.g;
|
|
1704
2256
|
dark.b = setupDark.b;
|
|
1705
2257
|
return;
|
|
1706
|
-
case 1
|
|
2258
|
+
case 1 /* first */:
|
|
1707
2259
|
light.r += (setupLight.r - light.r) * alpha;
|
|
1708
2260
|
light.g += (setupLight.g - light.g) * alpha;
|
|
1709
2261
|
light.b += (setupLight.b - light.b) * alpha;
|
|
@@ -1714,40 +2266,141 @@ var spine = (() => {
|
|
|
1714
2266
|
return;
|
|
1715
2267
|
}
|
|
1716
2268
|
let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
|
|
1717
|
-
let i = Timeline.search(
|
|
1718
|
-
|
|
2269
|
+
let i = Timeline.search(
|
|
2270
|
+
frames,
|
|
2271
|
+
time,
|
|
2272
|
+
7
|
|
2273
|
+
/*ENTRIES*/
|
|
2274
|
+
);
|
|
2275
|
+
let curveType = this.curves[
|
|
2276
|
+
i / 7
|
|
2277
|
+
/*ENTRIES*/
|
|
2278
|
+
];
|
|
1719
2279
|
switch (curveType) {
|
|
1720
2280
|
case 0:
|
|
1721
2281
|
let before = frames[i];
|
|
1722
|
-
r = frames[
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2282
|
+
r = frames[
|
|
2283
|
+
i + 1
|
|
2284
|
+
/*R*/
|
|
2285
|
+
];
|
|
2286
|
+
g = frames[
|
|
2287
|
+
i + 2
|
|
2288
|
+
/*G*/
|
|
2289
|
+
];
|
|
2290
|
+
b = frames[
|
|
2291
|
+
i + 3
|
|
2292
|
+
/*B*/
|
|
2293
|
+
];
|
|
2294
|
+
r2 = frames[
|
|
2295
|
+
i + 4
|
|
2296
|
+
/*R2*/
|
|
2297
|
+
];
|
|
2298
|
+
g2 = frames[
|
|
2299
|
+
i + 5
|
|
2300
|
+
/*G2*/
|
|
2301
|
+
];
|
|
2302
|
+
b2 = frames[
|
|
2303
|
+
i + 6
|
|
2304
|
+
/*B2*/
|
|
2305
|
+
];
|
|
2306
|
+
let t = (time - before) / (frames[
|
|
2307
|
+
i + 7
|
|
2308
|
+
/*ENTRIES*/
|
|
2309
|
+
] - before);
|
|
2310
|
+
r += (frames[
|
|
2311
|
+
i + 7 + 1
|
|
2312
|
+
/*R*/
|
|
2313
|
+
] - r) * t;
|
|
2314
|
+
g += (frames[
|
|
2315
|
+
i + 7 + 2
|
|
2316
|
+
/*G*/
|
|
2317
|
+
] - g) * t;
|
|
2318
|
+
b += (frames[
|
|
2319
|
+
i + 7 + 3
|
|
2320
|
+
/*B*/
|
|
2321
|
+
] - b) * t;
|
|
2322
|
+
r2 += (frames[
|
|
2323
|
+
i + 7 + 4
|
|
2324
|
+
/*R2*/
|
|
2325
|
+
] - r2) * t;
|
|
2326
|
+
g2 += (frames[
|
|
2327
|
+
i + 7 + 5
|
|
2328
|
+
/*G2*/
|
|
2329
|
+
] - g2) * t;
|
|
2330
|
+
b2 += (frames[
|
|
2331
|
+
i + 7 + 6
|
|
2332
|
+
/*B2*/
|
|
2333
|
+
] - b2) * t;
|
|
1735
2334
|
break;
|
|
1736
2335
|
case 1:
|
|
1737
|
-
r = frames[
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
2336
|
+
r = frames[
|
|
2337
|
+
i + 1
|
|
2338
|
+
/*R*/
|
|
2339
|
+
];
|
|
2340
|
+
g = frames[
|
|
2341
|
+
i + 2
|
|
2342
|
+
/*G*/
|
|
2343
|
+
];
|
|
2344
|
+
b = frames[
|
|
2345
|
+
i + 3
|
|
2346
|
+
/*B*/
|
|
2347
|
+
];
|
|
2348
|
+
r2 = frames[
|
|
2349
|
+
i + 4
|
|
2350
|
+
/*R2*/
|
|
2351
|
+
];
|
|
2352
|
+
g2 = frames[
|
|
2353
|
+
i + 5
|
|
2354
|
+
/*G2*/
|
|
2355
|
+
];
|
|
2356
|
+
b2 = frames[
|
|
2357
|
+
i + 6
|
|
2358
|
+
/*B2*/
|
|
2359
|
+
];
|
|
1743
2360
|
break;
|
|
1744
2361
|
default:
|
|
1745
|
-
r = this.getBezierValue(
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2362
|
+
r = this.getBezierValue(
|
|
2363
|
+
time,
|
|
2364
|
+
i,
|
|
2365
|
+
1,
|
|
2366
|
+
curveType - 2
|
|
2367
|
+
/*BEZIER*/
|
|
2368
|
+
);
|
|
2369
|
+
g = this.getBezierValue(
|
|
2370
|
+
time,
|
|
2371
|
+
i,
|
|
2372
|
+
2,
|
|
2373
|
+
curveType + 18 - 2
|
|
2374
|
+
/*BEZIER*/
|
|
2375
|
+
);
|
|
2376
|
+
b = this.getBezierValue(
|
|
2377
|
+
time,
|
|
2378
|
+
i,
|
|
2379
|
+
3,
|
|
2380
|
+
curveType + 18 * 2 - 2
|
|
2381
|
+
/*BEZIER*/
|
|
2382
|
+
);
|
|
2383
|
+
r2 = this.getBezierValue(
|
|
2384
|
+
time,
|
|
2385
|
+
i,
|
|
2386
|
+
4,
|
|
2387
|
+
curveType + 18 * 3 - 2
|
|
2388
|
+
/*BEZIER*/
|
|
2389
|
+
);
|
|
2390
|
+
g2 = this.getBezierValue(
|
|
2391
|
+
time,
|
|
2392
|
+
i,
|
|
2393
|
+
5,
|
|
2394
|
+
curveType + 18 * 4 - 2
|
|
2395
|
+
/*BEZIER*/
|
|
2396
|
+
);
|
|
2397
|
+
b2 = this.getBezierValue(
|
|
2398
|
+
time,
|
|
2399
|
+
i,
|
|
2400
|
+
6,
|
|
2401
|
+
curveType + 18 * 5 - 2
|
|
2402
|
+
/*BEZIER*/
|
|
2403
|
+
);
|
|
1751
2404
|
}
|
|
1752
2405
|
if (alpha == 1) {
|
|
1753
2406
|
light.r = r;
|
|
@@ -1757,7 +2410,7 @@ var spine = (() => {
|
|
|
1757
2410
|
dark.g = g2;
|
|
1758
2411
|
dark.b = b2;
|
|
1759
2412
|
} else {
|
|
1760
|
-
if (blend == 0) {
|
|
2413
|
+
if (blend == 0 /* setup */) {
|
|
1761
2414
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1762
2415
|
light.r = setupLight.r;
|
|
1763
2416
|
light.g = setupLight.g;
|
|
@@ -1787,6 +2440,7 @@ var spine = (() => {
|
|
|
1787
2440
|
getFrameCount() {
|
|
1788
2441
|
return this.frames.length;
|
|
1789
2442
|
}
|
|
2443
|
+
/** Sets the time in seconds and the attachment name for the specified key frame. */
|
|
1790
2444
|
setFrame(frame, time, attachmentName) {
|
|
1791
2445
|
this.frames[frame] = time;
|
|
1792
2446
|
this.attachmentNames[frame] = attachmentName;
|
|
@@ -1795,13 +2449,13 @@ var spine = (() => {
|
|
|
1795
2449
|
let slot = skeleton.slots[this.slotIndex];
|
|
1796
2450
|
if (!slot.bone.active)
|
|
1797
2451
|
return;
|
|
1798
|
-
if (direction == 1) {
|
|
1799
|
-
if (blend == 0)
|
|
2452
|
+
if (direction == 1 /* mixOut */) {
|
|
2453
|
+
if (blend == 0 /* setup */)
|
|
1800
2454
|
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
1801
2455
|
return;
|
|
1802
2456
|
}
|
|
1803
2457
|
if (time < this.frames[0]) {
|
|
1804
|
-
if (blend == 0 || blend == 1)
|
|
2458
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
1805
2459
|
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
1806
2460
|
return;
|
|
1807
2461
|
}
|
|
@@ -1824,10 +2478,14 @@ var spine = (() => {
|
|
|
1824
2478
|
getFrameCount() {
|
|
1825
2479
|
return this.frames.length;
|
|
1826
2480
|
}
|
|
2481
|
+
/** Sets the time in seconds and the vertices for the specified key frame.
|
|
2482
|
+
* @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */
|
|
1827
2483
|
setFrame(frame, time, vertices) {
|
|
1828
2484
|
this.frames[frame] = time;
|
|
1829
2485
|
this.vertices[frame] = vertices;
|
|
1830
2486
|
}
|
|
2487
|
+
/** @param value1 Ignored (0 is used for a deform timeline).
|
|
2488
|
+
* @param value2 Ignored (1 is used for a deform timeline). */
|
|
1831
2489
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
1832
2490
|
let curves = this.curves;
|
|
1833
2491
|
let i = this.getFrameCount() + bezier * 18;
|
|
@@ -1885,16 +2543,16 @@ var spine = (() => {
|
|
|
1885
2543
|
return;
|
|
1886
2544
|
let deform = slot.deform;
|
|
1887
2545
|
if (deform.length == 0)
|
|
1888
|
-
blend = 0
|
|
2546
|
+
blend = 0 /* setup */;
|
|
1889
2547
|
let vertices = this.vertices;
|
|
1890
2548
|
let vertexCount = vertices[0].length;
|
|
1891
2549
|
let frames = this.frames;
|
|
1892
2550
|
if (time < frames[0]) {
|
|
1893
2551
|
switch (blend) {
|
|
1894
|
-
case 0
|
|
2552
|
+
case 0 /* setup */:
|
|
1895
2553
|
deform.length = 0;
|
|
1896
2554
|
return;
|
|
1897
|
-
case 1
|
|
2555
|
+
case 1 /* first */:
|
|
1898
2556
|
if (alpha == 1) {
|
|
1899
2557
|
deform.length = 0;
|
|
1900
2558
|
return;
|
|
@@ -1917,7 +2575,7 @@ var spine = (() => {
|
|
|
1917
2575
|
if (time >= frames[frames.length - 1]) {
|
|
1918
2576
|
let lastVertices = vertices[frames.length - 1];
|
|
1919
2577
|
if (alpha == 1) {
|
|
1920
|
-
if (blend == 3) {
|
|
2578
|
+
if (blend == 3 /* add */) {
|
|
1921
2579
|
let vertexAttachment = slotAttachment;
|
|
1922
2580
|
if (!vertexAttachment.bones) {
|
|
1923
2581
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1931,7 +2589,7 @@ var spine = (() => {
|
|
|
1931
2589
|
Utils.arrayCopy(lastVertices, 0, deform, 0, vertexCount);
|
|
1932
2590
|
} else {
|
|
1933
2591
|
switch (blend) {
|
|
1934
|
-
case 0
|
|
2592
|
+
case 0 /* setup */: {
|
|
1935
2593
|
let vertexAttachment2 = slotAttachment;
|
|
1936
2594
|
if (!vertexAttachment2.bones) {
|
|
1937
2595
|
let setupVertices = vertexAttachment2.vertices;
|
|
@@ -1945,12 +2603,12 @@ var spine = (() => {
|
|
|
1945
2603
|
}
|
|
1946
2604
|
break;
|
|
1947
2605
|
}
|
|
1948
|
-
case 1
|
|
1949
|
-
case 2
|
|
2606
|
+
case 1 /* first */:
|
|
2607
|
+
case 2 /* replace */:
|
|
1950
2608
|
for (let i2 = 0; i2 < vertexCount; i2++)
|
|
1951
2609
|
deform[i2] += (lastVertices[i2] - deform[i2]) * alpha;
|
|
1952
2610
|
break;
|
|
1953
|
-
case 3
|
|
2611
|
+
case 3 /* add */:
|
|
1954
2612
|
let vertexAttachment = slotAttachment;
|
|
1955
2613
|
if (!vertexAttachment.bones) {
|
|
1956
2614
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1969,7 +2627,7 @@ var spine = (() => {
|
|
|
1969
2627
|
let prevVertices = vertices[frame];
|
|
1970
2628
|
let nextVertices = vertices[frame + 1];
|
|
1971
2629
|
if (alpha == 1) {
|
|
1972
|
-
if (blend == 3) {
|
|
2630
|
+
if (blend == 3 /* add */) {
|
|
1973
2631
|
let vertexAttachment = slotAttachment;
|
|
1974
2632
|
if (!vertexAttachment.bones) {
|
|
1975
2633
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1991,7 +2649,7 @@ var spine = (() => {
|
|
|
1991
2649
|
}
|
|
1992
2650
|
} else {
|
|
1993
2651
|
switch (blend) {
|
|
1994
|
-
case 0
|
|
2652
|
+
case 0 /* setup */: {
|
|
1995
2653
|
let vertexAttachment2 = slotAttachment;
|
|
1996
2654
|
if (!vertexAttachment2.bones) {
|
|
1997
2655
|
let setupVertices = vertexAttachment2.vertices;
|
|
@@ -2007,14 +2665,14 @@ var spine = (() => {
|
|
|
2007
2665
|
}
|
|
2008
2666
|
break;
|
|
2009
2667
|
}
|
|
2010
|
-
case 1
|
|
2011
|
-
case 2
|
|
2668
|
+
case 1 /* first */:
|
|
2669
|
+
case 2 /* replace */:
|
|
2012
2670
|
for (let i2 = 0; i2 < vertexCount; i2++) {
|
|
2013
2671
|
let prev = prevVertices[i2];
|
|
2014
2672
|
deform[i2] += (prev + (nextVertices[i2] - prev) * percent - deform[i2]) * alpha;
|
|
2015
2673
|
}
|
|
2016
2674
|
break;
|
|
2017
|
-
case 3
|
|
2675
|
+
case 3 /* add */:
|
|
2018
2676
|
let vertexAttachment = slotAttachment;
|
|
2019
2677
|
if (!vertexAttachment.bones) {
|
|
2020
2678
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -2040,10 +2698,12 @@ var spine = (() => {
|
|
|
2040
2698
|
getFrameCount() {
|
|
2041
2699
|
return this.frames.length;
|
|
2042
2700
|
}
|
|
2701
|
+
/** Sets the time in seconds and the event for the specified key frame. */
|
|
2043
2702
|
setFrame(frame, event) {
|
|
2044
2703
|
this.frames[frame] = event.time;
|
|
2045
2704
|
this.events[frame] = event;
|
|
2046
2705
|
}
|
|
2706
|
+
/** Fires events for frames > `lastTime` and <= `time`. */
|
|
2047
2707
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2048
2708
|
if (!firedEvents)
|
|
2049
2709
|
return;
|
|
@@ -2082,18 +2742,21 @@ var spine = (() => {
|
|
|
2082
2742
|
getFrameCount() {
|
|
2083
2743
|
return this.frames.length;
|
|
2084
2744
|
}
|
|
2745
|
+
/** Sets the time in seconds and the draw order for the specified key frame.
|
|
2746
|
+
* @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose
|
|
2747
|
+
* draw order. */
|
|
2085
2748
|
setFrame(frame, time, drawOrder) {
|
|
2086
2749
|
this.frames[frame] = time;
|
|
2087
2750
|
this.drawOrders[frame] = drawOrder;
|
|
2088
2751
|
}
|
|
2089
2752
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2090
|
-
if (direction == 1) {
|
|
2091
|
-
if (blend == 0)
|
|
2753
|
+
if (direction == 1 /* mixOut */) {
|
|
2754
|
+
if (blend == 0 /* setup */)
|
|
2092
2755
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2093
2756
|
return;
|
|
2094
2757
|
}
|
|
2095
2758
|
if (time < this.frames[0]) {
|
|
2096
|
-
if (blend == 0 || blend == 1)
|
|
2759
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2097
2760
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2098
2761
|
return;
|
|
2099
2762
|
}
|
|
@@ -2116,20 +2779,37 @@ var spine = (() => {
|
|
|
2116
2779
|
super(frameCount, bezierCount, [
|
|
2117
2780
|
Property.ikConstraint + "|" + ikConstraintIndex
|
|
2118
2781
|
]);
|
|
2782
|
+
/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
|
|
2119
2783
|
this.ikConstraintIndex = 0;
|
|
2120
2784
|
this.ikConstraintIndex = ikConstraintIndex;
|
|
2121
2785
|
}
|
|
2122
2786
|
getFrameEntries() {
|
|
2123
2787
|
return 6;
|
|
2124
2788
|
}
|
|
2789
|
+
/** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */
|
|
2125
2790
|
setFrame(frame, time, mix, softness, bendDirection, compress, stretch) {
|
|
2126
2791
|
frame *= 6;
|
|
2127
2792
|
this.frames[frame] = time;
|
|
2128
|
-
this.frames[
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
this.frames[
|
|
2793
|
+
this.frames[
|
|
2794
|
+
frame + 1
|
|
2795
|
+
/*MIX*/
|
|
2796
|
+
] = mix;
|
|
2797
|
+
this.frames[
|
|
2798
|
+
frame + 2
|
|
2799
|
+
/*SOFTNESS*/
|
|
2800
|
+
] = softness;
|
|
2801
|
+
this.frames[
|
|
2802
|
+
frame + 3
|
|
2803
|
+
/*BEND_DIRECTION*/
|
|
2804
|
+
] = bendDirection;
|
|
2805
|
+
this.frames[
|
|
2806
|
+
frame + 4
|
|
2807
|
+
/*COMPRESS*/
|
|
2808
|
+
] = compress ? 1 : 0;
|
|
2809
|
+
this.frames[
|
|
2810
|
+
frame + 5
|
|
2811
|
+
/*STRETCH*/
|
|
2812
|
+
] = stretch ? 1 : 0;
|
|
2133
2813
|
}
|
|
2134
2814
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2135
2815
|
let constraint = skeleton.ikConstraints[this.ikConstraintIndex];
|
|
@@ -2138,14 +2818,14 @@ var spine = (() => {
|
|
|
2138
2818
|
let frames = this.frames;
|
|
2139
2819
|
if (time < frames[0]) {
|
|
2140
2820
|
switch (blend) {
|
|
2141
|
-
case 0
|
|
2821
|
+
case 0 /* setup */:
|
|
2142
2822
|
constraint.mix = constraint.data.mix;
|
|
2143
2823
|
constraint.softness = constraint.data.softness;
|
|
2144
2824
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
2145
2825
|
constraint.compress = constraint.data.compress;
|
|
2146
2826
|
constraint.stretch = constraint.data.stretch;
|
|
2147
2827
|
return;
|
|
2148
|
-
case 1
|
|
2828
|
+
case 1 /* first */:
|
|
2149
2829
|
constraint.mix += (constraint.data.mix - constraint.mix) * alpha;
|
|
2150
2830
|
constraint.softness += (constraint.data.softness - constraint.softness) * alpha;
|
|
2151
2831
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
@@ -2155,44 +2835,103 @@ var spine = (() => {
|
|
|
2155
2835
|
return;
|
|
2156
2836
|
}
|
|
2157
2837
|
let mix = 0, softness = 0;
|
|
2158
|
-
let i = Timeline.search(
|
|
2159
|
-
|
|
2838
|
+
let i = Timeline.search(
|
|
2839
|
+
frames,
|
|
2840
|
+
time,
|
|
2841
|
+
6
|
|
2842
|
+
/*ENTRIES*/
|
|
2843
|
+
);
|
|
2844
|
+
let curveType = this.curves[
|
|
2845
|
+
i / 6
|
|
2846
|
+
/*ENTRIES*/
|
|
2847
|
+
];
|
|
2160
2848
|
switch (curveType) {
|
|
2161
2849
|
case 0:
|
|
2162
2850
|
let before = frames[i];
|
|
2163
|
-
mix = frames[
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
softness
|
|
2851
|
+
mix = frames[
|
|
2852
|
+
i + 1
|
|
2853
|
+
/*MIX*/
|
|
2854
|
+
];
|
|
2855
|
+
softness = frames[
|
|
2856
|
+
i + 2
|
|
2857
|
+
/*SOFTNESS*/
|
|
2858
|
+
];
|
|
2859
|
+
let t = (time - before) / (frames[
|
|
2860
|
+
i + 6
|
|
2861
|
+
/*ENTRIES*/
|
|
2862
|
+
] - before);
|
|
2863
|
+
mix += (frames[
|
|
2864
|
+
i + 6 + 1
|
|
2865
|
+
/*MIX*/
|
|
2866
|
+
] - mix) * t;
|
|
2867
|
+
softness += (frames[
|
|
2868
|
+
i + 6 + 2
|
|
2869
|
+
/*SOFTNESS*/
|
|
2870
|
+
] - softness) * t;
|
|
2168
2871
|
break;
|
|
2169
2872
|
case 1:
|
|
2170
|
-
mix = frames[
|
|
2171
|
-
|
|
2873
|
+
mix = frames[
|
|
2874
|
+
i + 1
|
|
2875
|
+
/*MIX*/
|
|
2876
|
+
];
|
|
2877
|
+
softness = frames[
|
|
2878
|
+
i + 2
|
|
2879
|
+
/*SOFTNESS*/
|
|
2880
|
+
];
|
|
2172
2881
|
break;
|
|
2173
2882
|
default:
|
|
2174
|
-
mix = this.getBezierValue(
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2883
|
+
mix = this.getBezierValue(
|
|
2884
|
+
time,
|
|
2885
|
+
i,
|
|
2886
|
+
1,
|
|
2887
|
+
curveType - 2
|
|
2888
|
+
/*BEZIER*/
|
|
2889
|
+
);
|
|
2890
|
+
softness = this.getBezierValue(
|
|
2891
|
+
time,
|
|
2892
|
+
i,
|
|
2893
|
+
2,
|
|
2894
|
+
curveType + 18 - 2
|
|
2895
|
+
/*BEZIER*/
|
|
2896
|
+
);
|
|
2897
|
+
}
|
|
2898
|
+
if (blend == 0 /* setup */) {
|
|
2178
2899
|
constraint.mix = constraint.data.mix + (mix - constraint.data.mix) * alpha;
|
|
2179
2900
|
constraint.softness = constraint.data.softness + (softness - constraint.data.softness) * alpha;
|
|
2180
|
-
if (direction == 1) {
|
|
2901
|
+
if (direction == 1 /* mixOut */) {
|
|
2181
2902
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
2182
2903
|
constraint.compress = constraint.data.compress;
|
|
2183
2904
|
constraint.stretch = constraint.data.stretch;
|
|
2184
2905
|
} else {
|
|
2185
|
-
constraint.bendDirection = frames[
|
|
2186
|
-
|
|
2187
|
-
|
|
2906
|
+
constraint.bendDirection = frames[
|
|
2907
|
+
i + 3
|
|
2908
|
+
/*BEND_DIRECTION*/
|
|
2909
|
+
];
|
|
2910
|
+
constraint.compress = frames[
|
|
2911
|
+
i + 4
|
|
2912
|
+
/*COMPRESS*/
|
|
2913
|
+
] != 0;
|
|
2914
|
+
constraint.stretch = frames[
|
|
2915
|
+
i + 5
|
|
2916
|
+
/*STRETCH*/
|
|
2917
|
+
] != 0;
|
|
2188
2918
|
}
|
|
2189
2919
|
} else {
|
|
2190
2920
|
constraint.mix += (mix - constraint.mix) * alpha;
|
|
2191
2921
|
constraint.softness += (softness - constraint.softness) * alpha;
|
|
2192
|
-
if (direction == 0) {
|
|
2193
|
-
constraint.bendDirection = frames[
|
|
2194
|
-
|
|
2195
|
-
|
|
2922
|
+
if (direction == 0 /* mixIn */) {
|
|
2923
|
+
constraint.bendDirection = frames[
|
|
2924
|
+
i + 3
|
|
2925
|
+
/*BEND_DIRECTION*/
|
|
2926
|
+
];
|
|
2927
|
+
constraint.compress = frames[
|
|
2928
|
+
i + 4
|
|
2929
|
+
/*COMPRESS*/
|
|
2930
|
+
] != 0;
|
|
2931
|
+
constraint.stretch = frames[
|
|
2932
|
+
i + 5
|
|
2933
|
+
/*STRETCH*/
|
|
2934
|
+
] != 0;
|
|
2196
2935
|
}
|
|
2197
2936
|
}
|
|
2198
2937
|
}
|
|
@@ -2202,22 +2941,42 @@ var spine = (() => {
|
|
|
2202
2941
|
super(frameCount, bezierCount, [
|
|
2203
2942
|
Property.transformConstraint + "|" + transformConstraintIndex
|
|
2204
2943
|
]);
|
|
2944
|
+
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
|
2205
2945
|
this.transformConstraintIndex = 0;
|
|
2206
2946
|
this.transformConstraintIndex = transformConstraintIndex;
|
|
2207
2947
|
}
|
|
2208
2948
|
getFrameEntries() {
|
|
2209
2949
|
return 7;
|
|
2210
2950
|
}
|
|
2951
|
+
/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */
|
|
2211
2952
|
setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY) {
|
|
2212
2953
|
let frames = this.frames;
|
|
2213
2954
|
frame *= 7;
|
|
2214
2955
|
frames[frame] = time;
|
|
2215
|
-
frames[
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
frames[
|
|
2220
|
-
|
|
2956
|
+
frames[
|
|
2957
|
+
frame + 1
|
|
2958
|
+
/*ROTATE*/
|
|
2959
|
+
] = mixRotate;
|
|
2960
|
+
frames[
|
|
2961
|
+
frame + 2
|
|
2962
|
+
/*X*/
|
|
2963
|
+
] = mixX;
|
|
2964
|
+
frames[
|
|
2965
|
+
frame + 3
|
|
2966
|
+
/*Y*/
|
|
2967
|
+
] = mixY;
|
|
2968
|
+
frames[
|
|
2969
|
+
frame + 4
|
|
2970
|
+
/*SCALEX*/
|
|
2971
|
+
] = mixScaleX;
|
|
2972
|
+
frames[
|
|
2973
|
+
frame + 5
|
|
2974
|
+
/*SCALEY*/
|
|
2975
|
+
] = mixScaleY;
|
|
2976
|
+
frames[
|
|
2977
|
+
frame + 6
|
|
2978
|
+
/*SHEARY*/
|
|
2979
|
+
] = mixShearY;
|
|
2221
2980
|
}
|
|
2222
2981
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2223
2982
|
let constraint = skeleton.transformConstraints[this.transformConstraintIndex];
|
|
@@ -2227,7 +2986,7 @@ var spine = (() => {
|
|
|
2227
2986
|
if (time < frames[0]) {
|
|
2228
2987
|
let data = constraint.data;
|
|
2229
2988
|
switch (blend) {
|
|
2230
|
-
case 0
|
|
2989
|
+
case 0 /* setup */:
|
|
2231
2990
|
constraint.mixRotate = data.mixRotate;
|
|
2232
2991
|
constraint.mixX = data.mixX;
|
|
2233
2992
|
constraint.mixY = data.mixY;
|
|
@@ -2235,7 +2994,7 @@ var spine = (() => {
|
|
|
2235
2994
|
constraint.mixScaleY = data.mixScaleY;
|
|
2236
2995
|
constraint.mixShearY = data.mixShearY;
|
|
2237
2996
|
return;
|
|
2238
|
-
case 1
|
|
2997
|
+
case 1 /* first */:
|
|
2239
2998
|
constraint.mixRotate += (data.mixRotate - constraint.mixRotate) * alpha;
|
|
2240
2999
|
constraint.mixX += (data.mixX - constraint.mixX) * alpha;
|
|
2241
3000
|
constraint.mixY += (data.mixY - constraint.mixY) * alpha;
|
|
@@ -2246,42 +3005,143 @@ var spine = (() => {
|
|
|
2246
3005
|
return;
|
|
2247
3006
|
}
|
|
2248
3007
|
let rotate, x, y, scaleX, scaleY, shearY;
|
|
2249
|
-
let i = Timeline.search(
|
|
2250
|
-
|
|
3008
|
+
let i = Timeline.search(
|
|
3009
|
+
frames,
|
|
3010
|
+
time,
|
|
3011
|
+
7
|
|
3012
|
+
/*ENTRIES*/
|
|
3013
|
+
);
|
|
3014
|
+
let curveType = this.curves[
|
|
3015
|
+
i / 7
|
|
3016
|
+
/*ENTRIES*/
|
|
3017
|
+
];
|
|
2251
3018
|
switch (curveType) {
|
|
2252
3019
|
case 0:
|
|
2253
3020
|
let before = frames[i];
|
|
2254
|
-
rotate = frames[
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
3021
|
+
rotate = frames[
|
|
3022
|
+
i + 1
|
|
3023
|
+
/*ROTATE*/
|
|
3024
|
+
];
|
|
3025
|
+
x = frames[
|
|
3026
|
+
i + 2
|
|
3027
|
+
/*X*/
|
|
3028
|
+
];
|
|
3029
|
+
y = frames[
|
|
3030
|
+
i + 3
|
|
3031
|
+
/*Y*/
|
|
3032
|
+
];
|
|
3033
|
+
scaleX = frames[
|
|
3034
|
+
i + 4
|
|
3035
|
+
/*SCALEX*/
|
|
3036
|
+
];
|
|
3037
|
+
scaleY = frames[
|
|
3038
|
+
i + 5
|
|
3039
|
+
/*SCALEY*/
|
|
3040
|
+
];
|
|
3041
|
+
shearY = frames[
|
|
3042
|
+
i + 6
|
|
3043
|
+
/*SHEARY*/
|
|
3044
|
+
];
|
|
3045
|
+
let t = (time - before) / (frames[
|
|
3046
|
+
i + 7
|
|
3047
|
+
/*ENTRIES*/
|
|
3048
|
+
] - before);
|
|
3049
|
+
rotate += (frames[
|
|
3050
|
+
i + 7 + 1
|
|
3051
|
+
/*ROTATE*/
|
|
3052
|
+
] - rotate) * t;
|
|
3053
|
+
x += (frames[
|
|
3054
|
+
i + 7 + 2
|
|
3055
|
+
/*X*/
|
|
3056
|
+
] - x) * t;
|
|
3057
|
+
y += (frames[
|
|
3058
|
+
i + 7 + 3
|
|
3059
|
+
/*Y*/
|
|
3060
|
+
] - y) * t;
|
|
3061
|
+
scaleX += (frames[
|
|
3062
|
+
i + 7 + 4
|
|
3063
|
+
/*SCALEX*/
|
|
3064
|
+
] - scaleX) * t;
|
|
3065
|
+
scaleY += (frames[
|
|
3066
|
+
i + 7 + 5
|
|
3067
|
+
/*SCALEY*/
|
|
3068
|
+
] - scaleY) * t;
|
|
3069
|
+
shearY += (frames[
|
|
3070
|
+
i + 7 + 6
|
|
3071
|
+
/*SHEARY*/
|
|
3072
|
+
] - shearY) * t;
|
|
2267
3073
|
break;
|
|
2268
3074
|
case 1:
|
|
2269
|
-
rotate = frames[
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
3075
|
+
rotate = frames[
|
|
3076
|
+
i + 1
|
|
3077
|
+
/*ROTATE*/
|
|
3078
|
+
];
|
|
3079
|
+
x = frames[
|
|
3080
|
+
i + 2
|
|
3081
|
+
/*X*/
|
|
3082
|
+
];
|
|
3083
|
+
y = frames[
|
|
3084
|
+
i + 3
|
|
3085
|
+
/*Y*/
|
|
3086
|
+
];
|
|
3087
|
+
scaleX = frames[
|
|
3088
|
+
i + 4
|
|
3089
|
+
/*SCALEX*/
|
|
3090
|
+
];
|
|
3091
|
+
scaleY = frames[
|
|
3092
|
+
i + 5
|
|
3093
|
+
/*SCALEY*/
|
|
3094
|
+
];
|
|
3095
|
+
shearY = frames[
|
|
3096
|
+
i + 6
|
|
3097
|
+
/*SHEARY*/
|
|
3098
|
+
];
|
|
2275
3099
|
break;
|
|
2276
3100
|
default:
|
|
2277
|
-
rotate = this.getBezierValue(
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
3101
|
+
rotate = this.getBezierValue(
|
|
3102
|
+
time,
|
|
3103
|
+
i,
|
|
3104
|
+
1,
|
|
3105
|
+
curveType - 2
|
|
3106
|
+
/*BEZIER*/
|
|
3107
|
+
);
|
|
3108
|
+
x = this.getBezierValue(
|
|
3109
|
+
time,
|
|
3110
|
+
i,
|
|
3111
|
+
2,
|
|
3112
|
+
curveType + 18 - 2
|
|
3113
|
+
/*BEZIER*/
|
|
3114
|
+
);
|
|
3115
|
+
y = this.getBezierValue(
|
|
3116
|
+
time,
|
|
3117
|
+
i,
|
|
3118
|
+
3,
|
|
3119
|
+
curveType + 18 * 2 - 2
|
|
3120
|
+
/*BEZIER*/
|
|
3121
|
+
);
|
|
3122
|
+
scaleX = this.getBezierValue(
|
|
3123
|
+
time,
|
|
3124
|
+
i,
|
|
3125
|
+
4,
|
|
3126
|
+
curveType + 18 * 3 - 2
|
|
3127
|
+
/*BEZIER*/
|
|
3128
|
+
);
|
|
3129
|
+
scaleY = this.getBezierValue(
|
|
3130
|
+
time,
|
|
3131
|
+
i,
|
|
3132
|
+
5,
|
|
3133
|
+
curveType + 18 * 4 - 2
|
|
3134
|
+
/*BEZIER*/
|
|
3135
|
+
);
|
|
3136
|
+
shearY = this.getBezierValue(
|
|
3137
|
+
time,
|
|
3138
|
+
i,
|
|
3139
|
+
6,
|
|
3140
|
+
curveType + 18 * 5 - 2
|
|
3141
|
+
/*BEZIER*/
|
|
3142
|
+
);
|
|
3143
|
+
}
|
|
3144
|
+
if (blend == 0 /* setup */) {
|
|
2285
3145
|
let data = constraint.data;
|
|
2286
3146
|
constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
|
|
2287
3147
|
constraint.mixX = data.mixX + (x - data.mixX) * alpha;
|
|
@@ -2302,6 +3162,7 @@ var spine = (() => {
|
|
|
2302
3162
|
var PathConstraintPositionTimeline = class extends CurveTimeline1 {
|
|
2303
3163
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
2304
3164
|
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
|
3165
|
+
/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
|
|
2305
3166
|
this.pathConstraintIndex = 0;
|
|
2306
3167
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2307
3168
|
}
|
|
@@ -2312,16 +3173,16 @@ var spine = (() => {
|
|
|
2312
3173
|
let frames = this.frames;
|
|
2313
3174
|
if (time < frames[0]) {
|
|
2314
3175
|
switch (blend) {
|
|
2315
|
-
case 0
|
|
3176
|
+
case 0 /* setup */:
|
|
2316
3177
|
constraint.position = constraint.data.position;
|
|
2317
3178
|
return;
|
|
2318
|
-
case 1
|
|
3179
|
+
case 1 /* first */:
|
|
2319
3180
|
constraint.position += (constraint.data.position - constraint.position) * alpha;
|
|
2320
3181
|
}
|
|
2321
3182
|
return;
|
|
2322
3183
|
}
|
|
2323
3184
|
let position = this.getCurveValue(time);
|
|
2324
|
-
if (blend == 0)
|
|
3185
|
+
if (blend == 0 /* setup */)
|
|
2325
3186
|
constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
|
|
2326
3187
|
else
|
|
2327
3188
|
constraint.position += (position - constraint.position) * alpha;
|
|
@@ -2330,6 +3191,7 @@ var spine = (() => {
|
|
|
2330
3191
|
var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
|
|
2331
3192
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
2332
3193
|
super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
|
|
3194
|
+
/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
|
|
2333
3195
|
this.pathConstraintIndex = 0;
|
|
2334
3196
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2335
3197
|
}
|
|
@@ -2340,16 +3202,16 @@ var spine = (() => {
|
|
|
2340
3202
|
let frames = this.frames;
|
|
2341
3203
|
if (time < frames[0]) {
|
|
2342
3204
|
switch (blend) {
|
|
2343
|
-
case 0
|
|
3205
|
+
case 0 /* setup */:
|
|
2344
3206
|
constraint.spacing = constraint.data.spacing;
|
|
2345
3207
|
return;
|
|
2346
|
-
case 1
|
|
3208
|
+
case 1 /* first */:
|
|
2347
3209
|
constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
|
|
2348
3210
|
}
|
|
2349
3211
|
return;
|
|
2350
3212
|
}
|
|
2351
3213
|
let spacing = this.getCurveValue(time);
|
|
2352
|
-
if (blend == 0)
|
|
3214
|
+
if (blend == 0 /* setup */)
|
|
2353
3215
|
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
|
|
2354
3216
|
else
|
|
2355
3217
|
constraint.spacing += (spacing - constraint.spacing) * alpha;
|
|
@@ -2360,6 +3222,7 @@ var spine = (() => {
|
|
|
2360
3222
|
super(frameCount, bezierCount, [
|
|
2361
3223
|
Property.pathConstraintMix + "|" + pathConstraintIndex
|
|
2362
3224
|
]);
|
|
3225
|
+
/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
|
|
2363
3226
|
this.pathConstraintIndex = 0;
|
|
2364
3227
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2365
3228
|
}
|
|
@@ -2370,9 +3233,18 @@ var spine = (() => {
|
|
|
2370
3233
|
let frames = this.frames;
|
|
2371
3234
|
frame <<= 2;
|
|
2372
3235
|
frames[frame] = time;
|
|
2373
|
-
frames[
|
|
2374
|
-
|
|
2375
|
-
|
|
3236
|
+
frames[
|
|
3237
|
+
frame + 1
|
|
3238
|
+
/*ROTATE*/
|
|
3239
|
+
] = mixRotate;
|
|
3240
|
+
frames[
|
|
3241
|
+
frame + 2
|
|
3242
|
+
/*X*/
|
|
3243
|
+
] = mixX;
|
|
3244
|
+
frames[
|
|
3245
|
+
frame + 3
|
|
3246
|
+
/*Y*/
|
|
3247
|
+
] = mixY;
|
|
2376
3248
|
}
|
|
2377
3249
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2378
3250
|
let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
|
|
@@ -2381,12 +3253,12 @@ var spine = (() => {
|
|
|
2381
3253
|
let frames = this.frames;
|
|
2382
3254
|
if (time < frames[0]) {
|
|
2383
3255
|
switch (blend) {
|
|
2384
|
-
case 0
|
|
3256
|
+
case 0 /* setup */:
|
|
2385
3257
|
constraint.mixRotate = constraint.data.mixRotate;
|
|
2386
3258
|
constraint.mixX = constraint.data.mixX;
|
|
2387
3259
|
constraint.mixY = constraint.data.mixY;
|
|
2388
3260
|
return;
|
|
2389
|
-
case 1
|
|
3261
|
+
case 1 /* first */:
|
|
2390
3262
|
constraint.mixRotate += (constraint.data.mixRotate - constraint.mixRotate) * alpha;
|
|
2391
3263
|
constraint.mixX += (constraint.data.mixX - constraint.mixX) * alpha;
|
|
2392
3264
|
constraint.mixY += (constraint.data.mixY - constraint.mixY) * alpha;
|
|
@@ -2394,30 +3266,83 @@ var spine = (() => {
|
|
|
2394
3266
|
return;
|
|
2395
3267
|
}
|
|
2396
3268
|
let rotate, x, y;
|
|
2397
|
-
let i = Timeline.search(
|
|
3269
|
+
let i = Timeline.search(
|
|
3270
|
+
frames,
|
|
3271
|
+
time,
|
|
3272
|
+
4
|
|
3273
|
+
/*ENTRIES*/
|
|
3274
|
+
);
|
|
2398
3275
|
let curveType = this.curves[i >> 2];
|
|
2399
3276
|
switch (curveType) {
|
|
2400
3277
|
case 0:
|
|
2401
3278
|
let before = frames[i];
|
|
2402
|
-
rotate = frames[
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
3279
|
+
rotate = frames[
|
|
3280
|
+
i + 1
|
|
3281
|
+
/*ROTATE*/
|
|
3282
|
+
];
|
|
3283
|
+
x = frames[
|
|
3284
|
+
i + 2
|
|
3285
|
+
/*X*/
|
|
3286
|
+
];
|
|
3287
|
+
y = frames[
|
|
3288
|
+
i + 3
|
|
3289
|
+
/*Y*/
|
|
3290
|
+
];
|
|
3291
|
+
let t = (time - before) / (frames[
|
|
3292
|
+
i + 4
|
|
3293
|
+
/*ENTRIES*/
|
|
3294
|
+
] - before);
|
|
3295
|
+
rotate += (frames[
|
|
3296
|
+
i + 4 + 1
|
|
3297
|
+
/*ROTATE*/
|
|
3298
|
+
] - rotate) * t;
|
|
3299
|
+
x += (frames[
|
|
3300
|
+
i + 4 + 2
|
|
3301
|
+
/*X*/
|
|
3302
|
+
] - x) * t;
|
|
3303
|
+
y += (frames[
|
|
3304
|
+
i + 4 + 3
|
|
3305
|
+
/*Y*/
|
|
3306
|
+
] - y) * t;
|
|
2409
3307
|
break;
|
|
2410
3308
|
case 1:
|
|
2411
|
-
rotate = frames[
|
|
2412
|
-
|
|
2413
|
-
|
|
3309
|
+
rotate = frames[
|
|
3310
|
+
i + 1
|
|
3311
|
+
/*ROTATE*/
|
|
3312
|
+
];
|
|
3313
|
+
x = frames[
|
|
3314
|
+
i + 2
|
|
3315
|
+
/*X*/
|
|
3316
|
+
];
|
|
3317
|
+
y = frames[
|
|
3318
|
+
i + 3
|
|
3319
|
+
/*Y*/
|
|
3320
|
+
];
|
|
2414
3321
|
break;
|
|
2415
3322
|
default:
|
|
2416
|
-
rotate = this.getBezierValue(
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
3323
|
+
rotate = this.getBezierValue(
|
|
3324
|
+
time,
|
|
3325
|
+
i,
|
|
3326
|
+
1,
|
|
3327
|
+
curveType - 2
|
|
3328
|
+
/*BEZIER*/
|
|
3329
|
+
);
|
|
3330
|
+
x = this.getBezierValue(
|
|
3331
|
+
time,
|
|
3332
|
+
i,
|
|
3333
|
+
2,
|
|
3334
|
+
curveType + 18 - 2
|
|
3335
|
+
/*BEZIER*/
|
|
3336
|
+
);
|
|
3337
|
+
y = this.getBezierValue(
|
|
3338
|
+
time,
|
|
3339
|
+
i,
|
|
3340
|
+
3,
|
|
3341
|
+
curveType + 18 * 2 - 2
|
|
3342
|
+
/*BEZIER*/
|
|
3343
|
+
);
|
|
3344
|
+
}
|
|
3345
|
+
if (blend == 0 /* setup */) {
|
|
2421
3346
|
let data = constraint.data;
|
|
2422
3347
|
constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
|
|
2423
3348
|
constraint.mixX = data.mixX + (x - data.mixX) * alpha;
|
|
@@ -2446,6 +3371,9 @@ var spine = (() => {
|
|
|
2446
3371
|
getAttachment() {
|
|
2447
3372
|
return this.attachment;
|
|
2448
3373
|
}
|
|
3374
|
+
/** Sets the time, mode, index, and frame time for the specified frame.
|
|
3375
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
3376
|
+
* @param time Seconds between frames. */
|
|
2449
3377
|
setFrame(frame, time, mode, index, delay) {
|
|
2450
3378
|
let frames = this.frames;
|
|
2451
3379
|
frame *= _SequenceTimeline.ENTRIES;
|
|
@@ -2465,7 +3393,7 @@ var spine = (() => {
|
|
|
2465
3393
|
}
|
|
2466
3394
|
let frames = this.frames;
|
|
2467
3395
|
if (time < frames[0]) {
|
|
2468
|
-
if (blend == 0 || blend == 1)
|
|
3396
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2469
3397
|
slot.sequenceIndex = -1;
|
|
2470
3398
|
return;
|
|
2471
3399
|
}
|
|
@@ -2477,29 +3405,29 @@ var spine = (() => {
|
|
|
2477
3405
|
return;
|
|
2478
3406
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
2479
3407
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
2480
|
-
if (mode !=
|
|
3408
|
+
if (mode != 0 /* hold */) {
|
|
2481
3409
|
index += (time - before) / delay + 1e-5 | 0;
|
|
2482
3410
|
switch (mode) {
|
|
2483
|
-
case
|
|
3411
|
+
case 1 /* once */:
|
|
2484
3412
|
index = Math.min(count - 1, index);
|
|
2485
3413
|
break;
|
|
2486
|
-
case
|
|
3414
|
+
case 2 /* loop */:
|
|
2487
3415
|
index %= count;
|
|
2488
3416
|
break;
|
|
2489
|
-
case
|
|
3417
|
+
case 3 /* pingpong */: {
|
|
2490
3418
|
let n = (count << 1) - 2;
|
|
2491
3419
|
index = n == 0 ? 0 : index % n;
|
|
2492
3420
|
if (index >= count)
|
|
2493
3421
|
index = n - index;
|
|
2494
3422
|
break;
|
|
2495
3423
|
}
|
|
2496
|
-
case
|
|
3424
|
+
case 4 /* onceReverse */:
|
|
2497
3425
|
index = Math.max(count - 1 - index, 0);
|
|
2498
3426
|
break;
|
|
2499
|
-
case
|
|
3427
|
+
case 5 /* loopReverse */:
|
|
2500
3428
|
index = count - 1 - index % count;
|
|
2501
3429
|
break;
|
|
2502
|
-
case
|
|
3430
|
+
case 6 /* pingpongReverse */: {
|
|
2503
3431
|
let n = (count << 1) - 2;
|
|
2504
3432
|
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
2505
3433
|
if (index >= count)
|
|
@@ -2518,7 +3446,12 @@ var spine = (() => {
|
|
|
2518
3446
|
// spine-core/src/AnimationState.ts
|
|
2519
3447
|
var _AnimationState = class {
|
|
2520
3448
|
constructor(data) {
|
|
3449
|
+
/** The list of tracks that currently have animations, which may contain null entries. */
|
|
2521
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. */
|
|
2522
3455
|
this.timeScale = 1;
|
|
2523
3456
|
this.unkeyedState = 0;
|
|
2524
3457
|
this.events = new Array();
|
|
@@ -2532,6 +3465,7 @@ var spine = (() => {
|
|
|
2532
3465
|
static emptyAnimation() {
|
|
2533
3466
|
return _AnimationState._emptyAnimation;
|
|
2534
3467
|
}
|
|
3468
|
+
/** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
|
|
2535
3469
|
update(delta) {
|
|
2536
3470
|
delta *= this.timeScale;
|
|
2537
3471
|
let tracks = this.tracks;
|
|
@@ -2583,6 +3517,7 @@ var spine = (() => {
|
|
|
2583
3517
|
}
|
|
2584
3518
|
this.queue.drain();
|
|
2585
3519
|
}
|
|
3520
|
+
/** Returns true when all mixing from entries are complete. */
|
|
2586
3521
|
updateMixingFrom(to, delta) {
|
|
2587
3522
|
let from = to.mixingFrom;
|
|
2588
3523
|
if (!from)
|
|
@@ -2604,6 +3539,9 @@ var spine = (() => {
|
|
|
2604
3539
|
to.mixTime += delta;
|
|
2605
3540
|
return false;
|
|
2606
3541
|
}
|
|
3542
|
+
/** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
|
|
3543
|
+
* animation state can be applied to multiple skeletons to pose them identically.
|
|
3544
|
+
* @returns True if any animations were applied. */
|
|
2607
3545
|
apply(skeleton) {
|
|
2608
3546
|
if (!skeleton)
|
|
2609
3547
|
throw new Error("skeleton cannot be null.");
|
|
@@ -2617,7 +3555,7 @@ var spine = (() => {
|
|
|
2617
3555
|
if (!current || current.delay > 0)
|
|
2618
3556
|
continue;
|
|
2619
3557
|
applied = true;
|
|
2620
|
-
let blend = i2 == 0 ?
|
|
3558
|
+
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
2621
3559
|
let mix = current.alpha;
|
|
2622
3560
|
if (current.mixingFrom)
|
|
2623
3561
|
mix *= this.applyMixingFrom(current, skeleton, blend);
|
|
@@ -2631,14 +3569,14 @@ var spine = (() => {
|
|
|
2631
3569
|
}
|
|
2632
3570
|
let timelines = current.animation.timelines;
|
|
2633
3571
|
let timelineCount = timelines.length;
|
|
2634
|
-
if (i2 == 0 && mix == 1 || blend ==
|
|
3572
|
+
if (i2 == 0 && mix == 1 || blend == 3 /* add */) {
|
|
2635
3573
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
2636
3574
|
Utils.webkit602BugfixHelper(mix, blend);
|
|
2637
3575
|
var timeline = timelines[ii];
|
|
2638
3576
|
if (timeline instanceof AttachmentTimeline)
|
|
2639
3577
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
|
|
2640
3578
|
else
|
|
2641
|
-
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend,
|
|
3579
|
+
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, 0 /* mixIn */);
|
|
2642
3580
|
}
|
|
2643
3581
|
} else {
|
|
2644
3582
|
let timelineMode = current.timelineMode;
|
|
@@ -2648,14 +3586,14 @@ var spine = (() => {
|
|
|
2648
3586
|
current.timelinesRotation.length = timelineCount << 1;
|
|
2649
3587
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
2650
3588
|
let timeline2 = timelines[ii];
|
|
2651
|
-
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend :
|
|
3589
|
+
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
2652
3590
|
if (!shortestRotation && timeline2 instanceof RotateTimeline) {
|
|
2653
3591
|
this.applyRotateTimeline(timeline2, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
|
2654
3592
|
} else if (timeline2 instanceof AttachmentTimeline) {
|
|
2655
3593
|
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, true);
|
|
2656
3594
|
} else {
|
|
2657
3595
|
Utils.webkit602BugfixHelper(mix, blend);
|
|
2658
|
-
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend,
|
|
3596
|
+
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, 0 /* mixIn */);
|
|
2659
3597
|
}
|
|
2660
3598
|
}
|
|
2661
3599
|
}
|
|
@@ -2684,13 +3622,13 @@ var spine = (() => {
|
|
|
2684
3622
|
let mix = 0;
|
|
2685
3623
|
if (to.mixDuration == 0) {
|
|
2686
3624
|
mix = 1;
|
|
2687
|
-
if (blend ==
|
|
2688
|
-
blend =
|
|
3625
|
+
if (blend == 1 /* first */)
|
|
3626
|
+
blend = 0 /* setup */;
|
|
2689
3627
|
} else {
|
|
2690
3628
|
mix = to.mixTime / to.mixDuration;
|
|
2691
3629
|
if (mix > 1)
|
|
2692
3630
|
mix = 1;
|
|
2693
|
-
if (blend !=
|
|
3631
|
+
if (blend != 1 /* first */)
|
|
2694
3632
|
blend = from.mixBlend;
|
|
2695
3633
|
}
|
|
2696
3634
|
let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
|
@@ -2703,9 +3641,9 @@ var spine = (() => {
|
|
|
2703
3641
|
applyTime = from.animation.duration - applyTime;
|
|
2704
3642
|
else if (mix < from.eventThreshold)
|
|
2705
3643
|
events = this.events;
|
|
2706
|
-
if (blend ==
|
|
3644
|
+
if (blend == 3 /* add */) {
|
|
2707
3645
|
for (let i = 0; i < timelineCount; i++)
|
|
2708
|
-
timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend,
|
|
3646
|
+
timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend, 1 /* mixOut */);
|
|
2709
3647
|
} else {
|
|
2710
3648
|
let timelineMode = from.timelineMode;
|
|
2711
3649
|
let timelineHoldMix = from.timelineHoldMix;
|
|
@@ -2716,7 +3654,7 @@ var spine = (() => {
|
|
|
2716
3654
|
from.totalAlpha = 0;
|
|
2717
3655
|
for (let i = 0; i < timelineCount; i++) {
|
|
2718
3656
|
let timeline = timelines[i];
|
|
2719
|
-
let direction =
|
|
3657
|
+
let direction = 1 /* mixOut */;
|
|
2720
3658
|
let timelineBlend;
|
|
2721
3659
|
let alpha = 0;
|
|
2722
3660
|
switch (timelineMode[i]) {
|
|
@@ -2727,7 +3665,7 @@ var spine = (() => {
|
|
|
2727
3665
|
alpha = alphaMix;
|
|
2728
3666
|
break;
|
|
2729
3667
|
case FIRST:
|
|
2730
|
-
timelineBlend =
|
|
3668
|
+
timelineBlend = 0 /* setup */;
|
|
2731
3669
|
alpha = alphaMix;
|
|
2732
3670
|
break;
|
|
2733
3671
|
case HOLD_SUBSEQUENT:
|
|
@@ -2735,11 +3673,11 @@ var spine = (() => {
|
|
|
2735
3673
|
alpha = alphaHold;
|
|
2736
3674
|
break;
|
|
2737
3675
|
case HOLD_FIRST:
|
|
2738
|
-
timelineBlend =
|
|
3676
|
+
timelineBlend = 0 /* setup */;
|
|
2739
3677
|
alpha = alphaHold;
|
|
2740
3678
|
break;
|
|
2741
3679
|
default:
|
|
2742
|
-
timelineBlend =
|
|
3680
|
+
timelineBlend = 0 /* setup */;
|
|
2743
3681
|
let holdMix = timelineHoldMix[i];
|
|
2744
3682
|
alpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration);
|
|
2745
3683
|
break;
|
|
@@ -2751,8 +3689,8 @@ var spine = (() => {
|
|
|
2751
3689
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
|
2752
3690
|
else {
|
|
2753
3691
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
2754
|
-
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend ==
|
|
2755
|
-
direction =
|
|
3692
|
+
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
|
|
3693
|
+
direction = 0 /* mixIn */;
|
|
2756
3694
|
timeline.apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
|
2757
3695
|
}
|
|
2758
3696
|
}
|
|
@@ -2769,7 +3707,7 @@ var spine = (() => {
|
|
|
2769
3707
|
if (!slot.bone.active)
|
|
2770
3708
|
return;
|
|
2771
3709
|
if (time < timeline.frames[0]) {
|
|
2772
|
-
if (blend ==
|
|
3710
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2773
3711
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
|
2774
3712
|
} else
|
|
2775
3713
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
|
@@ -2785,7 +3723,7 @@ var spine = (() => {
|
|
|
2785
3723
|
if (firstFrame)
|
|
2786
3724
|
timelinesRotation[i] = 0;
|
|
2787
3725
|
if (alpha == 1) {
|
|
2788
|
-
timeline.apply(skeleton, 0, time, null, 1, blend,
|
|
3726
|
+
timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
|
|
2789
3727
|
return;
|
|
2790
3728
|
}
|
|
2791
3729
|
let bone = skeleton.bones[timeline.boneIndex];
|
|
@@ -2795,16 +3733,16 @@ var spine = (() => {
|
|
|
2795
3733
|
let r1 = 0, r2 = 0;
|
|
2796
3734
|
if (time < frames[0]) {
|
|
2797
3735
|
switch (blend) {
|
|
2798
|
-
case
|
|
3736
|
+
case 0 /* setup */:
|
|
2799
3737
|
bone.rotation = bone.data.rotation;
|
|
2800
3738
|
default:
|
|
2801
3739
|
return;
|
|
2802
|
-
case
|
|
3740
|
+
case 1 /* first */:
|
|
2803
3741
|
r1 = bone.rotation;
|
|
2804
3742
|
r2 = bone.data.rotation;
|
|
2805
3743
|
}
|
|
2806
3744
|
} else {
|
|
2807
|
-
r1 = blend ==
|
|
3745
|
+
r1 = blend == 0 /* setup */ ? bone.data.rotation : bone.rotation;
|
|
2808
3746
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
|
2809
3747
|
}
|
|
2810
3748
|
let total = 0, diff = r2 - r1;
|
|
@@ -2867,6 +3805,10 @@ var spine = (() => {
|
|
|
2867
3805
|
this.queue.event(entry, event);
|
|
2868
3806
|
}
|
|
2869
3807
|
}
|
|
3808
|
+
/** Removes all animations from all tracks, leaving skeletons in their current pose.
|
|
3809
|
+
*
|
|
3810
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3811
|
+
* rather than leaving them in their current pose. */
|
|
2870
3812
|
clearTracks() {
|
|
2871
3813
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2872
3814
|
this.queue.drainDisabled = true;
|
|
@@ -2876,6 +3818,10 @@ var spine = (() => {
|
|
|
2876
3818
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
2877
3819
|
this.queue.drain();
|
|
2878
3820
|
}
|
|
3821
|
+
/** Removes all animations from the track, leaving skeletons in their current pose.
|
|
3822
|
+
*
|
|
3823
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3824
|
+
* rather than leaving them in their current pose. */
|
|
2879
3825
|
clearTrack(trackIndex) {
|
|
2880
3826
|
if (trackIndex >= this.tracks.length)
|
|
2881
3827
|
return;
|
|
@@ -2913,12 +3859,21 @@ var spine = (() => {
|
|
|
2913
3859
|
}
|
|
2914
3860
|
this.queue.start(current);
|
|
2915
3861
|
}
|
|
3862
|
+
/** Sets an animation by name.
|
|
3863
|
+
*
|
|
3864
|
+
* See {@link #setAnimationWith()}. */
|
|
2916
3865
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
2917
3866
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2918
3867
|
if (!animation)
|
|
2919
3868
|
throw new Error("Animation not found: " + animationName);
|
|
2920
3869
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
2921
3870
|
}
|
|
3871
|
+
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
3872
|
+
* applied to a skeleton, it is replaced (not mixed from).
|
|
3873
|
+
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
3874
|
+
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
|
|
3875
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3876
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2922
3877
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
2923
3878
|
if (!animation)
|
|
2924
3879
|
throw new Error("animation cannot be null.");
|
|
@@ -2940,12 +3895,23 @@ var spine = (() => {
|
|
|
2940
3895
|
this.queue.drain();
|
|
2941
3896
|
return entry;
|
|
2942
3897
|
}
|
|
3898
|
+
/** Queues an animation by name.
|
|
3899
|
+
*
|
|
3900
|
+
* See {@link #addAnimationWith()}. */
|
|
2943
3901
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
2944
3902
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2945
3903
|
if (!animation)
|
|
2946
3904
|
throw new Error("Animation not found: " + animationName);
|
|
2947
3905
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
2948
3906
|
}
|
|
3907
|
+
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
3908
|
+
* equivalent to calling {@link #setAnimationWith()}.
|
|
3909
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3910
|
+
* minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
|
|
3911
|
+
* ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
|
|
3912
|
+
* previous entry is looping, its next loop completion is used instead of its duration.
|
|
3913
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3914
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2949
3915
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
2950
3916
|
if (!animation)
|
|
2951
3917
|
throw new Error("animation cannot be null.");
|
|
@@ -2967,12 +3933,37 @@ var spine = (() => {
|
|
|
2967
3933
|
entry.delay = delay;
|
|
2968
3934
|
return entry;
|
|
2969
3935
|
}
|
|
3936
|
+
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
|
|
3937
|
+
* {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
|
|
3938
|
+
*
|
|
3939
|
+
* Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
|
|
3940
|
+
* {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
|
|
3941
|
+
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
|
|
3942
|
+
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
|
|
3943
|
+
* 0 still mixes out over one frame.
|
|
3944
|
+
*
|
|
3945
|
+
* Mixing in is done by first setting an empty animation, then adding an animation using
|
|
3946
|
+
* {@link #addAnimation()} and on the returned track entry, set the
|
|
3947
|
+
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
|
|
3948
|
+
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
|
3949
|
+
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
|
2970
3950
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
2971
3951
|
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
2972
3952
|
entry.mixDuration = mixDuration;
|
|
2973
3953
|
entry.trackEnd = mixDuration;
|
|
2974
3954
|
return entry;
|
|
2975
3955
|
}
|
|
3956
|
+
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
|
|
3957
|
+
* {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
|
|
3958
|
+
* {@link #setEmptyAnimation()}.
|
|
3959
|
+
*
|
|
3960
|
+
* See {@link #setEmptyAnimation()}.
|
|
3961
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3962
|
+
* minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
|
|
3963
|
+
* before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
|
|
3964
|
+
* loop completion is used instead of its duration.
|
|
3965
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3966
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2976
3967
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
2977
3968
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
2978
3969
|
if (delay <= 0)
|
|
@@ -2981,6 +3972,8 @@ var spine = (() => {
|
|
|
2981
3972
|
entry.trackEnd = mixDuration;
|
|
2982
3973
|
return entry;
|
|
2983
3974
|
}
|
|
3975
|
+
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
|
3976
|
+
* duration. */
|
|
2984
3977
|
setEmptyAnimations(mixDuration = 0) {
|
|
2985
3978
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2986
3979
|
this.queue.drainDisabled = true;
|
|
@@ -2999,6 +3992,7 @@ var spine = (() => {
|
|
|
2999
3992
|
this.tracks.length = index + 1;
|
|
3000
3993
|
return null;
|
|
3001
3994
|
}
|
|
3995
|
+
/** @param last May be null. */
|
|
3002
3996
|
trackEntry(trackIndex, animation, loop, last) {
|
|
3003
3997
|
let entry = this.trackEntryPool.obtain();
|
|
3004
3998
|
entry.reset();
|
|
@@ -3026,9 +4020,10 @@ var spine = (() => {
|
|
|
3026
4020
|
entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation);
|
|
3027
4021
|
entry.interruptAlpha = 1;
|
|
3028
4022
|
entry.totalAlpha = 0;
|
|
3029
|
-
entry.mixBlend =
|
|
4023
|
+
entry.mixBlend = 2 /* replace */;
|
|
3030
4024
|
return entry;
|
|
3031
4025
|
}
|
|
4026
|
+
/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
|
|
3032
4027
|
clearNext(entry) {
|
|
3033
4028
|
let next = entry.next;
|
|
3034
4029
|
while (next) {
|
|
@@ -3048,7 +4043,7 @@ var spine = (() => {
|
|
|
3048
4043
|
while (entry.mixingFrom)
|
|
3049
4044
|
entry = entry.mixingFrom;
|
|
3050
4045
|
do {
|
|
3051
|
-
if (!entry.mixingTo || entry.mixBlend !=
|
|
4046
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
3052
4047
|
this.computeHold(entry);
|
|
3053
4048
|
entry = entry.mixingTo;
|
|
3054
4049
|
} while (entry);
|
|
@@ -3091,24 +4086,31 @@ var spine = (() => {
|
|
|
3091
4086
|
}
|
|
3092
4087
|
}
|
|
3093
4088
|
}
|
|
4089
|
+
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
3094
4090
|
getCurrent(trackIndex) {
|
|
3095
4091
|
if (trackIndex >= this.tracks.length)
|
|
3096
4092
|
return null;
|
|
3097
4093
|
return this.tracks[trackIndex];
|
|
3098
4094
|
}
|
|
4095
|
+
/** Adds a listener to receive events for all track entries. */
|
|
3099
4096
|
addListener(listener) {
|
|
3100
4097
|
if (!listener)
|
|
3101
4098
|
throw new Error("listener cannot be null.");
|
|
3102
4099
|
this.listeners.push(listener);
|
|
3103
4100
|
}
|
|
4101
|
+
/** Removes the listener added with {@link #addListener()}. */
|
|
3104
4102
|
removeListener(listener) {
|
|
3105
4103
|
let index = this.listeners.indexOf(listener);
|
|
3106
4104
|
if (index >= 0)
|
|
3107
4105
|
this.listeners.splice(index, 1);
|
|
3108
4106
|
}
|
|
4107
|
+
/** Removes all listeners added with {@link #addListener()}. */
|
|
3109
4108
|
clearListeners() {
|
|
3110
4109
|
this.listeners.length = 0;
|
|
3111
4110
|
}
|
|
4111
|
+
/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
|
|
4112
|
+
* {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
|
|
4113
|
+
* are not wanted because new animations are being set. */
|
|
3112
4114
|
clearListenerNotifications() {
|
|
3113
4115
|
this.queue.clear();
|
|
3114
4116
|
}
|
|
@@ -3117,36 +4119,134 @@ var spine = (() => {
|
|
|
3117
4119
|
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3118
4120
|
var TrackEntry = class {
|
|
3119
4121
|
constructor() {
|
|
4122
|
+
/** The animation to apply for this track entry. */
|
|
3120
4123
|
this.animation = null;
|
|
3121
4124
|
this.previous = null;
|
|
4125
|
+
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
|
|
3122
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. */
|
|
3123
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. */
|
|
3124
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. */
|
|
3125
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()}. */
|
|
3126
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. */
|
|
3127
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. */
|
|
3128
4156
|
this.holdPrevious = false;
|
|
3129
4157
|
this.reverse = false;
|
|
3130
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. */
|
|
3131
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. */
|
|
3132
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. */
|
|
3133
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. */
|
|
3134
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}. */
|
|
3135
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. */
|
|
3136
4183
|
this.animationLast = 0;
|
|
3137
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. */
|
|
3138
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. */
|
|
3139
4195
|
this.trackTime = 0;
|
|
3140
4196
|
this.trackLast = 0;
|
|
3141
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. */
|
|
3142
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. */
|
|
3143
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. */
|
|
3144
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. */
|
|
3145
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. */
|
|
3146
4240
|
this.mixDuration = 0;
|
|
3147
4241
|
this.interruptAlpha = 0;
|
|
3148
4242
|
this.totalAlpha = 0;
|
|
3149
|
-
|
|
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 */;
|
|
3150
4250
|
this.timelineMode = new Array();
|
|
3151
4251
|
this.timelineHoldMix = new Array();
|
|
3152
4252
|
this.timelinesRotation = new Array();
|
|
@@ -3162,6 +4262,9 @@ var spine = (() => {
|
|
|
3162
4262
|
this.timelineHoldMix.length = 0;
|
|
3163
4263
|
this.timelinesRotation.length = 0;
|
|
3164
4264
|
}
|
|
4265
|
+
/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
|
|
4266
|
+
* and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
|
|
4267
|
+
* `animationStart` time. */
|
|
3165
4268
|
getAnimationTime() {
|
|
3166
4269
|
if (this.loop) {
|
|
3167
4270
|
let duration = this.animationEnd - this.animationStart;
|
|
@@ -3175,9 +4278,19 @@ var spine = (() => {
|
|
|
3175
4278
|
this.animationLast = animationLast;
|
|
3176
4279
|
this.nextAnimationLast = animationLast;
|
|
3177
4280
|
}
|
|
4281
|
+
/** Returns true if at least one loop has been completed.
|
|
4282
|
+
*
|
|
4283
|
+
* See {@link AnimationStateListener#complete()}. */
|
|
3178
4284
|
isComplete() {
|
|
3179
4285
|
return this.trackTime >= this.animationEnd - this.animationStart;
|
|
3180
4286
|
}
|
|
4287
|
+
/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
|
|
4288
|
+
* long way around when using {@link #alpha} and starting animations on other tracks.
|
|
4289
|
+
*
|
|
4290
|
+
* Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
|
|
4291
|
+
* the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
|
|
4292
|
+
* way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
|
|
4293
|
+
* long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
|
|
3181
4294
|
resetRotationDirections() {
|
|
3182
4295
|
this.timelinesRotation.length = 0;
|
|
3183
4296
|
}
|
|
@@ -3299,15 +4412,15 @@ var spine = (() => {
|
|
|
3299
4412
|
this.objects.length = 0;
|
|
3300
4413
|
}
|
|
3301
4414
|
};
|
|
3302
|
-
var EventType
|
|
3303
|
-
(function(EventType2) {
|
|
4415
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
3304
4416
|
EventType2[EventType2["start"] = 0] = "start";
|
|
3305
4417
|
EventType2[EventType2["interrupt"] = 1] = "interrupt";
|
|
3306
4418
|
EventType2[EventType2["end"] = 2] = "end";
|
|
3307
4419
|
EventType2[EventType2["dispose"] = 3] = "dispose";
|
|
3308
4420
|
EventType2[EventType2["complete"] = 4] = "complete";
|
|
3309
4421
|
EventType2[EventType2["event"] = 5] = "event";
|
|
3310
|
-
|
|
4422
|
+
return EventType2;
|
|
4423
|
+
})(EventType || {});
|
|
3311
4424
|
var AnimationStateAdapter = class {
|
|
3312
4425
|
start(entry) {
|
|
3313
4426
|
}
|
|
@@ -3334,11 +4447,15 @@ var spine = (() => {
|
|
|
3334
4447
|
var AnimationStateData = class {
|
|
3335
4448
|
constructor(skeletonData) {
|
|
3336
4449
|
this.animationToMixTime = {};
|
|
4450
|
+
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
3337
4451
|
this.defaultMix = 0;
|
|
3338
4452
|
if (!skeletonData)
|
|
3339
4453
|
throw new Error("skeletonData cannot be null.");
|
|
3340
4454
|
this.skeletonData = skeletonData;
|
|
3341
4455
|
}
|
|
4456
|
+
/** Sets a mix duration by animation name.
|
|
4457
|
+
*
|
|
4458
|
+
* See {@link #setMixWith()}. */
|
|
3342
4459
|
setMix(fromName, toName, duration) {
|
|
3343
4460
|
let from = this.skeletonData.findAnimation(fromName);
|
|
3344
4461
|
if (!from)
|
|
@@ -3348,6 +4465,9 @@ var spine = (() => {
|
|
|
3348
4465
|
throw new Error("Animation not found: " + toName);
|
|
3349
4466
|
this.setMixWith(from, to, duration);
|
|
3350
4467
|
}
|
|
4468
|
+
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4469
|
+
*
|
|
4470
|
+
* See {@link TrackEntry#mixDuration}. */
|
|
3351
4471
|
setMixWith(from, to, duration) {
|
|
3352
4472
|
if (!from)
|
|
3353
4473
|
throw new Error("from cannot be null.");
|
|
@@ -3356,6 +4476,8 @@ var spine = (() => {
|
|
|
3356
4476
|
let key = from.name + "." + to.name;
|
|
3357
4477
|
this.animationToMixTime[key] = duration;
|
|
3358
4478
|
}
|
|
4479
|
+
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
|
|
4480
|
+
* no mix duration has been set. */
|
|
3359
4481
|
getMix(from, to) {
|
|
3360
4482
|
let key = from.name + "." + to.name;
|
|
3361
4483
|
let value = this.animationToMixTime[key];
|
|
@@ -3379,9 +4501,15 @@ var spine = (() => {
|
|
|
3379
4501
|
|
|
3380
4502
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
3381
4503
|
var ClippingAttachment = class extends VertexAttachment {
|
|
4504
|
+
// ce3a3aff
|
|
3382
4505
|
constructor(name) {
|
|
3383
4506
|
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. */
|
|
3384
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. */
|
|
3385
4513
|
this.color = new Color(0.2275, 0.2275, 0.8078, 1);
|
|
3386
4514
|
}
|
|
3387
4515
|
copy() {
|
|
@@ -3402,8 +4530,7 @@ var spine = (() => {
|
|
|
3402
4530
|
return this._image;
|
|
3403
4531
|
}
|
|
3404
4532
|
};
|
|
3405
|
-
var TextureFilter
|
|
3406
|
-
(function(TextureFilter2) {
|
|
4533
|
+
var TextureFilter = /* @__PURE__ */ ((TextureFilter2) => {
|
|
3407
4534
|
TextureFilter2[TextureFilter2["Nearest"] = 9728] = "Nearest";
|
|
3408
4535
|
TextureFilter2[TextureFilter2["Linear"] = 9729] = "Linear";
|
|
3409
4536
|
TextureFilter2[TextureFilter2["MipMap"] = 9987] = "MipMap";
|
|
@@ -3411,13 +4538,14 @@ var spine = (() => {
|
|
|
3411
4538
|
TextureFilter2[TextureFilter2["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
|
|
3412
4539
|
TextureFilter2[TextureFilter2["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
|
|
3413
4540
|
TextureFilter2[TextureFilter2["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
(
|
|
4541
|
+
return TextureFilter2;
|
|
4542
|
+
})(TextureFilter || {});
|
|
4543
|
+
var TextureWrap = /* @__PURE__ */ ((TextureWrap2) => {
|
|
3417
4544
|
TextureWrap2[TextureWrap2["MirroredRepeat"] = 33648] = "MirroredRepeat";
|
|
3418
4545
|
TextureWrap2[TextureWrap2["ClampToEdge"] = 33071] = "ClampToEdge";
|
|
3419
4546
|
TextureWrap2[TextureWrap2["Repeat"] = 10497] = "Repeat";
|
|
3420
|
-
|
|
4547
|
+
return TextureWrap2;
|
|
4548
|
+
})(TextureWrap || {});
|
|
3421
4549
|
var TextureRegion = class {
|
|
3422
4550
|
constructor() {
|
|
3423
4551
|
this.u = 0;
|
|
@@ -3462,9 +4590,9 @@ var spine = (() => {
|
|
|
3462
4590
|
};
|
|
3463
4591
|
pageFields["repeat"] = (page2) => {
|
|
3464
4592
|
if (entry[1].indexOf("x") != -1)
|
|
3465
|
-
page2.uWrap =
|
|
4593
|
+
page2.uWrap = 10497 /* Repeat */;
|
|
3466
4594
|
if (entry[1].indexOf("y") != -1)
|
|
3467
|
-
page2.vWrap =
|
|
4595
|
+
page2.vWrap = 10497 /* Repeat */;
|
|
3468
4596
|
};
|
|
3469
4597
|
pageFields["pma"] = (page2) => {
|
|
3470
4598
|
page2.pma = entry[1] == "true";
|
|
@@ -3635,20 +4763,23 @@ var spine = (() => {
|
|
|
3635
4763
|
};
|
|
3636
4764
|
var TextureAtlasPage = class {
|
|
3637
4765
|
constructor(name) {
|
|
3638
|
-
this.minFilter =
|
|
3639
|
-
this.magFilter =
|
|
3640
|
-
this.uWrap =
|
|
3641
|
-
this.vWrap =
|
|
4766
|
+
this.minFilter = 9728 /* Nearest */;
|
|
4767
|
+
this.magFilter = 9728 /* Nearest */;
|
|
4768
|
+
this.uWrap = 33071 /* ClampToEdge */;
|
|
4769
|
+
this.vWrap = 33071 /* ClampToEdge */;
|
|
3642
4770
|
this.texture = null;
|
|
3643
4771
|
this.width = 0;
|
|
3644
4772
|
this.height = 0;
|
|
3645
4773
|
this.pma = false;
|
|
4774
|
+
this.regions = new Array();
|
|
3646
4775
|
this.name = name;
|
|
3647
4776
|
}
|
|
3648
4777
|
setTexture(texture) {
|
|
3649
4778
|
this.texture = texture;
|
|
3650
4779
|
texture.setFilters(this.minFilter, this.magFilter);
|
|
3651
4780
|
texture.setWraps(this.uWrap, this.vWrap);
|
|
4781
|
+
for (let region of this.regions)
|
|
4782
|
+
region.texture = texture;
|
|
3652
4783
|
}
|
|
3653
4784
|
};
|
|
3654
4785
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
@@ -3666,6 +4797,7 @@ var spine = (() => {
|
|
|
3666
4797
|
this.values = null;
|
|
3667
4798
|
this.page = page;
|
|
3668
4799
|
this.name = name;
|
|
4800
|
+
page.regions.push(this);
|
|
3669
4801
|
}
|
|
3670
4802
|
};
|
|
3671
4803
|
|
|
@@ -3674,19 +4806,32 @@ var spine = (() => {
|
|
|
3674
4806
|
constructor(name, path) {
|
|
3675
4807
|
super(name);
|
|
3676
4808
|
this.region = null;
|
|
4809
|
+
/** The UV pair for each vertex, normalized within the texture region. */
|
|
3677
4810
|
this.regionUVs = [];
|
|
4811
|
+
/** The UV pair for each vertex, normalized within the entire texture.
|
|
4812
|
+
*
|
|
4813
|
+
* See {@link #updateUVs}. */
|
|
3678
4814
|
this.uvs = [];
|
|
4815
|
+
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
|
3679
4816
|
this.triangles = [];
|
|
4817
|
+
/** The color to tint the mesh. */
|
|
3680
4818
|
this.color = new Color(1, 1, 1, 1);
|
|
4819
|
+
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
|
3681
4820
|
this.width = 0;
|
|
4821
|
+
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
|
3682
4822
|
this.height = 0;
|
|
4823
|
+
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
|
3683
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. */
|
|
3684
4827
|
this.edges = [];
|
|
3685
4828
|
this.parentMesh = null;
|
|
3686
4829
|
this.sequence = null;
|
|
3687
4830
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3688
4831
|
this.path = path;
|
|
3689
4832
|
}
|
|
4833
|
+
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4834
|
+
* the {@link #regionUVs} are changed. */
|
|
3690
4835
|
updateRegion() {
|
|
3691
4836
|
if (!this.region)
|
|
3692
4837
|
throw new Error("Region not set.");
|
|
@@ -3697,8 +4842,8 @@ var spine = (() => {
|
|
|
3697
4842
|
let n = this.uvs.length;
|
|
3698
4843
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
3699
4844
|
if (this.region instanceof TextureAtlasRegion) {
|
|
3700
|
-
let region = this.region,
|
|
3701
|
-
let textureWidth =
|
|
4845
|
+
let region = this.region, page = region.page;
|
|
4846
|
+
let textureWidth = page.width, textureHeight = page.height;
|
|
3702
4847
|
switch (region.degrees) {
|
|
3703
4848
|
case 90:
|
|
3704
4849
|
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
|
@@ -3747,9 +4892,13 @@ var spine = (() => {
|
|
|
3747
4892
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
|
3748
4893
|
}
|
|
3749
4894
|
}
|
|
4895
|
+
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
|
|
4896
|
+
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
|
|
4897
|
+
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
|
|
3750
4898
|
getParentMesh() {
|
|
3751
4899
|
return this.parentMesh;
|
|
3752
4900
|
}
|
|
4901
|
+
/** @param parentMesh May be null. */
|
|
3753
4902
|
setParentMesh(parentMesh) {
|
|
3754
4903
|
this.parentMesh = parentMesh;
|
|
3755
4904
|
if (parentMesh) {
|
|
@@ -3790,6 +4939,7 @@ var spine = (() => {
|
|
|
3790
4939
|
this.sequence.apply(slot, this);
|
|
3791
4940
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3792
4941
|
}
|
|
4942
|
+
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
3793
4943
|
newLinkedMesh() {
|
|
3794
4944
|
let copy = new MeshAttachment(this.name, this.path);
|
|
3795
4945
|
copy.region = this.region;
|
|
@@ -3806,9 +4956,15 @@ var spine = (() => {
|
|
|
3806
4956
|
var PathAttachment = class extends VertexAttachment {
|
|
3807
4957
|
constructor(name) {
|
|
3808
4958
|
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. */
|
|
3809
4960
|
this.lengths = [];
|
|
4961
|
+
/** If true, the start and end knots are connected. */
|
|
3810
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. */
|
|
3811
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. */
|
|
3812
4968
|
this.color = new Color(1, 1, 1, 1);
|
|
3813
4969
|
}
|
|
3814
4970
|
copy() {
|
|
@@ -3830,6 +4986,8 @@ var spine = (() => {
|
|
|
3830
4986
|
this.x = 0;
|
|
3831
4987
|
this.y = 0;
|
|
3832
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. */
|
|
3833
4991
|
this.color = new Color(0.38, 0.94, 0, 1);
|
|
3834
4992
|
}
|
|
3835
4993
|
computeWorldPosition(bone, point) {
|
|
@@ -3857,22 +5015,33 @@ var spine = (() => {
|
|
|
3857
5015
|
var _RegionAttachment = class extends Attachment {
|
|
3858
5016
|
constructor(name, path) {
|
|
3859
5017
|
super(name);
|
|
5018
|
+
/** The local x translation. */
|
|
3860
5019
|
this.x = 0;
|
|
5020
|
+
/** The local y translation. */
|
|
3861
5021
|
this.y = 0;
|
|
5022
|
+
/** The local scaleX. */
|
|
3862
5023
|
this.scaleX = 1;
|
|
5024
|
+
/** The local scaleY. */
|
|
3863
5025
|
this.scaleY = 1;
|
|
5026
|
+
/** The local rotation. */
|
|
3864
5027
|
this.rotation = 0;
|
|
5028
|
+
/** The width of the region attachment in Spine. */
|
|
3865
5029
|
this.width = 0;
|
|
5030
|
+
/** The height of the region attachment in Spine. */
|
|
3866
5031
|
this.height = 0;
|
|
5032
|
+
/** The color to tint the region attachment. */
|
|
3867
5033
|
this.color = new Color(1, 1, 1, 1);
|
|
3868
|
-
this.rendererObject = null;
|
|
3869
5034
|
this.region = null;
|
|
3870
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()}. */
|
|
3871
5039
|
this.offset = Utils.newFloatArray(8);
|
|
3872
5040
|
this.uvs = Utils.newFloatArray(8);
|
|
3873
5041
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3874
5042
|
this.path = path;
|
|
3875
5043
|
}
|
|
5044
|
+
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
3876
5045
|
updateRegion() {
|
|
3877
5046
|
if (!this.region)
|
|
3878
5047
|
throw new Error("Region not set.");
|
|
@@ -3936,6 +5105,14 @@ var spine = (() => {
|
|
|
3936
5105
|
uvs[7] = region.v2;
|
|
3937
5106
|
}
|
|
3938
5107
|
}
|
|
5108
|
+
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
|
|
5109
|
+
* be changed.
|
|
5110
|
+
* <p>
|
|
5111
|
+
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
|
5112
|
+
* Runtimes Guide.
|
|
5113
|
+
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
|
|
5114
|
+
* @param offset The <code>worldVertices</code> index to begin writing values.
|
|
5115
|
+
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
|
|
3939
5116
|
computeWorldVertices(slot, worldVertices, offset, stride) {
|
|
3940
5117
|
if (this.sequence != null)
|
|
3941
5118
|
this.sequence.apply(slot, this);
|
|
@@ -3967,7 +5144,6 @@ var spine = (() => {
|
|
|
3967
5144
|
copy() {
|
|
3968
5145
|
let copy = new _RegionAttachment(this.name, this.path);
|
|
3969
5146
|
copy.region = this.region;
|
|
3970
|
-
copy.rendererObject = this.rendererObject;
|
|
3971
5147
|
copy.x = this.x;
|
|
3972
5148
|
copy.y = this.y;
|
|
3973
5149
|
copy.scaleX = this.scaleX;
|
|
@@ -4029,7 +5205,6 @@ var spine = (() => {
|
|
|
4029
5205
|
if (region == null)
|
|
4030
5206
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4031
5207
|
regions[i] = region;
|
|
4032
|
-
regions[i].renderObject = regions[i];
|
|
4033
5208
|
}
|
|
4034
5209
|
}
|
|
4035
5210
|
newRegionAttachment(skin, name, path, sequence) {
|
|
@@ -4040,7 +5215,6 @@ var spine = (() => {
|
|
|
4040
5215
|
let region = this.atlas.findRegion(path);
|
|
4041
5216
|
if (!region)
|
|
4042
5217
|
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
4043
|
-
region.renderObject = region;
|
|
4044
5218
|
attachment.region = region;
|
|
4045
5219
|
}
|
|
4046
5220
|
return attachment;
|
|
@@ -4053,7 +5227,6 @@ var spine = (() => {
|
|
|
4053
5227
|
let region = this.atlas.findRegion(path);
|
|
4054
5228
|
if (!region)
|
|
4055
5229
|
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
4056
|
-
region.renderObject = region;
|
|
4057
5230
|
attachment.region = region;
|
|
4058
5231
|
}
|
|
4059
5232
|
return attachment;
|
|
@@ -4075,18 +5248,34 @@ var spine = (() => {
|
|
|
4075
5248
|
// spine-core/src/BoneData.ts
|
|
4076
5249
|
var BoneData = class {
|
|
4077
5250
|
constructor(index, name, parent) {
|
|
5251
|
+
/** The index of the bone in {@link Skeleton#getBones()}. */
|
|
4078
5252
|
this.index = 0;
|
|
5253
|
+
/** @returns May be null. */
|
|
4079
5254
|
this.parent = null;
|
|
5255
|
+
/** The bone's length. */
|
|
4080
5256
|
this.length = 0;
|
|
5257
|
+
/** The local x translation. */
|
|
4081
5258
|
this.x = 0;
|
|
5259
|
+
/** The local y translation. */
|
|
4082
5260
|
this.y = 0;
|
|
5261
|
+
/** The local rotation. */
|
|
4083
5262
|
this.rotation = 0;
|
|
5263
|
+
/** The local scaleX. */
|
|
4084
5264
|
this.scaleX = 1;
|
|
5265
|
+
/** The local scaleY. */
|
|
4085
5266
|
this.scaleY = 1;
|
|
5267
|
+
/** The local shearX. */
|
|
4086
5268
|
this.shearX = 0;
|
|
5269
|
+
/** The local shearX. */
|
|
4087
5270
|
this.shearY = 0;
|
|
5271
|
+
/** The transform mode for how parent world transforms affect this bone. */
|
|
4088
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 */
|
|
4089
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. */
|
|
4090
5279
|
this.color = new Color();
|
|
4091
5280
|
if (index < 0)
|
|
4092
5281
|
throw new Error("index must be >= 0.");
|
|
@@ -4097,39 +5286,62 @@ var spine = (() => {
|
|
|
4097
5286
|
this.parent = parent;
|
|
4098
5287
|
}
|
|
4099
5288
|
};
|
|
4100
|
-
var TransformMode
|
|
4101
|
-
(function(TransformMode2) {
|
|
5289
|
+
var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
|
|
4102
5290
|
TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
|
|
4103
5291
|
TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
|
|
4104
5292
|
TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
|
|
4105
5293
|
TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
|
|
4106
5294
|
TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
|
|
4107
|
-
|
|
5295
|
+
return TransformMode2;
|
|
5296
|
+
})(TransformMode || {});
|
|
4108
5297
|
|
|
4109
5298
|
// spine-core/src/Bone.ts
|
|
4110
5299
|
var Bone = class {
|
|
5300
|
+
/** @param parent May be null. */
|
|
4111
5301
|
constructor(data, skeleton, parent) {
|
|
5302
|
+
/** The parent bone, or null if this is the root bone. */
|
|
4112
5303
|
this.parent = null;
|
|
5304
|
+
/** The immediate children of this bone. */
|
|
4113
5305
|
this.children = new Array();
|
|
5306
|
+
/** The local x translation. */
|
|
4114
5307
|
this.x = 0;
|
|
5308
|
+
/** The local y translation. */
|
|
4115
5309
|
this.y = 0;
|
|
5310
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
4116
5311
|
this.rotation = 0;
|
|
5312
|
+
/** The local scaleX. */
|
|
4117
5313
|
this.scaleX = 0;
|
|
5314
|
+
/** The local scaleY. */
|
|
4118
5315
|
this.scaleY = 0;
|
|
5316
|
+
/** The local shearX. */
|
|
4119
5317
|
this.shearX = 0;
|
|
5318
|
+
/** The local shearY. */
|
|
4120
5319
|
this.shearY = 0;
|
|
5320
|
+
/** The applied local x translation. */
|
|
4121
5321
|
this.ax = 0;
|
|
5322
|
+
/** The applied local y translation. */
|
|
4122
5323
|
this.ay = 0;
|
|
5324
|
+
/** The applied local rotation in degrees, counter clockwise. */
|
|
4123
5325
|
this.arotation = 0;
|
|
5326
|
+
/** The applied local scaleX. */
|
|
4124
5327
|
this.ascaleX = 0;
|
|
5328
|
+
/** The applied local scaleY. */
|
|
4125
5329
|
this.ascaleY = 0;
|
|
5330
|
+
/** The applied local shearX. */
|
|
4126
5331
|
this.ashearX = 0;
|
|
5332
|
+
/** The applied local shearY. */
|
|
4127
5333
|
this.ashearY = 0;
|
|
5334
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4128
5335
|
this.a = 0;
|
|
5336
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4129
5337
|
this.b = 0;
|
|
5338
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4130
5339
|
this.c = 0;
|
|
5340
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4131
5341
|
this.d = 0;
|
|
5342
|
+
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4132
5343
|
this.worldY = 0;
|
|
5344
|
+
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4133
5345
|
this.worldX = 0;
|
|
4134
5346
|
this.sorted = false;
|
|
4135
5347
|
this.active = false;
|
|
@@ -4142,15 +5354,26 @@ var spine = (() => {
|
|
|
4142
5354
|
this.parent = parent;
|
|
4143
5355
|
this.setToSetupPose();
|
|
4144
5356
|
}
|
|
5357
|
+
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
|
|
5358
|
+
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
|
|
4145
5359
|
isActive() {
|
|
4146
5360
|
return this.active;
|
|
4147
5361
|
}
|
|
5362
|
+
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
4148
5363
|
update() {
|
|
4149
5364
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
4150
5365
|
}
|
|
5366
|
+
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
5367
|
+
*
|
|
5368
|
+
* See {@link #updateWorldTransformWith()}. */
|
|
4151
5369
|
updateWorldTransform() {
|
|
4152
5370
|
this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
|
|
4153
5371
|
}
|
|
5372
|
+
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
|
|
5373
|
+
* specified local transform. Child bones are not updated.
|
|
5374
|
+
*
|
|
5375
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
5376
|
+
* Runtimes Guide. */
|
|
4154
5377
|
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
|
|
4155
5378
|
this.ax = x;
|
|
4156
5379
|
this.ay = y;
|
|
@@ -4177,7 +5400,7 @@ var spine = (() => {
|
|
|
4177
5400
|
this.worldX = pa * x + pb * y + parent.worldX;
|
|
4178
5401
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
4179
5402
|
switch (this.data.transformMode) {
|
|
4180
|
-
case
|
|
5403
|
+
case 0 /* Normal */: {
|
|
4181
5404
|
let rotationY = rotation + 90 + shearY;
|
|
4182
5405
|
let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4183
5406
|
let lb = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4189,7 +5412,7 @@ var spine = (() => {
|
|
|
4189
5412
|
this.d = pc * lb + pd * ld;
|
|
4190
5413
|
return;
|
|
4191
5414
|
}
|
|
4192
|
-
case
|
|
5415
|
+
case 1 /* OnlyTranslation */: {
|
|
4193
5416
|
let rotationY = rotation + 90 + shearY;
|
|
4194
5417
|
this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4195
5418
|
this.b = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4197,7 +5420,7 @@ var spine = (() => {
|
|
|
4197
5420
|
this.d = MathUtils.sinDeg(rotationY) * scaleY;
|
|
4198
5421
|
break;
|
|
4199
5422
|
}
|
|
4200
|
-
case
|
|
5423
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4201
5424
|
let s = pa * pa + pc * pc;
|
|
4202
5425
|
let prx = 0;
|
|
4203
5426
|
if (s > 1e-4) {
|
|
@@ -4224,8 +5447,8 @@ var spine = (() => {
|
|
|
4224
5447
|
this.d = pc * lb + pd * ld;
|
|
4225
5448
|
break;
|
|
4226
5449
|
}
|
|
4227
|
-
case
|
|
4228
|
-
case
|
|
5450
|
+
case 3 /* NoScale */:
|
|
5451
|
+
case 4 /* NoScaleOrReflection */: {
|
|
4229
5452
|
let cos = MathUtils.cosDeg(rotation);
|
|
4230
5453
|
let sin = MathUtils.sinDeg(rotation);
|
|
4231
5454
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
@@ -4236,7 +5459,7 @@ var spine = (() => {
|
|
|
4236
5459
|
za *= s;
|
|
4237
5460
|
zc *= s;
|
|
4238
5461
|
s = Math.sqrt(za * za + zc * zc);
|
|
4239
|
-
if (this.data.transformMode ==
|
|
5462
|
+
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4240
5463
|
s = -s;
|
|
4241
5464
|
let r = Math.PI / 2 + Math.atan2(zc, za);
|
|
4242
5465
|
let zb = Math.cos(r) * s;
|
|
@@ -4257,6 +5480,7 @@ var spine = (() => {
|
|
|
4257
5480
|
this.c *= this.skeleton.scaleY;
|
|
4258
5481
|
this.d *= this.skeleton.scaleY;
|
|
4259
5482
|
}
|
|
5483
|
+
/** Sets this bone's local transform to the setup pose. */
|
|
4260
5484
|
setToSetupPose() {
|
|
4261
5485
|
let data = this.data;
|
|
4262
5486
|
this.x = data.x;
|
|
@@ -4267,18 +5491,30 @@ var spine = (() => {
|
|
|
4267
5491
|
this.shearX = data.shearX;
|
|
4268
5492
|
this.shearY = data.shearY;
|
|
4269
5493
|
}
|
|
5494
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
4270
5495
|
getWorldRotationX() {
|
|
4271
5496
|
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
4272
5497
|
}
|
|
5498
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
4273
5499
|
getWorldRotationY() {
|
|
4274
5500
|
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
4275
5501
|
}
|
|
5502
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
4276
5503
|
getWorldScaleX() {
|
|
4277
5504
|
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
4278
5505
|
}
|
|
5506
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
4279
5507
|
getWorldScaleY() {
|
|
4280
5508
|
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
4281
5509
|
}
|
|
5510
|
+
/** Computes the applied transform values from the world transform.
|
|
5511
|
+
*
|
|
5512
|
+
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
5513
|
+
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
|
|
5514
|
+
* constraints).
|
|
5515
|
+
*
|
|
5516
|
+
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
|
|
5517
|
+
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
|
|
4282
5518
|
updateAppliedTransform() {
|
|
4283
5519
|
let parent = this.parent;
|
|
4284
5520
|
if (!parent) {
|
|
@@ -4298,14 +5534,14 @@ var spine = (() => {
|
|
|
4298
5534
|
this.ax = dx * ia - dy * ib;
|
|
4299
5535
|
this.ay = dy * id - dx * ic;
|
|
4300
5536
|
let ra, rb, rc, rd;
|
|
4301
|
-
if (this.data.transformMode ==
|
|
5537
|
+
if (this.data.transformMode == 1 /* OnlyTranslation */) {
|
|
4302
5538
|
ra = this.a;
|
|
4303
5539
|
rb = this.b;
|
|
4304
5540
|
rc = this.c;
|
|
4305
5541
|
rd = this.d;
|
|
4306
5542
|
} else {
|
|
4307
5543
|
switch (this.data.transformMode) {
|
|
4308
|
-
case
|
|
5544
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4309
5545
|
let s2 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4310
5546
|
let sa = pa / this.skeleton.scaleX;
|
|
4311
5547
|
let sc = pc / this.skeleton.scaleY;
|
|
@@ -4316,8 +5552,8 @@ var spine = (() => {
|
|
|
4316
5552
|
ib = pb * pid;
|
|
4317
5553
|
break;
|
|
4318
5554
|
}
|
|
4319
|
-
case
|
|
4320
|
-
case
|
|
5555
|
+
case 3 /* NoScale */:
|
|
5556
|
+
case 4 /* NoScaleOrReflection */:
|
|
4321
5557
|
let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
|
|
4322
5558
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
4323
5559
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
@@ -4327,7 +5563,7 @@ var spine = (() => {
|
|
|
4327
5563
|
pa *= s;
|
|
4328
5564
|
pc *= s;
|
|
4329
5565
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
4330
|
-
if (this.data.transformMode ==
|
|
5566
|
+
if (this.data.transformMode == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4331
5567
|
s = -s;
|
|
4332
5568
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
4333
5569
|
pb = Math.cos(r) * s;
|
|
@@ -4357,6 +5593,7 @@ var spine = (() => {
|
|
|
4357
5593
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
4358
5594
|
}
|
|
4359
5595
|
}
|
|
5596
|
+
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
4360
5597
|
worldToLocal(world) {
|
|
4361
5598
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
4362
5599
|
let x = world.x - this.worldX, y = world.y - this.worldY;
|
|
@@ -4364,21 +5601,28 @@ var spine = (() => {
|
|
|
4364
5601
|
world.y = y * this.a * invDet - x * this.c * invDet;
|
|
4365
5602
|
return world;
|
|
4366
5603
|
}
|
|
5604
|
+
/** Transforms a point from the bone's local coordinates to world coordinates. */
|
|
4367
5605
|
localToWorld(local) {
|
|
4368
5606
|
let x = local.x, y = local.y;
|
|
4369
5607
|
local.x = x * this.a + y * this.b + this.worldX;
|
|
4370
5608
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
4371
5609
|
return local;
|
|
4372
5610
|
}
|
|
5611
|
+
/** Transforms a world rotation to a local rotation. */
|
|
4373
5612
|
worldToLocalRotation(worldRotation) {
|
|
4374
5613
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
4375
5614
|
return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
|
|
4376
5615
|
}
|
|
5616
|
+
/** Transforms a local rotation to a world rotation. */
|
|
4377
5617
|
localToWorldRotation(localRotation) {
|
|
4378
5618
|
localRotation -= this.rotation - this.shearX;
|
|
4379
5619
|
let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
|
|
4380
5620
|
return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
|
|
4381
5621
|
}
|
|
5622
|
+
/** Rotates the world transform the specified amount.
|
|
5623
|
+
* <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. */
|
|
4382
5626
|
rotateWorld(degrees) {
|
|
4383
5627
|
let a = this.a, b = this.b, c = this.c, d = this.d;
|
|
4384
5628
|
let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
|
|
@@ -4520,17 +5764,21 @@ var spine = (() => {
|
|
|
4520
5764
|
let atlas = new TextureAtlas(atlasText);
|
|
4521
5765
|
let toLoad = atlas.pages.length, abort = false;
|
|
4522
5766
|
for (let page of atlas.pages) {
|
|
4523
|
-
this.loadTexture(
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
if (
|
|
4527
|
-
|
|
5767
|
+
this.loadTexture(
|
|
5768
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5769
|
+
(imagePath, texture) => {
|
|
5770
|
+
if (!abort) {
|
|
5771
|
+
page.setTexture(texture);
|
|
5772
|
+
if (--toLoad == 0)
|
|
5773
|
+
this.success(success, path, atlas);
|
|
5774
|
+
}
|
|
5775
|
+
},
|
|
5776
|
+
(imagePath, message) => {
|
|
5777
|
+
if (!abort)
|
|
5778
|
+
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
5779
|
+
abort = true;
|
|
4528
5780
|
}
|
|
4529
|
-
|
|
4530
|
-
if (!abort)
|
|
4531
|
-
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
4532
|
-
abort = true;
|
|
4533
|
-
});
|
|
5781
|
+
);
|
|
4534
5782
|
}
|
|
4535
5783
|
} catch (e) {
|
|
4536
5784
|
this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
|
|
@@ -4726,10 +5974,16 @@ var spine = (() => {
|
|
|
4726
5974
|
// spine-core/src/IkConstraint.ts
|
|
4727
5975
|
var IkConstraint = class {
|
|
4728
5976
|
constructor(data, skeleton) {
|
|
5977
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4729
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. */
|
|
4730
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. */
|
|
4731
5983
|
this.stretch = false;
|
|
5984
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4732
5985
|
this.mix = 1;
|
|
5986
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4733
5987
|
this.softness = 0;
|
|
4734
5988
|
this.active = false;
|
|
4735
5989
|
if (!data)
|
|
@@ -4771,6 +6025,7 @@ var spine = (() => {
|
|
|
4771
6025
|
break;
|
|
4772
6026
|
}
|
|
4773
6027
|
}
|
|
6028
|
+
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
4774
6029
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4775
6030
|
let p = bone.parent;
|
|
4776
6031
|
if (!p)
|
|
@@ -4778,12 +6033,12 @@ var spine = (() => {
|
|
|
4778
6033
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4779
6034
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4780
6035
|
switch (bone.data.transformMode) {
|
|
4781
|
-
case
|
|
6036
|
+
case 1 /* OnlyTranslation */:
|
|
4782
6037
|
tx = targetX - bone.worldX;
|
|
4783
6038
|
ty = targetY - bone.worldY;
|
|
4784
6039
|
break;
|
|
4785
|
-
case
|
|
4786
|
-
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
6040
|
+
case 2 /* NoRotationOrReflection */:
|
|
6041
|
+
let s = Math.abs(pa * pd - pb * pc) / Math.max(1e-4, pa * pa + pc * pc);
|
|
4787
6042
|
let sa = pa / bone.skeleton.scaleX;
|
|
4788
6043
|
let sc = pc / bone.skeleton.scaleY;
|
|
4789
6044
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
@@ -4792,8 +6047,13 @@ var spine = (() => {
|
|
|
4792
6047
|
default:
|
|
4793
6048
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
4794
6049
|
let d = pa * pd - pb * pc;
|
|
4795
|
-
|
|
4796
|
-
|
|
6050
|
+
if (Math.abs(d) <= 1e-4) {
|
|
6051
|
+
tx = 0;
|
|
6052
|
+
ty = 0;
|
|
6053
|
+
} else {
|
|
6054
|
+
tx = (x * pd - y * pb) / d - bone.ax;
|
|
6055
|
+
ty = (y * pa - x * pc) / d - bone.ay;
|
|
6056
|
+
}
|
|
4797
6057
|
}
|
|
4798
6058
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
4799
6059
|
if (bone.ascaleX < 0)
|
|
@@ -4805,8 +6065,8 @@ var spine = (() => {
|
|
|
4805
6065
|
let sx = bone.ascaleX, sy = bone.ascaleY;
|
|
4806
6066
|
if (compress || stretch) {
|
|
4807
6067
|
switch (bone.data.transformMode) {
|
|
4808
|
-
case
|
|
4809
|
-
case
|
|
6068
|
+
case 3 /* NoScale */:
|
|
6069
|
+
case 4 /* NoScaleOrReflection */:
|
|
4810
6070
|
tx = targetX - bone.worldX;
|
|
4811
6071
|
ty = targetY - bone.worldY;
|
|
4812
6072
|
}
|
|
@@ -4818,8 +6078,18 @@ var spine = (() => {
|
|
|
4818
6078
|
sy *= s;
|
|
4819
6079
|
}
|
|
4820
6080
|
}
|
|
4821
|
-
bone.updateWorldTransformWith(
|
|
6081
|
+
bone.updateWorldTransformWith(
|
|
6082
|
+
bone.ax,
|
|
6083
|
+
bone.ay,
|
|
6084
|
+
bone.arotation + rotationIK * alpha,
|
|
6085
|
+
sx,
|
|
6086
|
+
sy,
|
|
6087
|
+
bone.ashearX,
|
|
6088
|
+
bone.ashearY
|
|
6089
|
+
);
|
|
4822
6090
|
}
|
|
6091
|
+
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6092
|
+
* @param child A direct descendant of the parent bone. */
|
|
4823
6093
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
4824
6094
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
4825
6095
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
@@ -4858,7 +6128,8 @@ var spine = (() => {
|
|
|
4858
6128
|
b = pp.b;
|
|
4859
6129
|
c = pp.c;
|
|
4860
6130
|
d = pp.d;
|
|
4861
|
-
let id =
|
|
6131
|
+
let id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY;
|
|
6132
|
+
id = Math.abs(id) <= 1e-4 ? 0 : 1 / id;
|
|
4862
6133
|
let dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
|
|
4863
6134
|
let l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;
|
|
4864
6135
|
if (l1 < 1e-4) {
|
|
@@ -4974,13 +6245,23 @@ var spine = (() => {
|
|
|
4974
6245
|
var IkConstraintData = class extends ConstraintData {
|
|
4975
6246
|
constructor(name) {
|
|
4976
6247
|
super(name, 0, false);
|
|
6248
|
+
/** The bones that are constrained by this IK constraint. */
|
|
4977
6249
|
this.bones = new Array();
|
|
6250
|
+
/** The bone that is the IK target. */
|
|
4978
6251
|
this._target = null;
|
|
6252
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4979
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. */
|
|
4980
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. */
|
|
4981
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. */
|
|
4982
6261
|
this.uniform = false;
|
|
6262
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4983
6263
|
this.mix = 1;
|
|
6264
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4984
6265
|
this.softness = 0;
|
|
4985
6266
|
}
|
|
4986
6267
|
set target(boneData) {
|
|
@@ -4998,13 +6279,21 @@ var spine = (() => {
|
|
|
4998
6279
|
var PathConstraintData = class extends ConstraintData {
|
|
4999
6280
|
constructor(name) {
|
|
5000
6281
|
super(name, 0, false);
|
|
6282
|
+
/** The bones that will be modified by this path constraint. */
|
|
5001
6283
|
this.bones = new Array();
|
|
6284
|
+
/** The slot whose path attachment will be used to constrained the bones. */
|
|
5002
6285
|
this._target = null;
|
|
6286
|
+
/** The mode for positioning the first bone on the path. */
|
|
5003
6287
|
this.positionMode = PositionMode.Fixed;
|
|
6288
|
+
/** The mode for positioning the bones after the first bone on the path. */
|
|
5004
6289
|
this.spacingMode = SpacingMode.Fixed;
|
|
6290
|
+
/** The mode for adjusting the rotation of the bones. */
|
|
5005
6291
|
this.rotateMode = RotateMode.Chain;
|
|
6292
|
+
/** An offset added to the constrained bone rotation. */
|
|
5006
6293
|
this.offsetRotation = 0;
|
|
6294
|
+
/** The position along the path. */
|
|
5007
6295
|
this.position = 0;
|
|
6296
|
+
/** The spacing between bones. */
|
|
5008
6297
|
this.spacing = 0;
|
|
5009
6298
|
this.mixRotate = 0;
|
|
5010
6299
|
this.mixX = 0;
|
|
@@ -5020,29 +6309,31 @@ var spine = (() => {
|
|
|
5020
6309
|
return this._target;
|
|
5021
6310
|
}
|
|
5022
6311
|
};
|
|
5023
|
-
var PositionMode
|
|
5024
|
-
(function(PositionMode2) {
|
|
6312
|
+
var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
|
|
5025
6313
|
PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
|
|
5026
6314
|
PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
(
|
|
6315
|
+
return PositionMode2;
|
|
6316
|
+
})(PositionMode || {});
|
|
6317
|
+
var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
|
|
5030
6318
|
SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
|
|
5031
6319
|
SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
|
|
5032
6320
|
SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
|
|
5033
6321
|
SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
(
|
|
6322
|
+
return SpacingMode2;
|
|
6323
|
+
})(SpacingMode || {});
|
|
6324
|
+
var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
5037
6325
|
RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
|
|
5038
6326
|
RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
|
|
5039
6327
|
RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
|
|
5040
|
-
|
|
6328
|
+
return RotateMode2;
|
|
6329
|
+
})(RotateMode || {});
|
|
5041
6330
|
|
|
5042
6331
|
// spine-core/src/PathConstraint.ts
|
|
5043
6332
|
var _PathConstraint = class {
|
|
5044
6333
|
constructor(data, skeleton) {
|
|
6334
|
+
/** The position along the path. */
|
|
5045
6335
|
this.position = 0;
|
|
6336
|
+
/** The spacing between bones. */
|
|
5046
6337
|
this.spacing = 0;
|
|
5047
6338
|
this.mixRotate = 0;
|
|
5048
6339
|
this.mixX = 0;
|
|
@@ -5087,13 +6378,13 @@ var spine = (() => {
|
|
|
5087
6378
|
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
5088
6379
|
return;
|
|
5089
6380
|
let data = this.data;
|
|
5090
|
-
let tangents = data.rotateMode ==
|
|
6381
|
+
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
5091
6382
|
let bones = this.bones;
|
|
5092
6383
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5093
6384
|
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5094
6385
|
let spacing = this.spacing;
|
|
5095
6386
|
switch (data.spacingMode) {
|
|
5096
|
-
case
|
|
6387
|
+
case 2 /* Percent */:
|
|
5097
6388
|
if (scale) {
|
|
5098
6389
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
5099
6390
|
let bone = bones[i];
|
|
@@ -5108,7 +6399,7 @@ var spine = (() => {
|
|
|
5108
6399
|
}
|
|
5109
6400
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
5110
6401
|
break;
|
|
5111
|
-
case
|
|
6402
|
+
case 3 /* Proportional */:
|
|
5112
6403
|
let sum = 0;
|
|
5113
6404
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5114
6405
|
let bone = bones[i];
|
|
@@ -5133,7 +6424,7 @@ var spine = (() => {
|
|
|
5133
6424
|
}
|
|
5134
6425
|
break;
|
|
5135
6426
|
default:
|
|
5136
|
-
let lengthSpacing = data.spacingMode ==
|
|
6427
|
+
let lengthSpacing = data.spacingMode == 0 /* Length */;
|
|
5137
6428
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5138
6429
|
let bone = bones[i];
|
|
5139
6430
|
let setupLength = bone.data.length;
|
|
@@ -5154,7 +6445,7 @@ var spine = (() => {
|
|
|
5154
6445
|
let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
|
|
5155
6446
|
let tip = false;
|
|
5156
6447
|
if (offsetRotation == 0)
|
|
5157
|
-
tip = data.rotateMode ==
|
|
6448
|
+
tip = data.rotateMode == 1 /* Chain */;
|
|
5158
6449
|
else {
|
|
5159
6450
|
tip = false;
|
|
5160
6451
|
let p = this.target.bone;
|
|
@@ -5218,14 +6509,14 @@ var spine = (() => {
|
|
|
5218
6509
|
let lengths = path.lengths;
|
|
5219
6510
|
curveCount -= closed2 ? 1 : 2;
|
|
5220
6511
|
let pathLength2 = lengths[curveCount];
|
|
5221
|
-
if (this.data.positionMode ==
|
|
6512
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5222
6513
|
position *= pathLength2;
|
|
5223
6514
|
let multiplier2;
|
|
5224
6515
|
switch (this.data.spacingMode) {
|
|
5225
|
-
case
|
|
6516
|
+
case 2 /* Percent */:
|
|
5226
6517
|
multiplier2 = pathLength2;
|
|
5227
6518
|
break;
|
|
5228
|
-
case
|
|
6519
|
+
case 3 /* Proportional */:
|
|
5229
6520
|
multiplier2 = pathLength2 / spacesCount;
|
|
5230
6521
|
break;
|
|
5231
6522
|
default:
|
|
@@ -5276,7 +6567,20 @@ var spine = (() => {
|
|
|
5276
6567
|
} else
|
|
5277
6568
|
path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
|
|
5278
6569
|
}
|
|
5279
|
-
this.addCurvePosition(
|
|
6570
|
+
this.addCurvePosition(
|
|
6571
|
+
p,
|
|
6572
|
+
world[0],
|
|
6573
|
+
world[1],
|
|
6574
|
+
world[2],
|
|
6575
|
+
world[3],
|
|
6576
|
+
world[4],
|
|
6577
|
+
world[5],
|
|
6578
|
+
world[6],
|
|
6579
|
+
world[7],
|
|
6580
|
+
out,
|
|
6581
|
+
o,
|
|
6582
|
+
tangents || i > 0 && space == 0
|
|
6583
|
+
);
|
|
5280
6584
|
}
|
|
5281
6585
|
return out;
|
|
5282
6586
|
}
|
|
@@ -5328,14 +6632,14 @@ var spine = (() => {
|
|
|
5328
6632
|
x1 = x2;
|
|
5329
6633
|
y1 = y2;
|
|
5330
6634
|
}
|
|
5331
|
-
if (this.data.positionMode ==
|
|
6635
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5332
6636
|
position *= pathLength;
|
|
5333
6637
|
let multiplier;
|
|
5334
6638
|
switch (this.data.spacingMode) {
|
|
5335
|
-
case
|
|
6639
|
+
case 2 /* Percent */:
|
|
5336
6640
|
multiplier = pathLength;
|
|
5337
6641
|
break;
|
|
5338
|
-
case
|
|
6642
|
+
case 3 /* Proportional */:
|
|
5339
6643
|
multiplier = pathLength / spacesCount;
|
|
5340
6644
|
break;
|
|
5341
6645
|
default:
|
|
@@ -5468,10 +6772,18 @@ var spine = (() => {
|
|
|
5468
6772
|
// spine-core/src/Slot.ts
|
|
5469
6773
|
var Slot = class {
|
|
5470
6774
|
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. */
|
|
5471
6777
|
this.darkColor = null;
|
|
5472
6778
|
this.attachment = null;
|
|
5473
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()}. */
|
|
5474
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}. */
|
|
5475
6787
|
this.deform = new Array();
|
|
5476
6788
|
if (!data)
|
|
5477
6789
|
throw new Error("data cannot be null.");
|
|
@@ -5483,12 +6795,17 @@ var spine = (() => {
|
|
|
5483
6795
|
this.darkColor = !data.darkColor ? null : new Color();
|
|
5484
6796
|
this.setToSetupPose();
|
|
5485
6797
|
}
|
|
6798
|
+
/** The skeleton this slot belongs to. */
|
|
5486
6799
|
getSkeleton() {
|
|
5487
6800
|
return this.bone.skeleton;
|
|
5488
6801
|
}
|
|
6802
|
+
/** The current attachment for the slot, or null if the slot has no attachment. */
|
|
5489
6803
|
getAttachment() {
|
|
5490
6804
|
return this.attachment;
|
|
5491
6805
|
}
|
|
6806
|
+
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
|
|
6807
|
+
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
6808
|
+
* specified attachment. */
|
|
5492
6809
|
setAttachment(attachment) {
|
|
5493
6810
|
if (this.attachment == attachment)
|
|
5494
6811
|
return;
|
|
@@ -5498,6 +6815,7 @@ var spine = (() => {
|
|
|
5498
6815
|
this.attachment = attachment;
|
|
5499
6816
|
this.sequenceIndex = -1;
|
|
5500
6817
|
}
|
|
6818
|
+
/** Sets this slot to the setup pose. */
|
|
5501
6819
|
setToSetupPose() {
|
|
5502
6820
|
this.color.setFromColor(this.data.color);
|
|
5503
6821
|
if (this.darkColor)
|
|
@@ -5549,7 +6867,7 @@ var spine = (() => {
|
|
|
5549
6867
|
return this.active;
|
|
5550
6868
|
}
|
|
5551
6869
|
update() {
|
|
5552
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.
|
|
6870
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
5553
6871
|
return;
|
|
5554
6872
|
if (this.data.local) {
|
|
5555
6873
|
if (this.data.relative)
|
|
@@ -5726,13 +7044,21 @@ var spine = (() => {
|
|
|
5726
7044
|
};
|
|
5727
7045
|
|
|
5728
7046
|
// spine-core/src/Skeleton.ts
|
|
5729
|
-
var
|
|
7047
|
+
var _Skeleton = class {
|
|
5730
7048
|
constructor(data) {
|
|
7049
|
+
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
5731
7050
|
this._updateCache = new Array();
|
|
7051
|
+
/** The skeleton's current skin. May be null. */
|
|
5732
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. */
|
|
5733
7055
|
this.scaleX = 1;
|
|
5734
|
-
|
|
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. */
|
|
5735
7060
|
this.x = 0;
|
|
7061
|
+
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
5736
7062
|
this.y = 0;
|
|
5737
7063
|
if (!data)
|
|
5738
7064
|
throw new Error("data cannot be null.");
|
|
@@ -5777,6 +7103,14 @@ var spine = (() => {
|
|
|
5777
7103
|
this.color = new Color(1, 1, 1, 1);
|
|
5778
7104
|
this.updateCache();
|
|
5779
7105
|
}
|
|
7106
|
+
get scaleY() {
|
|
7107
|
+
return _Skeleton.yDown ? -this._scaleY : this._scaleY;
|
|
7108
|
+
}
|
|
7109
|
+
set scaleY(scaleY) {
|
|
7110
|
+
this._scaleY = scaleY;
|
|
7111
|
+
}
|
|
7112
|
+
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
|
|
7113
|
+
* constraints, or weighted path attachments are added or removed. */
|
|
5780
7114
|
updateCache() {
|
|
5781
7115
|
let updateCache = this._updateCache;
|
|
5782
7116
|
updateCache.length = 0;
|
|
@@ -5944,6 +7278,10 @@ var spine = (() => {
|
|
|
5944
7278
|
bone.sorted = false;
|
|
5945
7279
|
}
|
|
5946
7280
|
}
|
|
7281
|
+
/** Updates the world transform for each bone and applies all constraints.
|
|
7282
|
+
*
|
|
7283
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7284
|
+
* Runtimes Guide. */
|
|
5947
7285
|
updateWorldTransform() {
|
|
5948
7286
|
let bones = this.bones;
|
|
5949
7287
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
@@ -5983,10 +7321,12 @@ var spine = (() => {
|
|
|
5983
7321
|
updatable.update();
|
|
5984
7322
|
}
|
|
5985
7323
|
}
|
|
7324
|
+
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
5986
7325
|
setToSetupPose() {
|
|
5987
7326
|
this.setBonesToSetupPose();
|
|
5988
7327
|
this.setSlotsToSetupPose();
|
|
5989
7328
|
}
|
|
7329
|
+
/** Sets the bones and constraints to their setup pose values. */
|
|
5990
7330
|
setBonesToSetupPose() {
|
|
5991
7331
|
let bones = this.bones;
|
|
5992
7332
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
@@ -6022,17 +7362,20 @@ var spine = (() => {
|
|
|
6022
7362
|
constraint.mixY = data.mixY;
|
|
6023
7363
|
}
|
|
6024
7364
|
}
|
|
7365
|
+
/** Sets the slots and draw order to their setup pose values. */
|
|
6025
7366
|
setSlotsToSetupPose() {
|
|
6026
7367
|
let slots = this.slots;
|
|
6027
7368
|
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
|
|
6028
7369
|
for (let i = 0, n = slots.length; i < n; i++)
|
|
6029
7370
|
slots[i].setToSetupPose();
|
|
6030
7371
|
}
|
|
7372
|
+
/** @returns May return null. */
|
|
6031
7373
|
getRootBone() {
|
|
6032
7374
|
if (this.bones.length == 0)
|
|
6033
7375
|
return null;
|
|
6034
7376
|
return this.bones[0];
|
|
6035
7377
|
}
|
|
7378
|
+
/** @returns May be null. */
|
|
6036
7379
|
findBone(boneName) {
|
|
6037
7380
|
if (!boneName)
|
|
6038
7381
|
throw new Error("boneName cannot be null.");
|
|
@@ -6044,6 +7387,9 @@ var spine = (() => {
|
|
|
6044
7387
|
}
|
|
6045
7388
|
return null;
|
|
6046
7389
|
}
|
|
7390
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7391
|
+
* repeatedly.
|
|
7392
|
+
* @returns May be null. */
|
|
6047
7393
|
findSlot(slotName) {
|
|
6048
7394
|
if (!slotName)
|
|
6049
7395
|
throw new Error("slotName cannot be null.");
|
|
@@ -6055,12 +7401,25 @@ var spine = (() => {
|
|
|
6055
7401
|
}
|
|
6056
7402
|
return null;
|
|
6057
7403
|
}
|
|
7404
|
+
/** Sets a skin by name.
|
|
7405
|
+
*
|
|
7406
|
+
* See {@link #setSkin()}. */
|
|
6058
7407
|
setSkinByName(skinName) {
|
|
6059
7408
|
let skin = this.data.findSkin(skinName);
|
|
6060
7409
|
if (!skin)
|
|
6061
7410
|
throw new Error("Skin not found: " + skinName);
|
|
6062
7411
|
this.setSkin(skin);
|
|
6063
7412
|
}
|
|
7413
|
+
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
7414
|
+
* skin is changed, {@link #updateCache()} is called.
|
|
7415
|
+
*
|
|
7416
|
+
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
|
|
7417
|
+
* old skin, each slot's setup mode attachment is attached from the new skin.
|
|
7418
|
+
*
|
|
7419
|
+
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
|
|
7420
|
+
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
|
|
7421
|
+
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7422
|
+
* @param newSkin May be null. */
|
|
6064
7423
|
setSkin(newSkin) {
|
|
6065
7424
|
if (newSkin == this.skin)
|
|
6066
7425
|
return;
|
|
@@ -6083,12 +7442,22 @@ var spine = (() => {
|
|
|
6083
7442
|
this.skin = newSkin;
|
|
6084
7443
|
this.updateCache();
|
|
6085
7444
|
}
|
|
7445
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
|
|
7446
|
+
* name.
|
|
7447
|
+
*
|
|
7448
|
+
* See {@link #getAttachment()}.
|
|
7449
|
+
* @returns May be null. */
|
|
6086
7450
|
getAttachmentByName(slotName, attachmentName) {
|
|
6087
7451
|
let slot = this.data.findSlot(slotName);
|
|
6088
7452
|
if (!slot)
|
|
6089
7453
|
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6090
7454
|
return this.getAttachment(slot.index, attachmentName);
|
|
6091
7455
|
}
|
|
7456
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
7457
|
+
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
|
|
7458
|
+
*
|
|
7459
|
+
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7460
|
+
* @returns May be null. */
|
|
6092
7461
|
getAttachment(slotIndex, attachmentName) {
|
|
6093
7462
|
if (!attachmentName)
|
|
6094
7463
|
throw new Error("attachmentName cannot be null.");
|
|
@@ -6101,6 +7470,9 @@ var spine = (() => {
|
|
|
6101
7470
|
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
6102
7471
|
return null;
|
|
6103
7472
|
}
|
|
7473
|
+
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7474
|
+
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7475
|
+
* @param attachmentName May be null to clear the slot's attachment. */
|
|
6104
7476
|
setAttachment(slotName, attachmentName) {
|
|
6105
7477
|
if (!slotName)
|
|
6106
7478
|
throw new Error("slotName cannot be null.");
|
|
@@ -6120,6 +7492,9 @@ var spine = (() => {
|
|
|
6120
7492
|
}
|
|
6121
7493
|
throw new Error("Slot not found: " + slotName);
|
|
6122
7494
|
}
|
|
7495
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7496
|
+
* than to call it repeatedly.
|
|
7497
|
+
* @return May be null. */
|
|
6123
7498
|
findIkConstraint(constraintName) {
|
|
6124
7499
|
if (!constraintName)
|
|
6125
7500
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6131,6 +7506,9 @@ var spine = (() => {
|
|
|
6131
7506
|
}
|
|
6132
7507
|
return null;
|
|
6133
7508
|
}
|
|
7509
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7510
|
+
* this method than to call it repeatedly.
|
|
7511
|
+
* @return May be null. */
|
|
6134
7512
|
findTransformConstraint(constraintName) {
|
|
6135
7513
|
if (!constraintName)
|
|
6136
7514
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6142,6 +7520,9 @@ var spine = (() => {
|
|
|
6142
7520
|
}
|
|
6143
7521
|
return null;
|
|
6144
7522
|
}
|
|
7523
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7524
|
+
* than to call it repeatedly.
|
|
7525
|
+
* @return May be null. */
|
|
6145
7526
|
findPathConstraint(constraintName) {
|
|
6146
7527
|
if (!constraintName)
|
|
6147
7528
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6153,12 +7534,18 @@ var spine = (() => {
|
|
|
6153
7534
|
}
|
|
6154
7535
|
return null;
|
|
6155
7536
|
}
|
|
7537
|
+
/** 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
|
+
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
6156
7539
|
getBoundsRect() {
|
|
6157
7540
|
let offset = new Vector2();
|
|
6158
7541
|
let size = new Vector2();
|
|
6159
7542
|
this.getBounds(offset, size);
|
|
6160
7543
|
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6161
7544
|
}
|
|
7545
|
+
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
|
|
7546
|
+
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
|
7547
|
+
* @param size An output value, the width and height of the AABB.
|
|
7548
|
+
* @param temp Working memory to temporarily store attachments' computed world vertices. */
|
|
6162
7549
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6163
7550
|
if (!offset)
|
|
6164
7551
|
throw new Error("offset cannot be null.");
|
|
@@ -6197,30 +7584,59 @@ var spine = (() => {
|
|
|
6197
7584
|
size.set(maxX - minX, maxY - minY);
|
|
6198
7585
|
}
|
|
6199
7586
|
};
|
|
7587
|
+
var Skeleton = _Skeleton;
|
|
7588
|
+
Skeleton.yDown = false;
|
|
6200
7589
|
|
|
6201
7590
|
// spine-core/src/SkeletonData.ts
|
|
6202
7591
|
var SkeletonData = class {
|
|
6203
7592
|
constructor() {
|
|
7593
|
+
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
|
6204
7594
|
this.name = null;
|
|
7595
|
+
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
6205
7596
|
this.bones = new Array();
|
|
7597
|
+
// Ordered parents first.
|
|
7598
|
+
/** The skeleton's slots. */
|
|
6206
7599
|
this.slots = new Array();
|
|
7600
|
+
// Setup pose draw order.
|
|
6207
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. */
|
|
6208
7606
|
this.defaultSkin = null;
|
|
7607
|
+
/** The skeleton's events. */
|
|
6209
7608
|
this.events = new Array();
|
|
7609
|
+
/** The skeleton's animations. */
|
|
6210
7610
|
this.animations = new Array();
|
|
7611
|
+
/** The skeleton's IK constraints. */
|
|
6211
7612
|
this.ikConstraints = new Array();
|
|
7613
|
+
/** The skeleton's transform constraints. */
|
|
6212
7614
|
this.transformConstraints = new Array();
|
|
7615
|
+
/** The skeleton's path constraints. */
|
|
6213
7616
|
this.pathConstraints = new Array();
|
|
7617
|
+
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6214
7618
|
this.x = 0;
|
|
7619
|
+
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6215
7620
|
this.y = 0;
|
|
7621
|
+
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6216
7622
|
this.width = 0;
|
|
7623
|
+
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6217
7624
|
this.height = 0;
|
|
7625
|
+
/** The Spine version used to export the skeleton data, or null. */
|
|
6218
7626
|
this.version = null;
|
|
7627
|
+
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
|
6219
7628
|
this.hash = null;
|
|
7629
|
+
// Nonessential
|
|
7630
|
+
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
|
6220
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. */
|
|
6221
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. */
|
|
6222
7635
|
this.audioPath = null;
|
|
6223
7636
|
}
|
|
7637
|
+
/** 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
|
+
* multiple times.
|
|
7639
|
+
* @returns May be null. */
|
|
6224
7640
|
findBone(boneName) {
|
|
6225
7641
|
if (!boneName)
|
|
6226
7642
|
throw new Error("boneName cannot be null.");
|
|
@@ -6232,6 +7648,9 @@ var spine = (() => {
|
|
|
6232
7648
|
}
|
|
6233
7649
|
return null;
|
|
6234
7650
|
}
|
|
7651
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7652
|
+
* multiple times.
|
|
7653
|
+
* @returns May be null. */
|
|
6235
7654
|
findSlot(slotName) {
|
|
6236
7655
|
if (!slotName)
|
|
6237
7656
|
throw new Error("slotName cannot be null.");
|
|
@@ -6243,6 +7662,9 @@ var spine = (() => {
|
|
|
6243
7662
|
}
|
|
6244
7663
|
return null;
|
|
6245
7664
|
}
|
|
7665
|
+
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
|
|
7666
|
+
* multiple times.
|
|
7667
|
+
* @returns May be null. */
|
|
6246
7668
|
findSkin(skinName) {
|
|
6247
7669
|
if (!skinName)
|
|
6248
7670
|
throw new Error("skinName cannot be null.");
|
|
@@ -6254,6 +7676,9 @@ var spine = (() => {
|
|
|
6254
7676
|
}
|
|
6255
7677
|
return null;
|
|
6256
7678
|
}
|
|
7679
|
+
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
|
|
7680
|
+
* multiple times.
|
|
7681
|
+
* @returns May be null. */
|
|
6257
7682
|
findEvent(eventDataName) {
|
|
6258
7683
|
if (!eventDataName)
|
|
6259
7684
|
throw new Error("eventDataName cannot be null.");
|
|
@@ -6265,6 +7690,9 @@ var spine = (() => {
|
|
|
6265
7690
|
}
|
|
6266
7691
|
return null;
|
|
6267
7692
|
}
|
|
7693
|
+
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
|
|
7694
|
+
* call it multiple times.
|
|
7695
|
+
* @returns May be null. */
|
|
6268
7696
|
findAnimation(animationName) {
|
|
6269
7697
|
if (!animationName)
|
|
6270
7698
|
throw new Error("animationName cannot be null.");
|
|
@@ -6276,6 +7704,9 @@ var spine = (() => {
|
|
|
6276
7704
|
}
|
|
6277
7705
|
return null;
|
|
6278
7706
|
}
|
|
7707
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7708
|
+
* than to call it multiple times.
|
|
7709
|
+
* @return May be null. */
|
|
6279
7710
|
findIkConstraint(constraintName) {
|
|
6280
7711
|
if (!constraintName)
|
|
6281
7712
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6287,6 +7718,9 @@ var spine = (() => {
|
|
|
6287
7718
|
}
|
|
6288
7719
|
return null;
|
|
6289
7720
|
}
|
|
7721
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7722
|
+
* this method than to call it multiple times.
|
|
7723
|
+
* @return May be null. */
|
|
6290
7724
|
findTransformConstraint(constraintName) {
|
|
6291
7725
|
if (!constraintName)
|
|
6292
7726
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6298,6 +7732,9 @@ var spine = (() => {
|
|
|
6298
7732
|
}
|
|
6299
7733
|
return null;
|
|
6300
7734
|
}
|
|
7735
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7736
|
+
* than to call it multiple times.
|
|
7737
|
+
* @return May be null. */
|
|
6301
7738
|
findPathConstraint(constraintName) {
|
|
6302
7739
|
if (!constraintName)
|
|
6303
7740
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6328,6 +7765,7 @@ var spine = (() => {
|
|
|
6328
7765
|
throw new Error("name cannot be null.");
|
|
6329
7766
|
this.name = name;
|
|
6330
7767
|
}
|
|
7768
|
+
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
6331
7769
|
setAttachment(slotIndex, name, attachment) {
|
|
6332
7770
|
if (!attachment)
|
|
6333
7771
|
throw new Error("attachment cannot be null.");
|
|
@@ -6338,6 +7776,7 @@ var spine = (() => {
|
|
|
6338
7776
|
attachments[slotIndex] = {};
|
|
6339
7777
|
attachments[slotIndex][name] = attachment;
|
|
6340
7778
|
}
|
|
7779
|
+
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
6341
7780
|
addSkin(skin) {
|
|
6342
7781
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6343
7782
|
let bone = skin.bones[i];
|
|
@@ -6369,6 +7808,8 @@ var spine = (() => {
|
|
|
6369
7808
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
6370
7809
|
}
|
|
6371
7810
|
}
|
|
7811
|
+
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
|
|
7812
|
+
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
|
|
6372
7813
|
copySkin(skin) {
|
|
6373
7814
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6374
7815
|
let bone = skin.bones[i];
|
|
@@ -6408,15 +7849,18 @@ var spine = (() => {
|
|
|
6408
7849
|
}
|
|
6409
7850
|
}
|
|
6410
7851
|
}
|
|
7852
|
+
/** Returns the attachment for the specified slot index and name, or null. */
|
|
6411
7853
|
getAttachment(slotIndex, name) {
|
|
6412
7854
|
let dictionary = this.attachments[slotIndex];
|
|
6413
7855
|
return dictionary ? dictionary[name] : null;
|
|
6414
7856
|
}
|
|
7857
|
+
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
6415
7858
|
removeAttachment(slotIndex, name) {
|
|
6416
7859
|
let dictionary = this.attachments[slotIndex];
|
|
6417
7860
|
if (dictionary)
|
|
6418
7861
|
delete dictionary[name];
|
|
6419
7862
|
}
|
|
7863
|
+
/** Returns all attachments in this skin. */
|
|
6420
7864
|
getAttachments() {
|
|
6421
7865
|
let entries = new Array();
|
|
6422
7866
|
for (var i = 0; i < this.attachments.length; i++) {
|
|
@@ -6431,6 +7875,7 @@ var spine = (() => {
|
|
|
6431
7875
|
}
|
|
6432
7876
|
return entries;
|
|
6433
7877
|
}
|
|
7878
|
+
/** Returns all attachments in this skin for the specified slot index. */
|
|
6434
7879
|
getAttachmentsForSlot(slotIndex, attachments) {
|
|
6435
7880
|
let slotAttachments = this.attachments[slotIndex];
|
|
6436
7881
|
if (slotAttachments) {
|
|
@@ -6441,11 +7886,13 @@ var spine = (() => {
|
|
|
6441
7886
|
}
|
|
6442
7887
|
}
|
|
6443
7888
|
}
|
|
7889
|
+
/** Clears all attachments, bones, and constraints. */
|
|
6444
7890
|
clear() {
|
|
6445
7891
|
this.attachments.length = 0;
|
|
6446
7892
|
this.bones.length = 0;
|
|
6447
7893
|
this.constraints.length = 0;
|
|
6448
7894
|
}
|
|
7895
|
+
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
|
|
6449
7896
|
attachAll(skeleton, oldSkin) {
|
|
6450
7897
|
let slotIndex = 0;
|
|
6451
7898
|
for (let i = 0; i < skeleton.slots.length; i++) {
|
|
@@ -6471,10 +7918,17 @@ var spine = (() => {
|
|
|
6471
7918
|
// spine-core/src/SlotData.ts
|
|
6472
7919
|
var SlotData = class {
|
|
6473
7920
|
constructor(index, name, boneData) {
|
|
7921
|
+
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
|
6474
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. */
|
|
6475
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. */
|
|
6476
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. */
|
|
6477
7930
|
this.attachmentName = null;
|
|
7931
|
+
/** The blend mode for drawing the slot's attachment. */
|
|
6478
7932
|
this.blendMode = BlendMode.Normal;
|
|
6479
7933
|
if (index < 0)
|
|
6480
7934
|
throw new Error("index must be >= 0.");
|
|
@@ -6487,19 +7941,21 @@ var spine = (() => {
|
|
|
6487
7941
|
this.boneData = boneData;
|
|
6488
7942
|
}
|
|
6489
7943
|
};
|
|
6490
|
-
var BlendMode
|
|
6491
|
-
(function(BlendMode2) {
|
|
7944
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode2) => {
|
|
6492
7945
|
BlendMode2[BlendMode2["Normal"] = 0] = "Normal";
|
|
6493
7946
|
BlendMode2[BlendMode2["Additive"] = 1] = "Additive";
|
|
6494
7947
|
BlendMode2[BlendMode2["Multiply"] = 2] = "Multiply";
|
|
6495
7948
|
BlendMode2[BlendMode2["Screen"] = 3] = "Screen";
|
|
6496
|
-
|
|
7949
|
+
return BlendMode2;
|
|
7950
|
+
})(BlendMode || {});
|
|
6497
7951
|
|
|
6498
7952
|
// spine-core/src/TransformConstraintData.ts
|
|
6499
7953
|
var TransformConstraintData = class extends ConstraintData {
|
|
6500
7954
|
constructor(name) {
|
|
6501
7955
|
super(name, 0, false);
|
|
7956
|
+
/** The bones that will be modified by this transform constraint. */
|
|
6502
7957
|
this.bones = new Array();
|
|
7958
|
+
/** The target bone whose world transform will be copied to the constrained bones. */
|
|
6503
7959
|
this._target = null;
|
|
6504
7960
|
this.mixRotate = 0;
|
|
6505
7961
|
this.mixX = 0;
|
|
@@ -6507,11 +7963,17 @@ var spine = (() => {
|
|
|
6507
7963
|
this.mixScaleX = 0;
|
|
6508
7964
|
this.mixScaleY = 0;
|
|
6509
7965
|
this.mixShearY = 0;
|
|
7966
|
+
/** An offset added to the constrained bone rotation. */
|
|
6510
7967
|
this.offsetRotation = 0;
|
|
7968
|
+
/** An offset added to the constrained bone X translation. */
|
|
6511
7969
|
this.offsetX = 0;
|
|
7970
|
+
/** An offset added to the constrained bone Y translation. */
|
|
6512
7971
|
this.offsetY = 0;
|
|
7972
|
+
/** An offset added to the constrained bone scaleX. */
|
|
6513
7973
|
this.offsetScaleX = 0;
|
|
7974
|
+
/** An offset added to the constrained bone scaleY. */
|
|
6514
7975
|
this.offsetScaleY = 0;
|
|
7976
|
+
/** An offset added to the constrained bone shearY. */
|
|
6515
7977
|
this.offsetShearY = 0;
|
|
6516
7978
|
this.relative = false;
|
|
6517
7979
|
this.local = false;
|
|
@@ -6530,6 +7992,10 @@ var spine = (() => {
|
|
|
6530
7992
|
// spine-core/src/SkeletonBinary.ts
|
|
6531
7993
|
var SkeletonBinary = class {
|
|
6532
7994
|
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. */
|
|
6533
7999
|
this.scale = 1;
|
|
6534
8000
|
this.linkedMeshes = new Array();
|
|
6535
8001
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -6662,10 +8128,10 @@ var spine = (() => {
|
|
|
6662
8128
|
data.rotateMode = input.readInt(true);
|
|
6663
8129
|
data.offsetRotation = input.readFloat();
|
|
6664
8130
|
data.position = input.readFloat();
|
|
6665
|
-
if (data.positionMode ==
|
|
8131
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
6666
8132
|
data.position *= scale;
|
|
6667
8133
|
data.spacing = input.readFloat();
|
|
6668
|
-
if (data.spacingMode ==
|
|
8134
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
6669
8135
|
data.spacing *= scale;
|
|
6670
8136
|
data.mixRotate = input.readFloat();
|
|
6671
8137
|
data.mixX = input.readFloat();
|
|
@@ -7290,10 +8756,18 @@ var spine = (() => {
|
|
|
7290
8756
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
7291
8757
|
switch (input.readByte()) {
|
|
7292
8758
|
case PATH_POSITION:
|
|
7293
|
-
timelines.push(readTimeline1(
|
|
8759
|
+
timelines.push(readTimeline1(
|
|
8760
|
+
input,
|
|
8761
|
+
new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
|
|
8762
|
+
data.positionMode == 0 /* Fixed */ ? scale : 1
|
|
8763
|
+
));
|
|
7294
8764
|
break;
|
|
7295
8765
|
case PATH_SPACING:
|
|
7296
|
-
timelines.push(readTimeline1(
|
|
8766
|
+
timelines.push(readTimeline1(
|
|
8767
|
+
input,
|
|
8768
|
+
new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
|
|
8769
|
+
data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
|
|
8770
|
+
));
|
|
7297
8771
|
break;
|
|
7298
8772
|
case PATH_MIX:
|
|
7299
8773
|
let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
|
|
@@ -7384,7 +8858,13 @@ var spine = (() => {
|
|
|
7384
8858
|
for (let frame = 0; frame < frameCount; frame++) {
|
|
7385
8859
|
let time = input.readFloat();
|
|
7386
8860
|
let modeAndIndex = input.readInt32();
|
|
7387
|
-
timeline.setFrame(
|
|
8861
|
+
timeline.setFrame(
|
|
8862
|
+
frame,
|
|
8863
|
+
time,
|
|
8864
|
+
SequenceModeValues[modeAndIndex & 15],
|
|
8865
|
+
modeAndIndex >> 4,
|
|
8866
|
+
input.readFloat()
|
|
8867
|
+
);
|
|
7388
8868
|
}
|
|
7389
8869
|
timelines.push(timeline);
|
|
7390
8870
|
break;
|
|
@@ -7545,8 +9025,7 @@ var spine = (() => {
|
|
|
7545
9025
|
this.vertices = vertices;
|
|
7546
9026
|
}
|
|
7547
9027
|
};
|
|
7548
|
-
var AttachmentType
|
|
7549
|
-
(function(AttachmentType2) {
|
|
9028
|
+
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
7550
9029
|
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
7551
9030
|
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
7552
9031
|
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
@@ -7554,7 +9033,8 @@ var spine = (() => {
|
|
|
7554
9033
|
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
7555
9034
|
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
7556
9035
|
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
7557
|
-
|
|
9036
|
+
return AttachmentType2;
|
|
9037
|
+
})(AttachmentType || {});
|
|
7558
9038
|
function readTimeline1(input, timeline, scale) {
|
|
7559
9039
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
7560
9040
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
@@ -7625,16 +9105,26 @@ var spine = (() => {
|
|
|
7625
9105
|
// spine-core/src/SkeletonBounds.ts
|
|
7626
9106
|
var SkeletonBounds = class {
|
|
7627
9107
|
constructor() {
|
|
9108
|
+
/** The left edge of the axis aligned bounding box. */
|
|
7628
9109
|
this.minX = 0;
|
|
9110
|
+
/** The bottom edge of the axis aligned bounding box. */
|
|
7629
9111
|
this.minY = 0;
|
|
9112
|
+
/** The right edge of the axis aligned bounding box. */
|
|
7630
9113
|
this.maxX = 0;
|
|
9114
|
+
/** The top edge of the axis aligned bounding box. */
|
|
7631
9115
|
this.maxY = 0;
|
|
9116
|
+
/** The visible bounding boxes. */
|
|
7632
9117
|
this.boundingBoxes = new Array();
|
|
9118
|
+
/** The world vertices for the bounding box polygons. */
|
|
7633
9119
|
this.polygons = new Array();
|
|
7634
9120
|
this.polygonPool = new Pool(() => {
|
|
7635
9121
|
return Utils.newFloatArray(16);
|
|
7636
9122
|
});
|
|
7637
9123
|
}
|
|
9124
|
+
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
|
|
9125
|
+
* box's polygon.
|
|
9126
|
+
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9127
|
+
* SkeletonBounds AABB methods will always return true. */
|
|
7638
9128
|
update(skeleton, updateAabb) {
|
|
7639
9129
|
if (!skeleton)
|
|
7640
9130
|
throw new Error("skeleton cannot be null.");
|
|
@@ -7691,9 +9181,11 @@ var spine = (() => {
|
|
|
7691
9181
|
this.maxX = maxX;
|
|
7692
9182
|
this.maxY = maxY;
|
|
7693
9183
|
}
|
|
9184
|
+
/** Returns true if the axis aligned bounding box contains the point. */
|
|
7694
9185
|
aabbContainsPoint(x, y) {
|
|
7695
9186
|
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
|
|
7696
9187
|
}
|
|
9188
|
+
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
|
7697
9189
|
aabbIntersectsSegment(x1, y1, x2, y2) {
|
|
7698
9190
|
let minX = this.minX;
|
|
7699
9191
|
let minY = this.minY;
|
|
@@ -7716,9 +9208,12 @@ var spine = (() => {
|
|
|
7716
9208
|
return true;
|
|
7717
9209
|
return false;
|
|
7718
9210
|
}
|
|
9211
|
+
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
7719
9212
|
aabbIntersectsSkeleton(bounds) {
|
|
7720
9213
|
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
|
|
7721
9214
|
}
|
|
9215
|
+
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
|
9216
|
+
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
|
|
7722
9217
|
containsPoint(x, y) {
|
|
7723
9218
|
let polygons = this.polygons;
|
|
7724
9219
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7726,6 +9221,7 @@ var spine = (() => {
|
|
|
7726
9221
|
return this.boundingBoxes[i];
|
|
7727
9222
|
return null;
|
|
7728
9223
|
}
|
|
9224
|
+
/** Returns true if the polygon contains the point. */
|
|
7729
9225
|
containsPointPolygon(polygon, x, y) {
|
|
7730
9226
|
let vertices = polygon;
|
|
7731
9227
|
let nn = polygon.length;
|
|
@@ -7743,6 +9239,9 @@ var spine = (() => {
|
|
|
7743
9239
|
}
|
|
7744
9240
|
return inside;
|
|
7745
9241
|
}
|
|
9242
|
+
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
|
|
9243
|
+
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
|
|
9244
|
+
* true. */
|
|
7746
9245
|
intersectsSegment(x1, y1, x2, y2) {
|
|
7747
9246
|
let polygons = this.polygons;
|
|
7748
9247
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7750,6 +9249,7 @@ var spine = (() => {
|
|
|
7750
9249
|
return this.boundingBoxes[i];
|
|
7751
9250
|
return null;
|
|
7752
9251
|
}
|
|
9252
|
+
/** Returns true if the polygon contains any part of the line segment. */
|
|
7753
9253
|
intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
|
|
7754
9254
|
let vertices = polygon;
|
|
7755
9255
|
let nn = polygon.length;
|
|
@@ -7772,15 +9272,18 @@ var spine = (() => {
|
|
|
7772
9272
|
}
|
|
7773
9273
|
return false;
|
|
7774
9274
|
}
|
|
9275
|
+
/** Returns the polygon for the specified bounding box, or null. */
|
|
7775
9276
|
getPolygon(boundingBox) {
|
|
7776
9277
|
if (!boundingBox)
|
|
7777
9278
|
throw new Error("boundingBox cannot be null.");
|
|
7778
9279
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
7779
9280
|
return index == -1 ? null : this.polygons[index];
|
|
7780
9281
|
}
|
|
9282
|
+
/** The width of the axis aligned bounding box. */
|
|
7781
9283
|
getWidth() {
|
|
7782
9284
|
return this.maxX - this.minX;
|
|
7783
9285
|
}
|
|
9286
|
+
/** The height of the axis aligned bounding box. */
|
|
7784
9287
|
getHeight() {
|
|
7785
9288
|
return this.maxY - this.minY;
|
|
7786
9289
|
}
|
|
@@ -7984,7 +9487,14 @@ var spine = (() => {
|
|
|
7984
9487
|
let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
|
|
7985
9488
|
let current = indices[index] << 1;
|
|
7986
9489
|
let next = indices[(index + 1) % vertexCount] << 1;
|
|
7987
|
-
return !this.positiveArea(
|
|
9490
|
+
return !this.positiveArea(
|
|
9491
|
+
vertices[previous],
|
|
9492
|
+
vertices[previous + 1],
|
|
9493
|
+
vertices[current],
|
|
9494
|
+
vertices[current + 1],
|
|
9495
|
+
vertices[next],
|
|
9496
|
+
vertices[next + 1]
|
|
9497
|
+
);
|
|
7988
9498
|
}
|
|
7989
9499
|
static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
|
|
7990
9500
|
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
|
|
@@ -8174,6 +9684,8 @@ var spine = (() => {
|
|
|
8174
9684
|
}
|
|
8175
9685
|
}
|
|
8176
9686
|
}
|
|
9687
|
+
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
|
9688
|
+
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
|
8177
9689
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8178
9690
|
let originalOutput = output;
|
|
8179
9691
|
let clipped = false;
|
|
@@ -8285,6 +9797,10 @@ var spine = (() => {
|
|
|
8285
9797
|
// spine-core/src/SkeletonJson.ts
|
|
8286
9798
|
var SkeletonJson = class {
|
|
8287
9799
|
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. */
|
|
8288
9804
|
this.scale = 1;
|
|
8289
9805
|
this.linkedMeshes = new Array();
|
|
8290
9806
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8430,10 +9946,10 @@ var spine = (() => {
|
|
|
8430
9946
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
8431
9947
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
8432
9948
|
data.position = getValue(constraintMap, "position", 0);
|
|
8433
|
-
if (data.positionMode ==
|
|
9949
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
8434
9950
|
data.position *= scale;
|
|
8435
9951
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
8436
|
-
if (data.spacingMode ==
|
|
9952
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8437
9953
|
data.spacing *= scale;
|
|
8438
9954
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
8439
9955
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
@@ -8974,10 +10490,10 @@ var spine = (() => {
|
|
|
8974
10490
|
let frames = timelineMap.length;
|
|
8975
10491
|
if (timelineName === "position") {
|
|
8976
10492
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
8977
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode ==
|
|
10493
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
|
|
8978
10494
|
} else if (timelineName === "spacing") {
|
|
8979
10495
|
let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
|
|
8980
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode ==
|
|
10496
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
|
|
8981
10497
|
} else if (timelineName === "mix") {
|
|
8982
10498
|
let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
|
|
8983
10499
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -9231,6 +10747,6 @@ var spine = (() => {
|
|
|
9231
10747
|
}(new Float32Array(1));
|
|
9232
10748
|
}
|
|
9233
10749
|
})();
|
|
9234
|
-
return src_exports;
|
|
10750
|
+
return __toCommonJS(src_exports);
|
|
9235
10751
|
})();
|
|
9236
10752
|
//# sourceMappingURL=spine-core.js.map
|