@esotericsoftware/spine-core 4.2.9 → 4.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimationState.js +4 -4
- package/dist/IkConstraintData.js +8 -8
- package/dist/PathConstraintData.js +8 -8
- package/dist/Skeleton.d.ts +4 -1
- package/dist/Skeleton.js +10 -2
- package/dist/TransformConstraint.js +1 -1
- package/dist/TransformConstraintData.js +8 -8
- package/dist/iife/spine-core.js +2007 -496
- 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,10 +4763,10 @@ 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;
|
|
@@ -3674,19 +4802,32 @@ var spine = (() => {
|
|
|
3674
4802
|
constructor(name, path) {
|
|
3675
4803
|
super(name);
|
|
3676
4804
|
this.region = null;
|
|
4805
|
+
/** The UV pair for each vertex, normalized within the texture region. */
|
|
3677
4806
|
this.regionUVs = [];
|
|
4807
|
+
/** The UV pair for each vertex, normalized within the entire texture.
|
|
4808
|
+
*
|
|
4809
|
+
* See {@link #updateUVs}. */
|
|
3678
4810
|
this.uvs = [];
|
|
4811
|
+
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
|
3679
4812
|
this.triangles = [];
|
|
4813
|
+
/** The color to tint the mesh. */
|
|
3680
4814
|
this.color = new Color(1, 1, 1, 1);
|
|
4815
|
+
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
|
3681
4816
|
this.width = 0;
|
|
4817
|
+
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
|
3682
4818
|
this.height = 0;
|
|
4819
|
+
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
|
3683
4820
|
this.hullLength = 0;
|
|
4821
|
+
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
|
|
4822
|
+
* nonessential data was exported. Triangulation is not performed at runtime. */
|
|
3684
4823
|
this.edges = [];
|
|
3685
4824
|
this.parentMesh = null;
|
|
3686
4825
|
this.sequence = null;
|
|
3687
4826
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3688
4827
|
this.path = path;
|
|
3689
4828
|
}
|
|
4829
|
+
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4830
|
+
* the {@link #regionUVs} are changed. */
|
|
3690
4831
|
updateRegion() {
|
|
3691
4832
|
if (!this.region)
|
|
3692
4833
|
throw new Error("Region not set.");
|
|
@@ -3747,9 +4888,13 @@ var spine = (() => {
|
|
|
3747
4888
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
|
3748
4889
|
}
|
|
3749
4890
|
}
|
|
4891
|
+
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
|
|
4892
|
+
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
|
|
4893
|
+
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
|
|
3750
4894
|
getParentMesh() {
|
|
3751
4895
|
return this.parentMesh;
|
|
3752
4896
|
}
|
|
4897
|
+
/** @param parentMesh May be null. */
|
|
3753
4898
|
setParentMesh(parentMesh) {
|
|
3754
4899
|
this.parentMesh = parentMesh;
|
|
3755
4900
|
if (parentMesh) {
|
|
@@ -3790,6 +4935,7 @@ var spine = (() => {
|
|
|
3790
4935
|
this.sequence.apply(slot, this);
|
|
3791
4936
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3792
4937
|
}
|
|
4938
|
+
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
3793
4939
|
newLinkedMesh() {
|
|
3794
4940
|
let copy = new MeshAttachment(this.name, this.path);
|
|
3795
4941
|
copy.region = this.region;
|
|
@@ -3806,9 +4952,15 @@ var spine = (() => {
|
|
|
3806
4952
|
var PathAttachment = class extends VertexAttachment {
|
|
3807
4953
|
constructor(name) {
|
|
3808
4954
|
super(name);
|
|
4955
|
+
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
3809
4956
|
this.lengths = [];
|
|
4957
|
+
/** If true, the start and end knots are connected. */
|
|
3810
4958
|
this.closed = false;
|
|
4959
|
+
/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
|
|
4960
|
+
* calculations are performed but calculating positions along the path is less accurate. */
|
|
3811
4961
|
this.constantSpeed = false;
|
|
4962
|
+
/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
|
|
4963
|
+
* rendered at runtime. */
|
|
3812
4964
|
this.color = new Color(1, 1, 1, 1);
|
|
3813
4965
|
}
|
|
3814
4966
|
copy() {
|
|
@@ -3830,6 +4982,8 @@ var spine = (() => {
|
|
|
3830
4982
|
this.x = 0;
|
|
3831
4983
|
this.y = 0;
|
|
3832
4984
|
this.rotation = 0;
|
|
4985
|
+
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
|
|
4986
|
+
* are not usually rendered at runtime. */
|
|
3833
4987
|
this.color = new Color(0.38, 0.94, 0, 1);
|
|
3834
4988
|
}
|
|
3835
4989
|
computeWorldPosition(bone, point) {
|
|
@@ -3857,22 +5011,34 @@ var spine = (() => {
|
|
|
3857
5011
|
var _RegionAttachment = class extends Attachment {
|
|
3858
5012
|
constructor(name, path) {
|
|
3859
5013
|
super(name);
|
|
5014
|
+
/** The local x translation. */
|
|
3860
5015
|
this.x = 0;
|
|
5016
|
+
/** The local y translation. */
|
|
3861
5017
|
this.y = 0;
|
|
5018
|
+
/** The local scaleX. */
|
|
3862
5019
|
this.scaleX = 1;
|
|
5020
|
+
/** The local scaleY. */
|
|
3863
5021
|
this.scaleY = 1;
|
|
5022
|
+
/** The local rotation. */
|
|
3864
5023
|
this.rotation = 0;
|
|
5024
|
+
/** The width of the region attachment in Spine. */
|
|
3865
5025
|
this.width = 0;
|
|
5026
|
+
/** The height of the region attachment in Spine. */
|
|
3866
5027
|
this.height = 0;
|
|
5028
|
+
/** The color to tint the region attachment. */
|
|
3867
5029
|
this.color = new Color(1, 1, 1, 1);
|
|
3868
5030
|
this.rendererObject = null;
|
|
3869
5031
|
this.region = null;
|
|
3870
5032
|
this.sequence = null;
|
|
5033
|
+
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
|
|
5034
|
+
*
|
|
5035
|
+
* See {@link #updateOffset()}. */
|
|
3871
5036
|
this.offset = Utils.newFloatArray(8);
|
|
3872
5037
|
this.uvs = Utils.newFloatArray(8);
|
|
3873
5038
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3874
5039
|
this.path = path;
|
|
3875
5040
|
}
|
|
5041
|
+
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
3876
5042
|
updateRegion() {
|
|
3877
5043
|
if (!this.region)
|
|
3878
5044
|
throw new Error("Region not set.");
|
|
@@ -3936,6 +5102,14 @@ var spine = (() => {
|
|
|
3936
5102
|
uvs[7] = region.v2;
|
|
3937
5103
|
}
|
|
3938
5104
|
}
|
|
5105
|
+
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
|
|
5106
|
+
* be changed.
|
|
5107
|
+
* <p>
|
|
5108
|
+
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
|
5109
|
+
* Runtimes Guide.
|
|
5110
|
+
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
|
|
5111
|
+
* @param offset The <code>worldVertices</code> index to begin writing values.
|
|
5112
|
+
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
|
|
3939
5113
|
computeWorldVertices(slot, worldVertices, offset, stride) {
|
|
3940
5114
|
if (this.sequence != null)
|
|
3941
5115
|
this.sequence.apply(slot, this);
|
|
@@ -4075,18 +5249,34 @@ var spine = (() => {
|
|
|
4075
5249
|
// spine-core/src/BoneData.ts
|
|
4076
5250
|
var BoneData = class {
|
|
4077
5251
|
constructor(index, name, parent) {
|
|
5252
|
+
/** The index of the bone in {@link Skeleton#getBones()}. */
|
|
4078
5253
|
this.index = 0;
|
|
5254
|
+
/** @returns May be null. */
|
|
4079
5255
|
this.parent = null;
|
|
5256
|
+
/** The bone's length. */
|
|
4080
5257
|
this.length = 0;
|
|
5258
|
+
/** The local x translation. */
|
|
4081
5259
|
this.x = 0;
|
|
5260
|
+
/** The local y translation. */
|
|
4082
5261
|
this.y = 0;
|
|
5262
|
+
/** The local rotation. */
|
|
4083
5263
|
this.rotation = 0;
|
|
5264
|
+
/** The local scaleX. */
|
|
4084
5265
|
this.scaleX = 1;
|
|
5266
|
+
/** The local scaleY. */
|
|
4085
5267
|
this.scaleY = 1;
|
|
5268
|
+
/** The local shearX. */
|
|
4086
5269
|
this.shearX = 0;
|
|
5270
|
+
/** The local shearX. */
|
|
4087
5271
|
this.shearY = 0;
|
|
5272
|
+
/** The transform mode for how parent world transforms affect this bone. */
|
|
4088
5273
|
this.transformMode = TransformMode.Normal;
|
|
5274
|
+
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5275
|
+
* bone.
|
|
5276
|
+
* @see Skin#bones */
|
|
4089
5277
|
this.skinRequired = false;
|
|
5278
|
+
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
|
|
5279
|
+
* rendered at runtime. */
|
|
4090
5280
|
this.color = new Color();
|
|
4091
5281
|
if (index < 0)
|
|
4092
5282
|
throw new Error("index must be >= 0.");
|
|
@@ -4097,39 +5287,62 @@ var spine = (() => {
|
|
|
4097
5287
|
this.parent = parent;
|
|
4098
5288
|
}
|
|
4099
5289
|
};
|
|
4100
|
-
var TransformMode
|
|
4101
|
-
(function(TransformMode2) {
|
|
5290
|
+
var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
|
|
4102
5291
|
TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
|
|
4103
5292
|
TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
|
|
4104
5293
|
TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
|
|
4105
5294
|
TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
|
|
4106
5295
|
TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
|
|
4107
|
-
|
|
5296
|
+
return TransformMode2;
|
|
5297
|
+
})(TransformMode || {});
|
|
4108
5298
|
|
|
4109
5299
|
// spine-core/src/Bone.ts
|
|
4110
5300
|
var Bone = class {
|
|
5301
|
+
/** @param parent May be null. */
|
|
4111
5302
|
constructor(data, skeleton, parent) {
|
|
5303
|
+
/** The parent bone, or null if this is the root bone. */
|
|
4112
5304
|
this.parent = null;
|
|
5305
|
+
/** The immediate children of this bone. */
|
|
4113
5306
|
this.children = new Array();
|
|
5307
|
+
/** The local x translation. */
|
|
4114
5308
|
this.x = 0;
|
|
5309
|
+
/** The local y translation. */
|
|
4115
5310
|
this.y = 0;
|
|
5311
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
4116
5312
|
this.rotation = 0;
|
|
5313
|
+
/** The local scaleX. */
|
|
4117
5314
|
this.scaleX = 0;
|
|
5315
|
+
/** The local scaleY. */
|
|
4118
5316
|
this.scaleY = 0;
|
|
5317
|
+
/** The local shearX. */
|
|
4119
5318
|
this.shearX = 0;
|
|
5319
|
+
/** The local shearY. */
|
|
4120
5320
|
this.shearY = 0;
|
|
5321
|
+
/** The applied local x translation. */
|
|
4121
5322
|
this.ax = 0;
|
|
5323
|
+
/** The applied local y translation. */
|
|
4122
5324
|
this.ay = 0;
|
|
5325
|
+
/** The applied local rotation in degrees, counter clockwise. */
|
|
4123
5326
|
this.arotation = 0;
|
|
5327
|
+
/** The applied local scaleX. */
|
|
4124
5328
|
this.ascaleX = 0;
|
|
5329
|
+
/** The applied local scaleY. */
|
|
4125
5330
|
this.ascaleY = 0;
|
|
5331
|
+
/** The applied local shearX. */
|
|
4126
5332
|
this.ashearX = 0;
|
|
5333
|
+
/** The applied local shearY. */
|
|
4127
5334
|
this.ashearY = 0;
|
|
5335
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4128
5336
|
this.a = 0;
|
|
5337
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4129
5338
|
this.b = 0;
|
|
5339
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4130
5340
|
this.c = 0;
|
|
5341
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4131
5342
|
this.d = 0;
|
|
5343
|
+
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4132
5344
|
this.worldY = 0;
|
|
5345
|
+
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4133
5346
|
this.worldX = 0;
|
|
4134
5347
|
this.sorted = false;
|
|
4135
5348
|
this.active = false;
|
|
@@ -4142,15 +5355,26 @@ var spine = (() => {
|
|
|
4142
5355
|
this.parent = parent;
|
|
4143
5356
|
this.setToSetupPose();
|
|
4144
5357
|
}
|
|
5358
|
+
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
|
|
5359
|
+
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
|
|
4145
5360
|
isActive() {
|
|
4146
5361
|
return this.active;
|
|
4147
5362
|
}
|
|
5363
|
+
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
4148
5364
|
update() {
|
|
4149
5365
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
4150
5366
|
}
|
|
5367
|
+
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
5368
|
+
*
|
|
5369
|
+
* See {@link #updateWorldTransformWith()}. */
|
|
4151
5370
|
updateWorldTransform() {
|
|
4152
5371
|
this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
|
|
4153
5372
|
}
|
|
5373
|
+
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
|
|
5374
|
+
* specified local transform. Child bones are not updated.
|
|
5375
|
+
*
|
|
5376
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
5377
|
+
* Runtimes Guide. */
|
|
4154
5378
|
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
|
|
4155
5379
|
this.ax = x;
|
|
4156
5380
|
this.ay = y;
|
|
@@ -4177,7 +5401,7 @@ var spine = (() => {
|
|
|
4177
5401
|
this.worldX = pa * x + pb * y + parent.worldX;
|
|
4178
5402
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
4179
5403
|
switch (this.data.transformMode) {
|
|
4180
|
-
case
|
|
5404
|
+
case 0 /* Normal */: {
|
|
4181
5405
|
let rotationY = rotation + 90 + shearY;
|
|
4182
5406
|
let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4183
5407
|
let lb = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4189,7 +5413,7 @@ var spine = (() => {
|
|
|
4189
5413
|
this.d = pc * lb + pd * ld;
|
|
4190
5414
|
return;
|
|
4191
5415
|
}
|
|
4192
|
-
case
|
|
5416
|
+
case 1 /* OnlyTranslation */: {
|
|
4193
5417
|
let rotationY = rotation + 90 + shearY;
|
|
4194
5418
|
this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4195
5419
|
this.b = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4197,7 +5421,7 @@ var spine = (() => {
|
|
|
4197
5421
|
this.d = MathUtils.sinDeg(rotationY) * scaleY;
|
|
4198
5422
|
break;
|
|
4199
5423
|
}
|
|
4200
|
-
case
|
|
5424
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4201
5425
|
let s = pa * pa + pc * pc;
|
|
4202
5426
|
let prx = 0;
|
|
4203
5427
|
if (s > 1e-4) {
|
|
@@ -4224,8 +5448,8 @@ var spine = (() => {
|
|
|
4224
5448
|
this.d = pc * lb + pd * ld;
|
|
4225
5449
|
break;
|
|
4226
5450
|
}
|
|
4227
|
-
case
|
|
4228
|
-
case
|
|
5451
|
+
case 3 /* NoScale */:
|
|
5452
|
+
case 4 /* NoScaleOrReflection */: {
|
|
4229
5453
|
let cos = MathUtils.cosDeg(rotation);
|
|
4230
5454
|
let sin = MathUtils.sinDeg(rotation);
|
|
4231
5455
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
@@ -4236,7 +5460,7 @@ var spine = (() => {
|
|
|
4236
5460
|
za *= s;
|
|
4237
5461
|
zc *= s;
|
|
4238
5462
|
s = Math.sqrt(za * za + zc * zc);
|
|
4239
|
-
if (this.data.transformMode ==
|
|
5463
|
+
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4240
5464
|
s = -s;
|
|
4241
5465
|
let r = Math.PI / 2 + Math.atan2(zc, za);
|
|
4242
5466
|
let zb = Math.cos(r) * s;
|
|
@@ -4257,6 +5481,7 @@ var spine = (() => {
|
|
|
4257
5481
|
this.c *= this.skeleton.scaleY;
|
|
4258
5482
|
this.d *= this.skeleton.scaleY;
|
|
4259
5483
|
}
|
|
5484
|
+
/** Sets this bone's local transform to the setup pose. */
|
|
4260
5485
|
setToSetupPose() {
|
|
4261
5486
|
let data = this.data;
|
|
4262
5487
|
this.x = data.x;
|
|
@@ -4267,18 +5492,30 @@ var spine = (() => {
|
|
|
4267
5492
|
this.shearX = data.shearX;
|
|
4268
5493
|
this.shearY = data.shearY;
|
|
4269
5494
|
}
|
|
5495
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
4270
5496
|
getWorldRotationX() {
|
|
4271
5497
|
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
4272
5498
|
}
|
|
5499
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
4273
5500
|
getWorldRotationY() {
|
|
4274
5501
|
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
4275
5502
|
}
|
|
5503
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
4276
5504
|
getWorldScaleX() {
|
|
4277
5505
|
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
4278
5506
|
}
|
|
5507
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
4279
5508
|
getWorldScaleY() {
|
|
4280
5509
|
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
4281
5510
|
}
|
|
5511
|
+
/** Computes the applied transform values from the world transform.
|
|
5512
|
+
*
|
|
5513
|
+
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
5514
|
+
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
|
|
5515
|
+
* constraints).
|
|
5516
|
+
*
|
|
5517
|
+
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
|
|
5518
|
+
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
|
|
4282
5519
|
updateAppliedTransform() {
|
|
4283
5520
|
let parent = this.parent;
|
|
4284
5521
|
if (!parent) {
|
|
@@ -4298,14 +5535,14 @@ var spine = (() => {
|
|
|
4298
5535
|
this.ax = dx * ia - dy * ib;
|
|
4299
5536
|
this.ay = dy * id - dx * ic;
|
|
4300
5537
|
let ra, rb, rc, rd;
|
|
4301
|
-
if (this.data.transformMode ==
|
|
5538
|
+
if (this.data.transformMode == 1 /* OnlyTranslation */) {
|
|
4302
5539
|
ra = this.a;
|
|
4303
5540
|
rb = this.b;
|
|
4304
5541
|
rc = this.c;
|
|
4305
5542
|
rd = this.d;
|
|
4306
5543
|
} else {
|
|
4307
5544
|
switch (this.data.transformMode) {
|
|
4308
|
-
case
|
|
5545
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4309
5546
|
let s2 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4310
5547
|
let sa = pa / this.skeleton.scaleX;
|
|
4311
5548
|
let sc = pc / this.skeleton.scaleY;
|
|
@@ -4316,8 +5553,8 @@ var spine = (() => {
|
|
|
4316
5553
|
ib = pb * pid;
|
|
4317
5554
|
break;
|
|
4318
5555
|
}
|
|
4319
|
-
case
|
|
4320
|
-
case
|
|
5556
|
+
case 3 /* NoScale */:
|
|
5557
|
+
case 4 /* NoScaleOrReflection */:
|
|
4321
5558
|
let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
|
|
4322
5559
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
4323
5560
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
@@ -4327,7 +5564,7 @@ var spine = (() => {
|
|
|
4327
5564
|
pa *= s;
|
|
4328
5565
|
pc *= s;
|
|
4329
5566
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
4330
|
-
if (this.data.transformMode ==
|
|
5567
|
+
if (this.data.transformMode == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4331
5568
|
s = -s;
|
|
4332
5569
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
4333
5570
|
pb = Math.cos(r) * s;
|
|
@@ -4357,6 +5594,7 @@ var spine = (() => {
|
|
|
4357
5594
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
4358
5595
|
}
|
|
4359
5596
|
}
|
|
5597
|
+
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
4360
5598
|
worldToLocal(world) {
|
|
4361
5599
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
4362
5600
|
let x = world.x - this.worldX, y = world.y - this.worldY;
|
|
@@ -4364,21 +5602,28 @@ var spine = (() => {
|
|
|
4364
5602
|
world.y = y * this.a * invDet - x * this.c * invDet;
|
|
4365
5603
|
return world;
|
|
4366
5604
|
}
|
|
5605
|
+
/** Transforms a point from the bone's local coordinates to world coordinates. */
|
|
4367
5606
|
localToWorld(local) {
|
|
4368
5607
|
let x = local.x, y = local.y;
|
|
4369
5608
|
local.x = x * this.a + y * this.b + this.worldX;
|
|
4370
5609
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
4371
5610
|
return local;
|
|
4372
5611
|
}
|
|
5612
|
+
/** Transforms a world rotation to a local rotation. */
|
|
4373
5613
|
worldToLocalRotation(worldRotation) {
|
|
4374
5614
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
4375
5615
|
return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
|
|
4376
5616
|
}
|
|
5617
|
+
/** Transforms a local rotation to a world rotation. */
|
|
4377
5618
|
localToWorldRotation(localRotation) {
|
|
4378
5619
|
localRotation -= this.rotation - this.shearX;
|
|
4379
5620
|
let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
|
|
4380
5621
|
return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
|
|
4381
5622
|
}
|
|
5623
|
+
/** Rotates the world transform the specified amount.
|
|
5624
|
+
* <p>
|
|
5625
|
+
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
|
|
5626
|
+
* need to be called on any child bones, recursively. */
|
|
4382
5627
|
rotateWorld(degrees) {
|
|
4383
5628
|
let a = this.a, b = this.b, c = this.c, d = this.d;
|
|
4384
5629
|
let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
|
|
@@ -4520,17 +5765,21 @@ var spine = (() => {
|
|
|
4520
5765
|
let atlas = new TextureAtlas(atlasText);
|
|
4521
5766
|
let toLoad = atlas.pages.length, abort = false;
|
|
4522
5767
|
for (let page of atlas.pages) {
|
|
4523
|
-
this.loadTexture(
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
if (
|
|
4527
|
-
|
|
5768
|
+
this.loadTexture(
|
|
5769
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5770
|
+
(imagePath, texture) => {
|
|
5771
|
+
if (!abort) {
|
|
5772
|
+
page.setTexture(texture);
|
|
5773
|
+
if (--toLoad == 0)
|
|
5774
|
+
this.success(success, path, atlas);
|
|
5775
|
+
}
|
|
5776
|
+
},
|
|
5777
|
+
(imagePath, message) => {
|
|
5778
|
+
if (!abort)
|
|
5779
|
+
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
5780
|
+
abort = true;
|
|
4528
5781
|
}
|
|
4529
|
-
|
|
4530
|
-
if (!abort)
|
|
4531
|
-
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
4532
|
-
abort = true;
|
|
4533
|
-
});
|
|
5782
|
+
);
|
|
4534
5783
|
}
|
|
4535
5784
|
} catch (e) {
|
|
4536
5785
|
this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
|
|
@@ -4726,10 +5975,16 @@ var spine = (() => {
|
|
|
4726
5975
|
// spine-core/src/IkConstraint.ts
|
|
4727
5976
|
var IkConstraint = class {
|
|
4728
5977
|
constructor(data, skeleton) {
|
|
5978
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4729
5979
|
this.bendDirection = 0;
|
|
5980
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4730
5981
|
this.compress = false;
|
|
5982
|
+
/** 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
|
|
5983
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4731
5984
|
this.stretch = false;
|
|
5985
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4732
5986
|
this.mix = 1;
|
|
5987
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4733
5988
|
this.softness = 0;
|
|
4734
5989
|
this.active = false;
|
|
4735
5990
|
if (!data)
|
|
@@ -4771,6 +6026,7 @@ var spine = (() => {
|
|
|
4771
6026
|
break;
|
|
4772
6027
|
}
|
|
4773
6028
|
}
|
|
6029
|
+
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
4774
6030
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4775
6031
|
let p = bone.parent;
|
|
4776
6032
|
if (!p)
|
|
@@ -4778,11 +6034,11 @@ var spine = (() => {
|
|
|
4778
6034
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4779
6035
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4780
6036
|
switch (bone.data.transformMode) {
|
|
4781
|
-
case
|
|
6037
|
+
case 1 /* OnlyTranslation */:
|
|
4782
6038
|
tx = targetX - bone.worldX;
|
|
4783
6039
|
ty = targetY - bone.worldY;
|
|
4784
6040
|
break;
|
|
4785
|
-
case
|
|
6041
|
+
case 2 /* NoRotationOrReflection */:
|
|
4786
6042
|
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4787
6043
|
let sa = pa / bone.skeleton.scaleX;
|
|
4788
6044
|
let sc = pc / bone.skeleton.scaleY;
|
|
@@ -4805,8 +6061,8 @@ var spine = (() => {
|
|
|
4805
6061
|
let sx = bone.ascaleX, sy = bone.ascaleY;
|
|
4806
6062
|
if (compress || stretch) {
|
|
4807
6063
|
switch (bone.data.transformMode) {
|
|
4808
|
-
case
|
|
4809
|
-
case
|
|
6064
|
+
case 3 /* NoScale */:
|
|
6065
|
+
case 4 /* NoScaleOrReflection */:
|
|
4810
6066
|
tx = targetX - bone.worldX;
|
|
4811
6067
|
ty = targetY - bone.worldY;
|
|
4812
6068
|
}
|
|
@@ -4818,8 +6074,18 @@ var spine = (() => {
|
|
|
4818
6074
|
sy *= s;
|
|
4819
6075
|
}
|
|
4820
6076
|
}
|
|
4821
|
-
bone.updateWorldTransformWith(
|
|
6077
|
+
bone.updateWorldTransformWith(
|
|
6078
|
+
bone.ax,
|
|
6079
|
+
bone.ay,
|
|
6080
|
+
bone.arotation + rotationIK * alpha,
|
|
6081
|
+
sx,
|
|
6082
|
+
sy,
|
|
6083
|
+
bone.ashearX,
|
|
6084
|
+
bone.ashearY
|
|
6085
|
+
);
|
|
4822
6086
|
}
|
|
6087
|
+
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6088
|
+
* @param child A direct descendant of the parent bone. */
|
|
4823
6089
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
4824
6090
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
4825
6091
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
@@ -4974,13 +6240,23 @@ var spine = (() => {
|
|
|
4974
6240
|
var IkConstraintData = class extends ConstraintData {
|
|
4975
6241
|
constructor(name) {
|
|
4976
6242
|
super(name, 0, false);
|
|
6243
|
+
/** The bones that are constrained by this IK constraint. */
|
|
4977
6244
|
this.bones = new Array();
|
|
6245
|
+
/** The bone that is the IK target. */
|
|
4978
6246
|
this._target = null;
|
|
6247
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4979
6248
|
this.bendDirection = 1;
|
|
6249
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4980
6250
|
this.compress = false;
|
|
6251
|
+
/** 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
|
|
6252
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4981
6253
|
this.stretch = false;
|
|
6254
|
+
/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
|
|
6255
|
+
* is scaled on both the X and Y axes. */
|
|
4982
6256
|
this.uniform = false;
|
|
6257
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4983
6258
|
this.mix = 1;
|
|
6259
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4984
6260
|
this.softness = 0;
|
|
4985
6261
|
}
|
|
4986
6262
|
set target(boneData) {
|
|
@@ -4998,13 +6274,21 @@ var spine = (() => {
|
|
|
4998
6274
|
var PathConstraintData = class extends ConstraintData {
|
|
4999
6275
|
constructor(name) {
|
|
5000
6276
|
super(name, 0, false);
|
|
6277
|
+
/** The bones that will be modified by this path constraint. */
|
|
5001
6278
|
this.bones = new Array();
|
|
6279
|
+
/** The slot whose path attachment will be used to constrained the bones. */
|
|
5002
6280
|
this._target = null;
|
|
6281
|
+
/** The mode for positioning the first bone on the path. */
|
|
5003
6282
|
this.positionMode = PositionMode.Fixed;
|
|
6283
|
+
/** The mode for positioning the bones after the first bone on the path. */
|
|
5004
6284
|
this.spacingMode = SpacingMode.Fixed;
|
|
6285
|
+
/** The mode for adjusting the rotation of the bones. */
|
|
5005
6286
|
this.rotateMode = RotateMode.Chain;
|
|
6287
|
+
/** An offset added to the constrained bone rotation. */
|
|
5006
6288
|
this.offsetRotation = 0;
|
|
6289
|
+
/** The position along the path. */
|
|
5007
6290
|
this.position = 0;
|
|
6291
|
+
/** The spacing between bones. */
|
|
5008
6292
|
this.spacing = 0;
|
|
5009
6293
|
this.mixRotate = 0;
|
|
5010
6294
|
this.mixX = 0;
|
|
@@ -5020,29 +6304,31 @@ var spine = (() => {
|
|
|
5020
6304
|
return this._target;
|
|
5021
6305
|
}
|
|
5022
6306
|
};
|
|
5023
|
-
var PositionMode
|
|
5024
|
-
(function(PositionMode2) {
|
|
6307
|
+
var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
|
|
5025
6308
|
PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
|
|
5026
6309
|
PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
(
|
|
6310
|
+
return PositionMode2;
|
|
6311
|
+
})(PositionMode || {});
|
|
6312
|
+
var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
|
|
5030
6313
|
SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
|
|
5031
6314
|
SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
|
|
5032
6315
|
SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
|
|
5033
6316
|
SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
(
|
|
6317
|
+
return SpacingMode2;
|
|
6318
|
+
})(SpacingMode || {});
|
|
6319
|
+
var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
5037
6320
|
RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
|
|
5038
6321
|
RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
|
|
5039
6322
|
RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
|
|
5040
|
-
|
|
6323
|
+
return RotateMode2;
|
|
6324
|
+
})(RotateMode || {});
|
|
5041
6325
|
|
|
5042
6326
|
// spine-core/src/PathConstraint.ts
|
|
5043
6327
|
var _PathConstraint = class {
|
|
5044
6328
|
constructor(data, skeleton) {
|
|
6329
|
+
/** The position along the path. */
|
|
5045
6330
|
this.position = 0;
|
|
6331
|
+
/** The spacing between bones. */
|
|
5046
6332
|
this.spacing = 0;
|
|
5047
6333
|
this.mixRotate = 0;
|
|
5048
6334
|
this.mixX = 0;
|
|
@@ -5087,13 +6373,13 @@ var spine = (() => {
|
|
|
5087
6373
|
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
5088
6374
|
return;
|
|
5089
6375
|
let data = this.data;
|
|
5090
|
-
let tangents = data.rotateMode ==
|
|
6376
|
+
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
5091
6377
|
let bones = this.bones;
|
|
5092
6378
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5093
6379
|
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5094
6380
|
let spacing = this.spacing;
|
|
5095
6381
|
switch (data.spacingMode) {
|
|
5096
|
-
case
|
|
6382
|
+
case 2 /* Percent */:
|
|
5097
6383
|
if (scale) {
|
|
5098
6384
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
5099
6385
|
let bone = bones[i];
|
|
@@ -5108,7 +6394,7 @@ var spine = (() => {
|
|
|
5108
6394
|
}
|
|
5109
6395
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
5110
6396
|
break;
|
|
5111
|
-
case
|
|
6397
|
+
case 3 /* Proportional */:
|
|
5112
6398
|
let sum = 0;
|
|
5113
6399
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5114
6400
|
let bone = bones[i];
|
|
@@ -5133,7 +6419,7 @@ var spine = (() => {
|
|
|
5133
6419
|
}
|
|
5134
6420
|
break;
|
|
5135
6421
|
default:
|
|
5136
|
-
let lengthSpacing = data.spacingMode ==
|
|
6422
|
+
let lengthSpacing = data.spacingMode == 0 /* Length */;
|
|
5137
6423
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5138
6424
|
let bone = bones[i];
|
|
5139
6425
|
let setupLength = bone.data.length;
|
|
@@ -5154,7 +6440,7 @@ var spine = (() => {
|
|
|
5154
6440
|
let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
|
|
5155
6441
|
let tip = false;
|
|
5156
6442
|
if (offsetRotation == 0)
|
|
5157
|
-
tip = data.rotateMode ==
|
|
6443
|
+
tip = data.rotateMode == 1 /* Chain */;
|
|
5158
6444
|
else {
|
|
5159
6445
|
tip = false;
|
|
5160
6446
|
let p = this.target.bone;
|
|
@@ -5218,14 +6504,14 @@ var spine = (() => {
|
|
|
5218
6504
|
let lengths = path.lengths;
|
|
5219
6505
|
curveCount -= closed2 ? 1 : 2;
|
|
5220
6506
|
let pathLength2 = lengths[curveCount];
|
|
5221
|
-
if (this.data.positionMode ==
|
|
6507
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5222
6508
|
position *= pathLength2;
|
|
5223
6509
|
let multiplier2;
|
|
5224
6510
|
switch (this.data.spacingMode) {
|
|
5225
|
-
case
|
|
6511
|
+
case 2 /* Percent */:
|
|
5226
6512
|
multiplier2 = pathLength2;
|
|
5227
6513
|
break;
|
|
5228
|
-
case
|
|
6514
|
+
case 3 /* Proportional */:
|
|
5229
6515
|
multiplier2 = pathLength2 / spacesCount;
|
|
5230
6516
|
break;
|
|
5231
6517
|
default:
|
|
@@ -5276,7 +6562,20 @@ var spine = (() => {
|
|
|
5276
6562
|
} else
|
|
5277
6563
|
path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
|
|
5278
6564
|
}
|
|
5279
|
-
this.addCurvePosition(
|
|
6565
|
+
this.addCurvePosition(
|
|
6566
|
+
p,
|
|
6567
|
+
world[0],
|
|
6568
|
+
world[1],
|
|
6569
|
+
world[2],
|
|
6570
|
+
world[3],
|
|
6571
|
+
world[4],
|
|
6572
|
+
world[5],
|
|
6573
|
+
world[6],
|
|
6574
|
+
world[7],
|
|
6575
|
+
out,
|
|
6576
|
+
o,
|
|
6577
|
+
tangents || i > 0 && space == 0
|
|
6578
|
+
);
|
|
5280
6579
|
}
|
|
5281
6580
|
return out;
|
|
5282
6581
|
}
|
|
@@ -5328,14 +6627,14 @@ var spine = (() => {
|
|
|
5328
6627
|
x1 = x2;
|
|
5329
6628
|
y1 = y2;
|
|
5330
6629
|
}
|
|
5331
|
-
if (this.data.positionMode ==
|
|
6630
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5332
6631
|
position *= pathLength;
|
|
5333
6632
|
let multiplier;
|
|
5334
6633
|
switch (this.data.spacingMode) {
|
|
5335
|
-
case
|
|
6634
|
+
case 2 /* Percent */:
|
|
5336
6635
|
multiplier = pathLength;
|
|
5337
6636
|
break;
|
|
5338
|
-
case
|
|
6637
|
+
case 3 /* Proportional */:
|
|
5339
6638
|
multiplier = pathLength / spacesCount;
|
|
5340
6639
|
break;
|
|
5341
6640
|
default:
|
|
@@ -5468,10 +6767,18 @@ var spine = (() => {
|
|
|
5468
6767
|
// spine-core/src/Slot.ts
|
|
5469
6768
|
var Slot = class {
|
|
5470
6769
|
constructor(data, bone) {
|
|
6770
|
+
/** 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
|
|
6771
|
+
* color's alpha is not used. */
|
|
5471
6772
|
this.darkColor = null;
|
|
5472
6773
|
this.attachment = null;
|
|
5473
6774
|
this.attachmentState = 0;
|
|
6775
|
+
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
|
|
6776
|
+
* {@link Sequence#getSetupIndex()}. */
|
|
5474
6777
|
this.sequenceIndex = -1;
|
|
6778
|
+
/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
|
|
6779
|
+
* weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
|
|
6780
|
+
*
|
|
6781
|
+
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
5475
6782
|
this.deform = new Array();
|
|
5476
6783
|
if (!data)
|
|
5477
6784
|
throw new Error("data cannot be null.");
|
|
@@ -5483,12 +6790,17 @@ var spine = (() => {
|
|
|
5483
6790
|
this.darkColor = !data.darkColor ? null : new Color();
|
|
5484
6791
|
this.setToSetupPose();
|
|
5485
6792
|
}
|
|
6793
|
+
/** The skeleton this slot belongs to. */
|
|
5486
6794
|
getSkeleton() {
|
|
5487
6795
|
return this.bone.skeleton;
|
|
5488
6796
|
}
|
|
6797
|
+
/** The current attachment for the slot, or null if the slot has no attachment. */
|
|
5489
6798
|
getAttachment() {
|
|
5490
6799
|
return this.attachment;
|
|
5491
6800
|
}
|
|
6801
|
+
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
|
|
6802
|
+
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
6803
|
+
* specified attachment. */
|
|
5492
6804
|
setAttachment(attachment) {
|
|
5493
6805
|
if (this.attachment == attachment)
|
|
5494
6806
|
return;
|
|
@@ -5498,6 +6810,7 @@ var spine = (() => {
|
|
|
5498
6810
|
this.attachment = attachment;
|
|
5499
6811
|
this.sequenceIndex = -1;
|
|
5500
6812
|
}
|
|
6813
|
+
/** Sets this slot to the setup pose. */
|
|
5501
6814
|
setToSetupPose() {
|
|
5502
6815
|
this.color.setFromColor(this.data.color);
|
|
5503
6816
|
if (this.darkColor)
|
|
@@ -5549,7 +6862,7 @@ var spine = (() => {
|
|
|
5549
6862
|
return this.active;
|
|
5550
6863
|
}
|
|
5551
6864
|
update() {
|
|
5552
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.
|
|
6865
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
5553
6866
|
return;
|
|
5554
6867
|
if (this.data.local) {
|
|
5555
6868
|
if (this.data.relative)
|
|
@@ -5726,13 +7039,21 @@ var spine = (() => {
|
|
|
5726
7039
|
};
|
|
5727
7040
|
|
|
5728
7041
|
// spine-core/src/Skeleton.ts
|
|
5729
|
-
var
|
|
7042
|
+
var _Skeleton = class {
|
|
5730
7043
|
constructor(data) {
|
|
7044
|
+
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
5731
7045
|
this._updateCache = new Array();
|
|
7046
|
+
/** The skeleton's current skin. May be null. */
|
|
5732
7047
|
this.skin = null;
|
|
7048
|
+
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7049
|
+
* inheritance. */
|
|
5733
7050
|
this.scaleX = 1;
|
|
5734
|
-
|
|
7051
|
+
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7052
|
+
* inheritance. */
|
|
7053
|
+
this._scaleY = 1;
|
|
7054
|
+
/** Sets the skeleton X position, which is added to the root bone worldX position. */
|
|
5735
7055
|
this.x = 0;
|
|
7056
|
+
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
5736
7057
|
this.y = 0;
|
|
5737
7058
|
if (!data)
|
|
5738
7059
|
throw new Error("data cannot be null.");
|
|
@@ -5777,6 +7098,14 @@ var spine = (() => {
|
|
|
5777
7098
|
this.color = new Color(1, 1, 1, 1);
|
|
5778
7099
|
this.updateCache();
|
|
5779
7100
|
}
|
|
7101
|
+
get scaleY() {
|
|
7102
|
+
return _Skeleton.yDown ? -this._scaleY : this._scaleY;
|
|
7103
|
+
}
|
|
7104
|
+
set scaleY(scaleY) {
|
|
7105
|
+
this._scaleY = scaleY;
|
|
7106
|
+
}
|
|
7107
|
+
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
|
|
7108
|
+
* constraints, or weighted path attachments are added or removed. */
|
|
5780
7109
|
updateCache() {
|
|
5781
7110
|
let updateCache = this._updateCache;
|
|
5782
7111
|
updateCache.length = 0;
|
|
@@ -5944,6 +7273,10 @@ var spine = (() => {
|
|
|
5944
7273
|
bone.sorted = false;
|
|
5945
7274
|
}
|
|
5946
7275
|
}
|
|
7276
|
+
/** Updates the world transform for each bone and applies all constraints.
|
|
7277
|
+
*
|
|
7278
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7279
|
+
* Runtimes Guide. */
|
|
5947
7280
|
updateWorldTransform() {
|
|
5948
7281
|
let bones = this.bones;
|
|
5949
7282
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
@@ -5983,10 +7316,12 @@ var spine = (() => {
|
|
|
5983
7316
|
updatable.update();
|
|
5984
7317
|
}
|
|
5985
7318
|
}
|
|
7319
|
+
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
5986
7320
|
setToSetupPose() {
|
|
5987
7321
|
this.setBonesToSetupPose();
|
|
5988
7322
|
this.setSlotsToSetupPose();
|
|
5989
7323
|
}
|
|
7324
|
+
/** Sets the bones and constraints to their setup pose values. */
|
|
5990
7325
|
setBonesToSetupPose() {
|
|
5991
7326
|
let bones = this.bones;
|
|
5992
7327
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
@@ -6022,17 +7357,20 @@ var spine = (() => {
|
|
|
6022
7357
|
constraint.mixY = data.mixY;
|
|
6023
7358
|
}
|
|
6024
7359
|
}
|
|
7360
|
+
/** Sets the slots and draw order to their setup pose values. */
|
|
6025
7361
|
setSlotsToSetupPose() {
|
|
6026
7362
|
let slots = this.slots;
|
|
6027
7363
|
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
|
|
6028
7364
|
for (let i = 0, n = slots.length; i < n; i++)
|
|
6029
7365
|
slots[i].setToSetupPose();
|
|
6030
7366
|
}
|
|
7367
|
+
/** @returns May return null. */
|
|
6031
7368
|
getRootBone() {
|
|
6032
7369
|
if (this.bones.length == 0)
|
|
6033
7370
|
return null;
|
|
6034
7371
|
return this.bones[0];
|
|
6035
7372
|
}
|
|
7373
|
+
/** @returns May be null. */
|
|
6036
7374
|
findBone(boneName) {
|
|
6037
7375
|
if (!boneName)
|
|
6038
7376
|
throw new Error("boneName cannot be null.");
|
|
@@ -6044,6 +7382,9 @@ var spine = (() => {
|
|
|
6044
7382
|
}
|
|
6045
7383
|
return null;
|
|
6046
7384
|
}
|
|
7385
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7386
|
+
* repeatedly.
|
|
7387
|
+
* @returns May be null. */
|
|
6047
7388
|
findSlot(slotName) {
|
|
6048
7389
|
if (!slotName)
|
|
6049
7390
|
throw new Error("slotName cannot be null.");
|
|
@@ -6055,12 +7396,25 @@ var spine = (() => {
|
|
|
6055
7396
|
}
|
|
6056
7397
|
return null;
|
|
6057
7398
|
}
|
|
7399
|
+
/** Sets a skin by name.
|
|
7400
|
+
*
|
|
7401
|
+
* See {@link #setSkin()}. */
|
|
6058
7402
|
setSkinByName(skinName) {
|
|
6059
7403
|
let skin = this.data.findSkin(skinName);
|
|
6060
7404
|
if (!skin)
|
|
6061
7405
|
throw new Error("Skin not found: " + skinName);
|
|
6062
7406
|
this.setSkin(skin);
|
|
6063
7407
|
}
|
|
7408
|
+
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
7409
|
+
* skin is changed, {@link #updateCache()} is called.
|
|
7410
|
+
*
|
|
7411
|
+
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
|
|
7412
|
+
* old skin, each slot's setup mode attachment is attached from the new skin.
|
|
7413
|
+
*
|
|
7414
|
+
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
|
|
7415
|
+
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
|
|
7416
|
+
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7417
|
+
* @param newSkin May be null. */
|
|
6064
7418
|
setSkin(newSkin) {
|
|
6065
7419
|
if (newSkin == this.skin)
|
|
6066
7420
|
return;
|
|
@@ -6083,12 +7437,22 @@ var spine = (() => {
|
|
|
6083
7437
|
this.skin = newSkin;
|
|
6084
7438
|
this.updateCache();
|
|
6085
7439
|
}
|
|
7440
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
|
|
7441
|
+
* name.
|
|
7442
|
+
*
|
|
7443
|
+
* See {@link #getAttachment()}.
|
|
7444
|
+
* @returns May be null. */
|
|
6086
7445
|
getAttachmentByName(slotName, attachmentName) {
|
|
6087
7446
|
let slot = this.data.findSlot(slotName);
|
|
6088
7447
|
if (!slot)
|
|
6089
7448
|
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6090
7449
|
return this.getAttachment(slot.index, attachmentName);
|
|
6091
7450
|
}
|
|
7451
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
7452
|
+
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
|
|
7453
|
+
*
|
|
7454
|
+
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7455
|
+
* @returns May be null. */
|
|
6092
7456
|
getAttachment(slotIndex, attachmentName) {
|
|
6093
7457
|
if (!attachmentName)
|
|
6094
7458
|
throw new Error("attachmentName cannot be null.");
|
|
@@ -6101,6 +7465,9 @@ var spine = (() => {
|
|
|
6101
7465
|
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
6102
7466
|
return null;
|
|
6103
7467
|
}
|
|
7468
|
+
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7469
|
+
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7470
|
+
* @param attachmentName May be null to clear the slot's attachment. */
|
|
6104
7471
|
setAttachment(slotName, attachmentName) {
|
|
6105
7472
|
if (!slotName)
|
|
6106
7473
|
throw new Error("slotName cannot be null.");
|
|
@@ -6120,6 +7487,9 @@ var spine = (() => {
|
|
|
6120
7487
|
}
|
|
6121
7488
|
throw new Error("Slot not found: " + slotName);
|
|
6122
7489
|
}
|
|
7490
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7491
|
+
* than to call it repeatedly.
|
|
7492
|
+
* @return May be null. */
|
|
6123
7493
|
findIkConstraint(constraintName) {
|
|
6124
7494
|
if (!constraintName)
|
|
6125
7495
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6131,6 +7501,9 @@ var spine = (() => {
|
|
|
6131
7501
|
}
|
|
6132
7502
|
return null;
|
|
6133
7503
|
}
|
|
7504
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7505
|
+
* this method than to call it repeatedly.
|
|
7506
|
+
* @return May be null. */
|
|
6134
7507
|
findTransformConstraint(constraintName) {
|
|
6135
7508
|
if (!constraintName)
|
|
6136
7509
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6142,6 +7515,9 @@ var spine = (() => {
|
|
|
6142
7515
|
}
|
|
6143
7516
|
return null;
|
|
6144
7517
|
}
|
|
7518
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7519
|
+
* than to call it repeatedly.
|
|
7520
|
+
* @return May be null. */
|
|
6145
7521
|
findPathConstraint(constraintName) {
|
|
6146
7522
|
if (!constraintName)
|
|
6147
7523
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6153,12 +7529,18 @@ var spine = (() => {
|
|
|
6153
7529
|
}
|
|
6154
7530
|
return null;
|
|
6155
7531
|
}
|
|
7532
|
+
/** 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 }`.
|
|
7533
|
+
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
6156
7534
|
getBoundsRect() {
|
|
6157
7535
|
let offset = new Vector2();
|
|
6158
7536
|
let size = new Vector2();
|
|
6159
7537
|
this.getBounds(offset, size);
|
|
6160
7538
|
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6161
7539
|
}
|
|
7540
|
+
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
|
|
7541
|
+
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
|
7542
|
+
* @param size An output value, the width and height of the AABB.
|
|
7543
|
+
* @param temp Working memory to temporarily store attachments' computed world vertices. */
|
|
6162
7544
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6163
7545
|
if (!offset)
|
|
6164
7546
|
throw new Error("offset cannot be null.");
|
|
@@ -6197,30 +7579,59 @@ var spine = (() => {
|
|
|
6197
7579
|
size.set(maxX - minX, maxY - minY);
|
|
6198
7580
|
}
|
|
6199
7581
|
};
|
|
7582
|
+
var Skeleton = _Skeleton;
|
|
7583
|
+
Skeleton.yDown = false;
|
|
6200
7584
|
|
|
6201
7585
|
// spine-core/src/SkeletonData.ts
|
|
6202
7586
|
var SkeletonData = class {
|
|
6203
7587
|
constructor() {
|
|
7588
|
+
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
|
6204
7589
|
this.name = null;
|
|
7590
|
+
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
6205
7591
|
this.bones = new Array();
|
|
7592
|
+
// Ordered parents first.
|
|
7593
|
+
/** The skeleton's slots. */
|
|
6206
7594
|
this.slots = new Array();
|
|
7595
|
+
// Setup pose draw order.
|
|
6207
7596
|
this.skins = new Array();
|
|
7597
|
+
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
|
|
7598
|
+
*
|
|
7599
|
+
* See {@link Skeleton#getAttachmentByName()}.
|
|
7600
|
+
* May be null. */
|
|
6208
7601
|
this.defaultSkin = null;
|
|
7602
|
+
/** The skeleton's events. */
|
|
6209
7603
|
this.events = new Array();
|
|
7604
|
+
/** The skeleton's animations. */
|
|
6210
7605
|
this.animations = new Array();
|
|
7606
|
+
/** The skeleton's IK constraints. */
|
|
6211
7607
|
this.ikConstraints = new Array();
|
|
7608
|
+
/** The skeleton's transform constraints. */
|
|
6212
7609
|
this.transformConstraints = new Array();
|
|
7610
|
+
/** The skeleton's path constraints. */
|
|
6213
7611
|
this.pathConstraints = new Array();
|
|
7612
|
+
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6214
7613
|
this.x = 0;
|
|
7614
|
+
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6215
7615
|
this.y = 0;
|
|
7616
|
+
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6216
7617
|
this.width = 0;
|
|
7618
|
+
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6217
7619
|
this.height = 0;
|
|
7620
|
+
/** The Spine version used to export the skeleton data, or null. */
|
|
6218
7621
|
this.version = null;
|
|
7622
|
+
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
|
6219
7623
|
this.hash = null;
|
|
7624
|
+
// Nonessential
|
|
7625
|
+
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
|
6220
7626
|
this.fps = 0;
|
|
7627
|
+
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6221
7628
|
this.imagesPath = null;
|
|
7629
|
+
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6222
7630
|
this.audioPath = null;
|
|
6223
7631
|
}
|
|
7632
|
+
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
|
|
7633
|
+
* multiple times.
|
|
7634
|
+
* @returns May be null. */
|
|
6224
7635
|
findBone(boneName) {
|
|
6225
7636
|
if (!boneName)
|
|
6226
7637
|
throw new Error("boneName cannot be null.");
|
|
@@ -6232,6 +7643,9 @@ var spine = (() => {
|
|
|
6232
7643
|
}
|
|
6233
7644
|
return null;
|
|
6234
7645
|
}
|
|
7646
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7647
|
+
* multiple times.
|
|
7648
|
+
* @returns May be null. */
|
|
6235
7649
|
findSlot(slotName) {
|
|
6236
7650
|
if (!slotName)
|
|
6237
7651
|
throw new Error("slotName cannot be null.");
|
|
@@ -6243,6 +7657,9 @@ var spine = (() => {
|
|
|
6243
7657
|
}
|
|
6244
7658
|
return null;
|
|
6245
7659
|
}
|
|
7660
|
+
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
|
|
7661
|
+
* multiple times.
|
|
7662
|
+
* @returns May be null. */
|
|
6246
7663
|
findSkin(skinName) {
|
|
6247
7664
|
if (!skinName)
|
|
6248
7665
|
throw new Error("skinName cannot be null.");
|
|
@@ -6254,6 +7671,9 @@ var spine = (() => {
|
|
|
6254
7671
|
}
|
|
6255
7672
|
return null;
|
|
6256
7673
|
}
|
|
7674
|
+
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
|
|
7675
|
+
* multiple times.
|
|
7676
|
+
* @returns May be null. */
|
|
6257
7677
|
findEvent(eventDataName) {
|
|
6258
7678
|
if (!eventDataName)
|
|
6259
7679
|
throw new Error("eventDataName cannot be null.");
|
|
@@ -6265,6 +7685,9 @@ var spine = (() => {
|
|
|
6265
7685
|
}
|
|
6266
7686
|
return null;
|
|
6267
7687
|
}
|
|
7688
|
+
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
|
|
7689
|
+
* call it multiple times.
|
|
7690
|
+
* @returns May be null. */
|
|
6268
7691
|
findAnimation(animationName) {
|
|
6269
7692
|
if (!animationName)
|
|
6270
7693
|
throw new Error("animationName cannot be null.");
|
|
@@ -6276,6 +7699,9 @@ var spine = (() => {
|
|
|
6276
7699
|
}
|
|
6277
7700
|
return null;
|
|
6278
7701
|
}
|
|
7702
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7703
|
+
* than to call it multiple times.
|
|
7704
|
+
* @return May be null. */
|
|
6279
7705
|
findIkConstraint(constraintName) {
|
|
6280
7706
|
if (!constraintName)
|
|
6281
7707
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6287,6 +7713,9 @@ var spine = (() => {
|
|
|
6287
7713
|
}
|
|
6288
7714
|
return null;
|
|
6289
7715
|
}
|
|
7716
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7717
|
+
* this method than to call it multiple times.
|
|
7718
|
+
* @return May be null. */
|
|
6290
7719
|
findTransformConstraint(constraintName) {
|
|
6291
7720
|
if (!constraintName)
|
|
6292
7721
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6298,6 +7727,9 @@ var spine = (() => {
|
|
|
6298
7727
|
}
|
|
6299
7728
|
return null;
|
|
6300
7729
|
}
|
|
7730
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7731
|
+
* than to call it multiple times.
|
|
7732
|
+
* @return May be null. */
|
|
6301
7733
|
findPathConstraint(constraintName) {
|
|
6302
7734
|
if (!constraintName)
|
|
6303
7735
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6328,6 +7760,7 @@ var spine = (() => {
|
|
|
6328
7760
|
throw new Error("name cannot be null.");
|
|
6329
7761
|
this.name = name;
|
|
6330
7762
|
}
|
|
7763
|
+
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
6331
7764
|
setAttachment(slotIndex, name, attachment) {
|
|
6332
7765
|
if (!attachment)
|
|
6333
7766
|
throw new Error("attachment cannot be null.");
|
|
@@ -6338,6 +7771,7 @@ var spine = (() => {
|
|
|
6338
7771
|
attachments[slotIndex] = {};
|
|
6339
7772
|
attachments[slotIndex][name] = attachment;
|
|
6340
7773
|
}
|
|
7774
|
+
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
6341
7775
|
addSkin(skin) {
|
|
6342
7776
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6343
7777
|
let bone = skin.bones[i];
|
|
@@ -6369,6 +7803,8 @@ var spine = (() => {
|
|
|
6369
7803
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
6370
7804
|
}
|
|
6371
7805
|
}
|
|
7806
|
+
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
|
|
7807
|
+
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
|
|
6372
7808
|
copySkin(skin) {
|
|
6373
7809
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6374
7810
|
let bone = skin.bones[i];
|
|
@@ -6408,15 +7844,18 @@ var spine = (() => {
|
|
|
6408
7844
|
}
|
|
6409
7845
|
}
|
|
6410
7846
|
}
|
|
7847
|
+
/** Returns the attachment for the specified slot index and name, or null. */
|
|
6411
7848
|
getAttachment(slotIndex, name) {
|
|
6412
7849
|
let dictionary = this.attachments[slotIndex];
|
|
6413
7850
|
return dictionary ? dictionary[name] : null;
|
|
6414
7851
|
}
|
|
7852
|
+
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
6415
7853
|
removeAttachment(slotIndex, name) {
|
|
6416
7854
|
let dictionary = this.attachments[slotIndex];
|
|
6417
7855
|
if (dictionary)
|
|
6418
7856
|
delete dictionary[name];
|
|
6419
7857
|
}
|
|
7858
|
+
/** Returns all attachments in this skin. */
|
|
6420
7859
|
getAttachments() {
|
|
6421
7860
|
let entries = new Array();
|
|
6422
7861
|
for (var i = 0; i < this.attachments.length; i++) {
|
|
@@ -6431,6 +7870,7 @@ var spine = (() => {
|
|
|
6431
7870
|
}
|
|
6432
7871
|
return entries;
|
|
6433
7872
|
}
|
|
7873
|
+
/** Returns all attachments in this skin for the specified slot index. */
|
|
6434
7874
|
getAttachmentsForSlot(slotIndex, attachments) {
|
|
6435
7875
|
let slotAttachments = this.attachments[slotIndex];
|
|
6436
7876
|
if (slotAttachments) {
|
|
@@ -6441,11 +7881,13 @@ var spine = (() => {
|
|
|
6441
7881
|
}
|
|
6442
7882
|
}
|
|
6443
7883
|
}
|
|
7884
|
+
/** Clears all attachments, bones, and constraints. */
|
|
6444
7885
|
clear() {
|
|
6445
7886
|
this.attachments.length = 0;
|
|
6446
7887
|
this.bones.length = 0;
|
|
6447
7888
|
this.constraints.length = 0;
|
|
6448
7889
|
}
|
|
7890
|
+
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
|
|
6449
7891
|
attachAll(skeleton, oldSkin) {
|
|
6450
7892
|
let slotIndex = 0;
|
|
6451
7893
|
for (let i = 0; i < skeleton.slots.length; i++) {
|
|
@@ -6471,10 +7913,17 @@ var spine = (() => {
|
|
|
6471
7913
|
// spine-core/src/SlotData.ts
|
|
6472
7914
|
var SlotData = class {
|
|
6473
7915
|
constructor(index, name, boneData) {
|
|
7916
|
+
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
|
6474
7917
|
this.index = 0;
|
|
7918
|
+
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
|
7919
|
+
* color tinting. */
|
|
6475
7920
|
this.color = new Color(1, 1, 1, 1);
|
|
7921
|
+
/** 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
|
|
7922
|
+
* color's alpha is not used. */
|
|
6476
7923
|
this.darkColor = null;
|
|
7924
|
+
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
6477
7925
|
this.attachmentName = null;
|
|
7926
|
+
/** The blend mode for drawing the slot's attachment. */
|
|
6478
7927
|
this.blendMode = BlendMode.Normal;
|
|
6479
7928
|
if (index < 0)
|
|
6480
7929
|
throw new Error("index must be >= 0.");
|
|
@@ -6487,19 +7936,21 @@ var spine = (() => {
|
|
|
6487
7936
|
this.boneData = boneData;
|
|
6488
7937
|
}
|
|
6489
7938
|
};
|
|
6490
|
-
var BlendMode
|
|
6491
|
-
(function(BlendMode2) {
|
|
7939
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode2) => {
|
|
6492
7940
|
BlendMode2[BlendMode2["Normal"] = 0] = "Normal";
|
|
6493
7941
|
BlendMode2[BlendMode2["Additive"] = 1] = "Additive";
|
|
6494
7942
|
BlendMode2[BlendMode2["Multiply"] = 2] = "Multiply";
|
|
6495
7943
|
BlendMode2[BlendMode2["Screen"] = 3] = "Screen";
|
|
6496
|
-
|
|
7944
|
+
return BlendMode2;
|
|
7945
|
+
})(BlendMode || {});
|
|
6497
7946
|
|
|
6498
7947
|
// spine-core/src/TransformConstraintData.ts
|
|
6499
7948
|
var TransformConstraintData = class extends ConstraintData {
|
|
6500
7949
|
constructor(name) {
|
|
6501
7950
|
super(name, 0, false);
|
|
7951
|
+
/** The bones that will be modified by this transform constraint. */
|
|
6502
7952
|
this.bones = new Array();
|
|
7953
|
+
/** The target bone whose world transform will be copied to the constrained bones. */
|
|
6503
7954
|
this._target = null;
|
|
6504
7955
|
this.mixRotate = 0;
|
|
6505
7956
|
this.mixX = 0;
|
|
@@ -6507,11 +7958,17 @@ var spine = (() => {
|
|
|
6507
7958
|
this.mixScaleX = 0;
|
|
6508
7959
|
this.mixScaleY = 0;
|
|
6509
7960
|
this.mixShearY = 0;
|
|
7961
|
+
/** An offset added to the constrained bone rotation. */
|
|
6510
7962
|
this.offsetRotation = 0;
|
|
7963
|
+
/** An offset added to the constrained bone X translation. */
|
|
6511
7964
|
this.offsetX = 0;
|
|
7965
|
+
/** An offset added to the constrained bone Y translation. */
|
|
6512
7966
|
this.offsetY = 0;
|
|
7967
|
+
/** An offset added to the constrained bone scaleX. */
|
|
6513
7968
|
this.offsetScaleX = 0;
|
|
7969
|
+
/** An offset added to the constrained bone scaleY. */
|
|
6514
7970
|
this.offsetScaleY = 0;
|
|
7971
|
+
/** An offset added to the constrained bone shearY. */
|
|
6515
7972
|
this.offsetShearY = 0;
|
|
6516
7973
|
this.relative = false;
|
|
6517
7974
|
this.local = false;
|
|
@@ -6530,6 +7987,10 @@ var spine = (() => {
|
|
|
6530
7987
|
// spine-core/src/SkeletonBinary.ts
|
|
6531
7988
|
var SkeletonBinary = class {
|
|
6532
7989
|
constructor(attachmentLoader) {
|
|
7990
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
7991
|
+
* runtime than were used in Spine.
|
|
7992
|
+
*
|
|
7993
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
6533
7994
|
this.scale = 1;
|
|
6534
7995
|
this.linkedMeshes = new Array();
|
|
6535
7996
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -6662,10 +8123,10 @@ var spine = (() => {
|
|
|
6662
8123
|
data.rotateMode = input.readInt(true);
|
|
6663
8124
|
data.offsetRotation = input.readFloat();
|
|
6664
8125
|
data.position = input.readFloat();
|
|
6665
|
-
if (data.positionMode ==
|
|
8126
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
6666
8127
|
data.position *= scale;
|
|
6667
8128
|
data.spacing = input.readFloat();
|
|
6668
|
-
if (data.spacingMode ==
|
|
8129
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
6669
8130
|
data.spacing *= scale;
|
|
6670
8131
|
data.mixRotate = input.readFloat();
|
|
6671
8132
|
data.mixX = input.readFloat();
|
|
@@ -7290,10 +8751,18 @@ var spine = (() => {
|
|
|
7290
8751
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
7291
8752
|
switch (input.readByte()) {
|
|
7292
8753
|
case PATH_POSITION:
|
|
7293
|
-
timelines.push(readTimeline1(
|
|
8754
|
+
timelines.push(readTimeline1(
|
|
8755
|
+
input,
|
|
8756
|
+
new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
|
|
8757
|
+
data.positionMode == 0 /* Fixed */ ? scale : 1
|
|
8758
|
+
));
|
|
7294
8759
|
break;
|
|
7295
8760
|
case PATH_SPACING:
|
|
7296
|
-
timelines.push(readTimeline1(
|
|
8761
|
+
timelines.push(readTimeline1(
|
|
8762
|
+
input,
|
|
8763
|
+
new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
|
|
8764
|
+
data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
|
|
8765
|
+
));
|
|
7297
8766
|
break;
|
|
7298
8767
|
case PATH_MIX:
|
|
7299
8768
|
let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
|
|
@@ -7384,7 +8853,13 @@ var spine = (() => {
|
|
|
7384
8853
|
for (let frame = 0; frame < frameCount; frame++) {
|
|
7385
8854
|
let time = input.readFloat();
|
|
7386
8855
|
let modeAndIndex = input.readInt32();
|
|
7387
|
-
timeline.setFrame(
|
|
8856
|
+
timeline.setFrame(
|
|
8857
|
+
frame,
|
|
8858
|
+
time,
|
|
8859
|
+
SequenceModeValues[modeAndIndex & 15],
|
|
8860
|
+
modeAndIndex >> 4,
|
|
8861
|
+
input.readFloat()
|
|
8862
|
+
);
|
|
7388
8863
|
}
|
|
7389
8864
|
timelines.push(timeline);
|
|
7390
8865
|
break;
|
|
@@ -7545,8 +9020,7 @@ var spine = (() => {
|
|
|
7545
9020
|
this.vertices = vertices;
|
|
7546
9021
|
}
|
|
7547
9022
|
};
|
|
7548
|
-
var AttachmentType
|
|
7549
|
-
(function(AttachmentType2) {
|
|
9023
|
+
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
7550
9024
|
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
7551
9025
|
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
7552
9026
|
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
@@ -7554,7 +9028,8 @@ var spine = (() => {
|
|
|
7554
9028
|
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
7555
9029
|
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
7556
9030
|
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
7557
|
-
|
|
9031
|
+
return AttachmentType2;
|
|
9032
|
+
})(AttachmentType || {});
|
|
7558
9033
|
function readTimeline1(input, timeline, scale) {
|
|
7559
9034
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
7560
9035
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
@@ -7625,16 +9100,26 @@ var spine = (() => {
|
|
|
7625
9100
|
// spine-core/src/SkeletonBounds.ts
|
|
7626
9101
|
var SkeletonBounds = class {
|
|
7627
9102
|
constructor() {
|
|
9103
|
+
/** The left edge of the axis aligned bounding box. */
|
|
7628
9104
|
this.minX = 0;
|
|
9105
|
+
/** The bottom edge of the axis aligned bounding box. */
|
|
7629
9106
|
this.minY = 0;
|
|
9107
|
+
/** The right edge of the axis aligned bounding box. */
|
|
7630
9108
|
this.maxX = 0;
|
|
9109
|
+
/** The top edge of the axis aligned bounding box. */
|
|
7631
9110
|
this.maxY = 0;
|
|
9111
|
+
/** The visible bounding boxes. */
|
|
7632
9112
|
this.boundingBoxes = new Array();
|
|
9113
|
+
/** The world vertices for the bounding box polygons. */
|
|
7633
9114
|
this.polygons = new Array();
|
|
7634
9115
|
this.polygonPool = new Pool(() => {
|
|
7635
9116
|
return Utils.newFloatArray(16);
|
|
7636
9117
|
});
|
|
7637
9118
|
}
|
|
9119
|
+
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
|
|
9120
|
+
* box's polygon.
|
|
9121
|
+
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9122
|
+
* SkeletonBounds AABB methods will always return true. */
|
|
7638
9123
|
update(skeleton, updateAabb) {
|
|
7639
9124
|
if (!skeleton)
|
|
7640
9125
|
throw new Error("skeleton cannot be null.");
|
|
@@ -7691,9 +9176,11 @@ var spine = (() => {
|
|
|
7691
9176
|
this.maxX = maxX;
|
|
7692
9177
|
this.maxY = maxY;
|
|
7693
9178
|
}
|
|
9179
|
+
/** Returns true if the axis aligned bounding box contains the point. */
|
|
7694
9180
|
aabbContainsPoint(x, y) {
|
|
7695
9181
|
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
|
|
7696
9182
|
}
|
|
9183
|
+
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
|
7697
9184
|
aabbIntersectsSegment(x1, y1, x2, y2) {
|
|
7698
9185
|
let minX = this.minX;
|
|
7699
9186
|
let minY = this.minY;
|
|
@@ -7716,9 +9203,12 @@ var spine = (() => {
|
|
|
7716
9203
|
return true;
|
|
7717
9204
|
return false;
|
|
7718
9205
|
}
|
|
9206
|
+
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
7719
9207
|
aabbIntersectsSkeleton(bounds) {
|
|
7720
9208
|
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
|
|
7721
9209
|
}
|
|
9210
|
+
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
|
9211
|
+
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
|
|
7722
9212
|
containsPoint(x, y) {
|
|
7723
9213
|
let polygons = this.polygons;
|
|
7724
9214
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7726,6 +9216,7 @@ var spine = (() => {
|
|
|
7726
9216
|
return this.boundingBoxes[i];
|
|
7727
9217
|
return null;
|
|
7728
9218
|
}
|
|
9219
|
+
/** Returns true if the polygon contains the point. */
|
|
7729
9220
|
containsPointPolygon(polygon, x, y) {
|
|
7730
9221
|
let vertices = polygon;
|
|
7731
9222
|
let nn = polygon.length;
|
|
@@ -7743,6 +9234,9 @@ var spine = (() => {
|
|
|
7743
9234
|
}
|
|
7744
9235
|
return inside;
|
|
7745
9236
|
}
|
|
9237
|
+
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
|
|
9238
|
+
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
|
|
9239
|
+
* true. */
|
|
7746
9240
|
intersectsSegment(x1, y1, x2, y2) {
|
|
7747
9241
|
let polygons = this.polygons;
|
|
7748
9242
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7750,6 +9244,7 @@ var spine = (() => {
|
|
|
7750
9244
|
return this.boundingBoxes[i];
|
|
7751
9245
|
return null;
|
|
7752
9246
|
}
|
|
9247
|
+
/** Returns true if the polygon contains any part of the line segment. */
|
|
7753
9248
|
intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
|
|
7754
9249
|
let vertices = polygon;
|
|
7755
9250
|
let nn = polygon.length;
|
|
@@ -7772,15 +9267,18 @@ var spine = (() => {
|
|
|
7772
9267
|
}
|
|
7773
9268
|
return false;
|
|
7774
9269
|
}
|
|
9270
|
+
/** Returns the polygon for the specified bounding box, or null. */
|
|
7775
9271
|
getPolygon(boundingBox) {
|
|
7776
9272
|
if (!boundingBox)
|
|
7777
9273
|
throw new Error("boundingBox cannot be null.");
|
|
7778
9274
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
7779
9275
|
return index == -1 ? null : this.polygons[index];
|
|
7780
9276
|
}
|
|
9277
|
+
/** The width of the axis aligned bounding box. */
|
|
7781
9278
|
getWidth() {
|
|
7782
9279
|
return this.maxX - this.minX;
|
|
7783
9280
|
}
|
|
9281
|
+
/** The height of the axis aligned bounding box. */
|
|
7784
9282
|
getHeight() {
|
|
7785
9283
|
return this.maxY - this.minY;
|
|
7786
9284
|
}
|
|
@@ -7984,7 +9482,14 @@ var spine = (() => {
|
|
|
7984
9482
|
let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
|
|
7985
9483
|
let current = indices[index] << 1;
|
|
7986
9484
|
let next = indices[(index + 1) % vertexCount] << 1;
|
|
7987
|
-
return !this.positiveArea(
|
|
9485
|
+
return !this.positiveArea(
|
|
9486
|
+
vertices[previous],
|
|
9487
|
+
vertices[previous + 1],
|
|
9488
|
+
vertices[current],
|
|
9489
|
+
vertices[current + 1],
|
|
9490
|
+
vertices[next],
|
|
9491
|
+
vertices[next + 1]
|
|
9492
|
+
);
|
|
7988
9493
|
}
|
|
7989
9494
|
static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
|
|
7990
9495
|
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
|
|
@@ -8174,6 +9679,8 @@ var spine = (() => {
|
|
|
8174
9679
|
}
|
|
8175
9680
|
}
|
|
8176
9681
|
}
|
|
9682
|
+
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
|
9683
|
+
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
|
8177
9684
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8178
9685
|
let originalOutput = output;
|
|
8179
9686
|
let clipped = false;
|
|
@@ -8285,6 +9792,10 @@ var spine = (() => {
|
|
|
8285
9792
|
// spine-core/src/SkeletonJson.ts
|
|
8286
9793
|
var SkeletonJson = class {
|
|
8287
9794
|
constructor(attachmentLoader) {
|
|
9795
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
9796
|
+
* runtime than were used in Spine.
|
|
9797
|
+
*
|
|
9798
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
8288
9799
|
this.scale = 1;
|
|
8289
9800
|
this.linkedMeshes = new Array();
|
|
8290
9801
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8430,10 +9941,10 @@ var spine = (() => {
|
|
|
8430
9941
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
8431
9942
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
8432
9943
|
data.position = getValue(constraintMap, "position", 0);
|
|
8433
|
-
if (data.positionMode ==
|
|
9944
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
8434
9945
|
data.position *= scale;
|
|
8435
9946
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
8436
|
-
if (data.spacingMode ==
|
|
9947
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8437
9948
|
data.spacing *= scale;
|
|
8438
9949
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
8439
9950
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
@@ -8974,10 +10485,10 @@ var spine = (() => {
|
|
|
8974
10485
|
let frames = timelineMap.length;
|
|
8975
10486
|
if (timelineName === "position") {
|
|
8976
10487
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
8977
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode ==
|
|
10488
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
|
|
8978
10489
|
} else if (timelineName === "spacing") {
|
|
8979
10490
|
let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
|
|
8980
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode ==
|
|
10491
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
|
|
8981
10492
|
} else if (timelineName === "mix") {
|
|
8982
10493
|
let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
|
|
8983
10494
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -9231,6 +10742,6 @@ var spine = (() => {
|
|
|
9231
10742
|
}(new Float32Array(1));
|
|
9232
10743
|
}
|
|
9233
10744
|
})();
|
|
9234
|
-
return src_exports;
|
|
10745
|
+
return __toCommonJS(src_exports);
|
|
9235
10746
|
})();
|
|
9236
10747
|
//# sourceMappingURL=spine-core.js.map
|