@esotericsoftware/spine-core 4.1.24 → 4.1.26
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/Skeleton.d.ts +4 -1
- package/dist/Skeleton.js +10 -2
- package/dist/TransformConstraint.js +1 -1
- package/dist/iife/spine-core.js +2002 -491
- 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;
|
|
@@ -2862,6 +3800,10 @@ var spine = (() => {
|
|
|
2862
3800
|
this.queue.event(entry, event);
|
|
2863
3801
|
}
|
|
2864
3802
|
}
|
|
3803
|
+
/** Removes all animations from all tracks, leaving skeletons in their current pose.
|
|
3804
|
+
*
|
|
3805
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3806
|
+
* rather than leaving them in their current pose. */
|
|
2865
3807
|
clearTracks() {
|
|
2866
3808
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2867
3809
|
this.queue.drainDisabled = true;
|
|
@@ -2871,6 +3813,10 @@ var spine = (() => {
|
|
|
2871
3813
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
2872
3814
|
this.queue.drain();
|
|
2873
3815
|
}
|
|
3816
|
+
/** Removes all animations from the track, leaving skeletons in their current pose.
|
|
3817
|
+
*
|
|
3818
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3819
|
+
* rather than leaving them in their current pose. */
|
|
2874
3820
|
clearTrack(trackIndex) {
|
|
2875
3821
|
if (trackIndex >= this.tracks.length)
|
|
2876
3822
|
return;
|
|
@@ -2908,12 +3854,21 @@ var spine = (() => {
|
|
|
2908
3854
|
}
|
|
2909
3855
|
this.queue.start(current);
|
|
2910
3856
|
}
|
|
3857
|
+
/** Sets an animation by name.
|
|
3858
|
+
*
|
|
3859
|
+
* See {@link #setAnimationWith()}. */
|
|
2911
3860
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
2912
3861
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2913
3862
|
if (!animation)
|
|
2914
3863
|
throw new Error("Animation not found: " + animationName);
|
|
2915
3864
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
2916
3865
|
}
|
|
3866
|
+
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
3867
|
+
* applied to a skeleton, it is replaced (not mixed from).
|
|
3868
|
+
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
3869
|
+
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
|
|
3870
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3871
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2917
3872
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
2918
3873
|
if (!animation)
|
|
2919
3874
|
throw new Error("animation cannot be null.");
|
|
@@ -2935,12 +3890,23 @@ var spine = (() => {
|
|
|
2935
3890
|
this.queue.drain();
|
|
2936
3891
|
return entry;
|
|
2937
3892
|
}
|
|
3893
|
+
/** Queues an animation by name.
|
|
3894
|
+
*
|
|
3895
|
+
* See {@link #addAnimationWith()}. */
|
|
2938
3896
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
2939
3897
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2940
3898
|
if (!animation)
|
|
2941
3899
|
throw new Error("Animation not found: " + animationName);
|
|
2942
3900
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
2943
3901
|
}
|
|
3902
|
+
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
3903
|
+
* equivalent to calling {@link #setAnimationWith()}.
|
|
3904
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3905
|
+
* minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
|
|
3906
|
+
* ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
|
|
3907
|
+
* previous entry is looping, its next loop completion is used instead of its duration.
|
|
3908
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3909
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2944
3910
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
2945
3911
|
if (!animation)
|
|
2946
3912
|
throw new Error("animation cannot be null.");
|
|
@@ -2962,12 +3928,37 @@ var spine = (() => {
|
|
|
2962
3928
|
entry.delay = delay;
|
|
2963
3929
|
return entry;
|
|
2964
3930
|
}
|
|
3931
|
+
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
|
|
3932
|
+
* {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
|
|
3933
|
+
*
|
|
3934
|
+
* Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
|
|
3935
|
+
* {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
|
|
3936
|
+
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
|
|
3937
|
+
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
|
|
3938
|
+
* 0 still mixes out over one frame.
|
|
3939
|
+
*
|
|
3940
|
+
* Mixing in is done by first setting an empty animation, then adding an animation using
|
|
3941
|
+
* {@link #addAnimation()} and on the returned track entry, set the
|
|
3942
|
+
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
|
|
3943
|
+
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
|
3944
|
+
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
|
2965
3945
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
2966
3946
|
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
2967
3947
|
entry.mixDuration = mixDuration;
|
|
2968
3948
|
entry.trackEnd = mixDuration;
|
|
2969
3949
|
return entry;
|
|
2970
3950
|
}
|
|
3951
|
+
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
|
|
3952
|
+
* {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
|
|
3953
|
+
* {@link #setEmptyAnimation()}.
|
|
3954
|
+
*
|
|
3955
|
+
* See {@link #setEmptyAnimation()}.
|
|
3956
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3957
|
+
* minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
|
|
3958
|
+
* before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
|
|
3959
|
+
* loop completion is used instead of its duration.
|
|
3960
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3961
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2971
3962
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
2972
3963
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
2973
3964
|
if (delay <= 0)
|
|
@@ -2976,6 +3967,8 @@ var spine = (() => {
|
|
|
2976
3967
|
entry.trackEnd = mixDuration;
|
|
2977
3968
|
return entry;
|
|
2978
3969
|
}
|
|
3970
|
+
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
|
3971
|
+
* duration. */
|
|
2979
3972
|
setEmptyAnimations(mixDuration = 0) {
|
|
2980
3973
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2981
3974
|
this.queue.drainDisabled = true;
|
|
@@ -2994,6 +3987,7 @@ var spine = (() => {
|
|
|
2994
3987
|
this.tracks.length = index + 1;
|
|
2995
3988
|
return null;
|
|
2996
3989
|
}
|
|
3990
|
+
/** @param last May be null. */
|
|
2997
3991
|
trackEntry(trackIndex, animation, loop, last) {
|
|
2998
3992
|
let entry = this.trackEntryPool.obtain();
|
|
2999
3993
|
entry.reset();
|
|
@@ -3021,9 +4015,10 @@ var spine = (() => {
|
|
|
3021
4015
|
entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation);
|
|
3022
4016
|
entry.interruptAlpha = 1;
|
|
3023
4017
|
entry.totalAlpha = 0;
|
|
3024
|
-
entry.mixBlend =
|
|
4018
|
+
entry.mixBlend = 2 /* replace */;
|
|
3025
4019
|
return entry;
|
|
3026
4020
|
}
|
|
4021
|
+
/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
|
|
3027
4022
|
clearNext(entry) {
|
|
3028
4023
|
let next = entry.next;
|
|
3029
4024
|
while (next) {
|
|
@@ -3043,7 +4038,7 @@ var spine = (() => {
|
|
|
3043
4038
|
while (entry.mixingFrom)
|
|
3044
4039
|
entry = entry.mixingFrom;
|
|
3045
4040
|
do {
|
|
3046
|
-
if (!entry.mixingTo || entry.mixBlend !=
|
|
4041
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
3047
4042
|
this.computeHold(entry);
|
|
3048
4043
|
entry = entry.mixingTo;
|
|
3049
4044
|
} while (entry);
|
|
@@ -3086,24 +4081,31 @@ var spine = (() => {
|
|
|
3086
4081
|
}
|
|
3087
4082
|
}
|
|
3088
4083
|
}
|
|
4084
|
+
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
3089
4085
|
getCurrent(trackIndex) {
|
|
3090
4086
|
if (trackIndex >= this.tracks.length)
|
|
3091
4087
|
return null;
|
|
3092
4088
|
return this.tracks[trackIndex];
|
|
3093
4089
|
}
|
|
4090
|
+
/** Adds a listener to receive events for all track entries. */
|
|
3094
4091
|
addListener(listener) {
|
|
3095
4092
|
if (!listener)
|
|
3096
4093
|
throw new Error("listener cannot be null.");
|
|
3097
4094
|
this.listeners.push(listener);
|
|
3098
4095
|
}
|
|
4096
|
+
/** Removes the listener added with {@link #addListener()}. */
|
|
3099
4097
|
removeListener(listener) {
|
|
3100
4098
|
let index = this.listeners.indexOf(listener);
|
|
3101
4099
|
if (index >= 0)
|
|
3102
4100
|
this.listeners.splice(index, 1);
|
|
3103
4101
|
}
|
|
4102
|
+
/** Removes all listeners added with {@link #addListener()}. */
|
|
3104
4103
|
clearListeners() {
|
|
3105
4104
|
this.listeners.length = 0;
|
|
3106
4105
|
}
|
|
4106
|
+
/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
|
|
4107
|
+
* {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
|
|
4108
|
+
* are not wanted because new animations are being set. */
|
|
3107
4109
|
clearListenerNotifications() {
|
|
3108
4110
|
this.queue.clear();
|
|
3109
4111
|
}
|
|
@@ -3112,36 +4114,134 @@ var spine = (() => {
|
|
|
3112
4114
|
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3113
4115
|
var TrackEntry = class {
|
|
3114
4116
|
constructor() {
|
|
4117
|
+
/** The animation to apply for this track entry. */
|
|
3115
4118
|
this.animation = null;
|
|
3116
4119
|
this.previous = null;
|
|
4120
|
+
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
|
|
3117
4121
|
this.next = null;
|
|
4122
|
+
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
|
|
4123
|
+
* mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
|
|
3118
4124
|
this.mixingFrom = null;
|
|
4125
|
+
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
|
|
4126
|
+
* currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
|
|
3119
4127
|
this.mixingTo = null;
|
|
4128
|
+
/** The listener for events generated by this track entry, or null.
|
|
4129
|
+
*
|
|
4130
|
+
* A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
|
|
4131
|
+
* for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
|
|
3120
4132
|
this.listener = null;
|
|
4133
|
+
/** The index of the track where this track entry is either current or queued.
|
|
4134
|
+
*
|
|
4135
|
+
* See {@link AnimationState#getCurrent()}. */
|
|
3121
4136
|
this.trackIndex = 0;
|
|
4137
|
+
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
4138
|
+
* duration. */
|
|
3122
4139
|
this.loop = false;
|
|
4140
|
+
/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
|
|
4141
|
+
* of being mixed out.
|
|
4142
|
+
*
|
|
4143
|
+
* When mixing between animations that key the same property, if a lower track also keys that property then the value will
|
|
4144
|
+
* briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
|
|
4145
|
+
* while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
|
|
4146
|
+
* at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
|
|
4147
|
+
* keys the property, only when a higher track also keys the property.
|
|
4148
|
+
*
|
|
4149
|
+
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
|
|
4150
|
+
* previous animation. */
|
|
3123
4151
|
this.holdPrevious = false;
|
|
3124
4152
|
this.reverse = false;
|
|
3125
4153
|
this.shortestRotation = false;
|
|
4154
|
+
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
4155
|
+
* `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
|
|
4156
|
+
* timelines are not applied while this animation is being mixed out. */
|
|
3126
4157
|
this.eventThreshold = 0;
|
|
4158
|
+
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
|
|
4159
|
+
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
|
|
4160
|
+
* 0, so attachment timelines are not applied while this animation is being mixed out. */
|
|
3127
4161
|
this.attachmentThreshold = 0;
|
|
4162
|
+
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
4163
|
+
* `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
|
|
4164
|
+
* so draw order timelines are not applied while this animation is being mixed out. */
|
|
3128
4165
|
this.drawOrderThreshold = 0;
|
|
4166
|
+
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
|
|
4167
|
+
*
|
|
4168
|
+
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
|
|
4169
|
+
* value to prevent timeline keys before the start time from triggering. */
|
|
3129
4170
|
this.animationStart = 0;
|
|
4171
|
+
/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
|
|
4172
|
+
* loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
|
|
3130
4173
|
this.animationEnd = 0;
|
|
4174
|
+
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
|
|
4175
|
+
* animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
|
|
4176
|
+
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
|
|
4177
|
+
* is applied. */
|
|
3131
4178
|
this.animationLast = 0;
|
|
3132
4179
|
this.nextAnimationLast = 0;
|
|
4180
|
+
/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
|
|
4181
|
+
* postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
|
|
4182
|
+
* the start of the previous animation to when this track entry will become the current track entry (ie when the previous
|
|
4183
|
+
* track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
|
|
4184
|
+
*
|
|
4185
|
+
* {@link #timeScale} affects the delay. */
|
|
3133
4186
|
this.delay = 0;
|
|
4187
|
+
/** Current time in seconds this track entry has been the current track entry. The track time determines
|
|
4188
|
+
* {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
|
|
4189
|
+
* looping. */
|
|
3134
4190
|
this.trackTime = 0;
|
|
3135
4191
|
this.trackLast = 0;
|
|
3136
4192
|
this.nextTrackLast = 0;
|
|
4193
|
+
/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
|
|
4194
|
+
* value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
|
|
4195
|
+
* is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
|
|
4196
|
+
* properties keyed by the animation are set to the setup pose and the track is cleared.
|
|
4197
|
+
*
|
|
4198
|
+
* It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
|
|
4199
|
+
* abruptly cease being applied. */
|
|
3137
4200
|
this.trackEnd = 0;
|
|
4201
|
+
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
|
4202
|
+
* faster. Defaults to 1.
|
|
4203
|
+
*
|
|
4204
|
+
* {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
|
|
4205
|
+
* match the animation speed.
|
|
4206
|
+
*
|
|
4207
|
+
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4208
|
+
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
|
|
4209
|
+
* the time scale is not 1, the delay may need to be adjusted.
|
|
4210
|
+
*
|
|
4211
|
+
* See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
|
|
3138
4212
|
this.timeScale = 0;
|
|
4213
|
+
/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
|
|
4214
|
+
* to 1, which overwrites the skeleton's current pose with this animation.
|
|
4215
|
+
*
|
|
4216
|
+
* Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
|
|
4217
|
+
* use alpha on track 0 if the skeleton pose is from the last frame render. */
|
|
3139
4218
|
this.alpha = 0;
|
|
4219
|
+
/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
|
|
4220
|
+
* slightly more than `mixDuration` when the mix is complete. */
|
|
3140
4221
|
this.mixTime = 0;
|
|
4222
|
+
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
|
|
4223
|
+
* {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
|
|
4224
|
+
*
|
|
4225
|
+
* A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
|
|
4226
|
+
* properties it was animating.
|
|
4227
|
+
*
|
|
4228
|
+
* The `mixDuration` can be set manually rather than use the value from
|
|
4229
|
+
* {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
|
|
4230
|
+
* track entry only before {@link AnimationState#update(float)} is first called.
|
|
4231
|
+
*
|
|
4232
|
+
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4233
|
+
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
|
4234
|
+
* afterward. */
|
|
3141
4235
|
this.mixDuration = 0;
|
|
3142
4236
|
this.interruptAlpha = 0;
|
|
3143
4237
|
this.totalAlpha = 0;
|
|
3144
|
-
|
|
4238
|
+
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
4239
|
+
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
|
|
4240
|
+
* the values from the lower tracks.
|
|
4241
|
+
*
|
|
4242
|
+
* The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
|
|
4243
|
+
* called. */
|
|
4244
|
+
this.mixBlend = 2 /* replace */;
|
|
3145
4245
|
this.timelineMode = new Array();
|
|
3146
4246
|
this.timelineHoldMix = new Array();
|
|
3147
4247
|
this.timelinesRotation = new Array();
|
|
@@ -3157,6 +4257,9 @@ var spine = (() => {
|
|
|
3157
4257
|
this.timelineHoldMix.length = 0;
|
|
3158
4258
|
this.timelinesRotation.length = 0;
|
|
3159
4259
|
}
|
|
4260
|
+
/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
|
|
4261
|
+
* and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
|
|
4262
|
+
* `animationStart` time. */
|
|
3160
4263
|
getAnimationTime() {
|
|
3161
4264
|
if (this.loop) {
|
|
3162
4265
|
let duration = this.animationEnd - this.animationStart;
|
|
@@ -3170,9 +4273,19 @@ var spine = (() => {
|
|
|
3170
4273
|
this.animationLast = animationLast;
|
|
3171
4274
|
this.nextAnimationLast = animationLast;
|
|
3172
4275
|
}
|
|
4276
|
+
/** Returns true if at least one loop has been completed.
|
|
4277
|
+
*
|
|
4278
|
+
* See {@link AnimationStateListener#complete()}. */
|
|
3173
4279
|
isComplete() {
|
|
3174
4280
|
return this.trackTime >= this.animationEnd - this.animationStart;
|
|
3175
4281
|
}
|
|
4282
|
+
/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
|
|
4283
|
+
* long way around when using {@link #alpha} and starting animations on other tracks.
|
|
4284
|
+
*
|
|
4285
|
+
* Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
|
|
4286
|
+
* the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
|
|
4287
|
+
* way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
|
|
4288
|
+
* long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
|
|
3176
4289
|
resetRotationDirections() {
|
|
3177
4290
|
this.timelinesRotation.length = 0;
|
|
3178
4291
|
}
|
|
@@ -3294,15 +4407,15 @@ var spine = (() => {
|
|
|
3294
4407
|
this.objects.length = 0;
|
|
3295
4408
|
}
|
|
3296
4409
|
};
|
|
3297
|
-
var EventType
|
|
3298
|
-
(function(EventType2) {
|
|
4410
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
3299
4411
|
EventType2[EventType2["start"] = 0] = "start";
|
|
3300
4412
|
EventType2[EventType2["interrupt"] = 1] = "interrupt";
|
|
3301
4413
|
EventType2[EventType2["end"] = 2] = "end";
|
|
3302
4414
|
EventType2[EventType2["dispose"] = 3] = "dispose";
|
|
3303
4415
|
EventType2[EventType2["complete"] = 4] = "complete";
|
|
3304
4416
|
EventType2[EventType2["event"] = 5] = "event";
|
|
3305
|
-
|
|
4417
|
+
return EventType2;
|
|
4418
|
+
})(EventType || {});
|
|
3306
4419
|
var AnimationStateAdapter = class {
|
|
3307
4420
|
start(entry) {
|
|
3308
4421
|
}
|
|
@@ -3329,11 +4442,15 @@ var spine = (() => {
|
|
|
3329
4442
|
var AnimationStateData = class {
|
|
3330
4443
|
constructor(skeletonData) {
|
|
3331
4444
|
this.animationToMixTime = {};
|
|
4445
|
+
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
3332
4446
|
this.defaultMix = 0;
|
|
3333
4447
|
if (!skeletonData)
|
|
3334
4448
|
throw new Error("skeletonData cannot be null.");
|
|
3335
4449
|
this.skeletonData = skeletonData;
|
|
3336
4450
|
}
|
|
4451
|
+
/** Sets a mix duration by animation name.
|
|
4452
|
+
*
|
|
4453
|
+
* See {@link #setMixWith()}. */
|
|
3337
4454
|
setMix(fromName, toName, duration) {
|
|
3338
4455
|
let from = this.skeletonData.findAnimation(fromName);
|
|
3339
4456
|
if (!from)
|
|
@@ -3343,6 +4460,9 @@ var spine = (() => {
|
|
|
3343
4460
|
throw new Error("Animation not found: " + toName);
|
|
3344
4461
|
this.setMixWith(from, to, duration);
|
|
3345
4462
|
}
|
|
4463
|
+
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4464
|
+
*
|
|
4465
|
+
* See {@link TrackEntry#mixDuration}. */
|
|
3346
4466
|
setMixWith(from, to, duration) {
|
|
3347
4467
|
if (!from)
|
|
3348
4468
|
throw new Error("from cannot be null.");
|
|
@@ -3351,6 +4471,8 @@ var spine = (() => {
|
|
|
3351
4471
|
let key = from.name + "." + to.name;
|
|
3352
4472
|
this.animationToMixTime[key] = duration;
|
|
3353
4473
|
}
|
|
4474
|
+
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
|
|
4475
|
+
* no mix duration has been set. */
|
|
3354
4476
|
getMix(from, to) {
|
|
3355
4477
|
let key = from.name + "." + to.name;
|
|
3356
4478
|
let value = this.animationToMixTime[key];
|
|
@@ -3374,9 +4496,15 @@ var spine = (() => {
|
|
|
3374
4496
|
|
|
3375
4497
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
3376
4498
|
var ClippingAttachment = class extends VertexAttachment {
|
|
4499
|
+
// ce3a3aff
|
|
3377
4500
|
constructor(name) {
|
|
3378
4501
|
super(name);
|
|
4502
|
+
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4503
|
+
* the skeleton's rendering. */
|
|
3379
4504
|
this.endSlot = null;
|
|
4505
|
+
// Nonessential.
|
|
4506
|
+
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
|
|
4507
|
+
* are not usually rendered at runtime. */
|
|
3380
4508
|
this.color = new Color(0.2275, 0.2275, 0.8078, 1);
|
|
3381
4509
|
}
|
|
3382
4510
|
copy() {
|
|
@@ -3397,8 +4525,7 @@ var spine = (() => {
|
|
|
3397
4525
|
return this._image;
|
|
3398
4526
|
}
|
|
3399
4527
|
};
|
|
3400
|
-
var TextureFilter
|
|
3401
|
-
(function(TextureFilter2) {
|
|
4528
|
+
var TextureFilter = /* @__PURE__ */ ((TextureFilter2) => {
|
|
3402
4529
|
TextureFilter2[TextureFilter2["Nearest"] = 9728] = "Nearest";
|
|
3403
4530
|
TextureFilter2[TextureFilter2["Linear"] = 9729] = "Linear";
|
|
3404
4531
|
TextureFilter2[TextureFilter2["MipMap"] = 9987] = "MipMap";
|
|
@@ -3406,13 +4533,14 @@ var spine = (() => {
|
|
|
3406
4533
|
TextureFilter2[TextureFilter2["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
|
|
3407
4534
|
TextureFilter2[TextureFilter2["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
|
|
3408
4535
|
TextureFilter2[TextureFilter2["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
(
|
|
4536
|
+
return TextureFilter2;
|
|
4537
|
+
})(TextureFilter || {});
|
|
4538
|
+
var TextureWrap = /* @__PURE__ */ ((TextureWrap2) => {
|
|
3412
4539
|
TextureWrap2[TextureWrap2["MirroredRepeat"] = 33648] = "MirroredRepeat";
|
|
3413
4540
|
TextureWrap2[TextureWrap2["ClampToEdge"] = 33071] = "ClampToEdge";
|
|
3414
4541
|
TextureWrap2[TextureWrap2["Repeat"] = 10497] = "Repeat";
|
|
3415
|
-
|
|
4542
|
+
return TextureWrap2;
|
|
4543
|
+
})(TextureWrap || {});
|
|
3416
4544
|
var TextureRegion = class {
|
|
3417
4545
|
constructor() {
|
|
3418
4546
|
this.u = 0;
|
|
@@ -3457,9 +4585,9 @@ var spine = (() => {
|
|
|
3457
4585
|
};
|
|
3458
4586
|
pageFields["repeat"] = (page2) => {
|
|
3459
4587
|
if (entry[1].indexOf("x") != -1)
|
|
3460
|
-
page2.uWrap =
|
|
4588
|
+
page2.uWrap = 10497 /* Repeat */;
|
|
3461
4589
|
if (entry[1].indexOf("y") != -1)
|
|
3462
|
-
page2.vWrap =
|
|
4590
|
+
page2.vWrap = 10497 /* Repeat */;
|
|
3463
4591
|
};
|
|
3464
4592
|
pageFields["pma"] = (page2) => {
|
|
3465
4593
|
page2.pma = entry[1] == "true";
|
|
@@ -3630,10 +4758,10 @@ var spine = (() => {
|
|
|
3630
4758
|
};
|
|
3631
4759
|
var TextureAtlasPage = class {
|
|
3632
4760
|
constructor(name) {
|
|
3633
|
-
this.minFilter =
|
|
3634
|
-
this.magFilter =
|
|
3635
|
-
this.uWrap =
|
|
3636
|
-
this.vWrap =
|
|
4761
|
+
this.minFilter = 9728 /* Nearest */;
|
|
4762
|
+
this.magFilter = 9728 /* Nearest */;
|
|
4763
|
+
this.uWrap = 33071 /* ClampToEdge */;
|
|
4764
|
+
this.vWrap = 33071 /* ClampToEdge */;
|
|
3637
4765
|
this.texture = null;
|
|
3638
4766
|
this.width = 0;
|
|
3639
4767
|
this.height = 0;
|
|
@@ -3669,19 +4797,32 @@ var spine = (() => {
|
|
|
3669
4797
|
constructor(name, path) {
|
|
3670
4798
|
super(name);
|
|
3671
4799
|
this.region = null;
|
|
4800
|
+
/** The UV pair for each vertex, normalized within the texture region. */
|
|
3672
4801
|
this.regionUVs = [];
|
|
4802
|
+
/** The UV pair for each vertex, normalized within the entire texture.
|
|
4803
|
+
*
|
|
4804
|
+
* See {@link #updateUVs}. */
|
|
3673
4805
|
this.uvs = [];
|
|
4806
|
+
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
|
3674
4807
|
this.triangles = [];
|
|
4808
|
+
/** The color to tint the mesh. */
|
|
3675
4809
|
this.color = new Color(1, 1, 1, 1);
|
|
4810
|
+
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
|
3676
4811
|
this.width = 0;
|
|
4812
|
+
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
|
3677
4813
|
this.height = 0;
|
|
4814
|
+
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
|
3678
4815
|
this.hullLength = 0;
|
|
4816
|
+
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
|
|
4817
|
+
* nonessential data was exported. Triangulation is not performed at runtime. */
|
|
3679
4818
|
this.edges = [];
|
|
3680
4819
|
this.parentMesh = null;
|
|
3681
4820
|
this.sequence = null;
|
|
3682
4821
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3683
4822
|
this.path = path;
|
|
3684
4823
|
}
|
|
4824
|
+
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4825
|
+
* the {@link #regionUVs} are changed. */
|
|
3685
4826
|
updateRegion() {
|
|
3686
4827
|
if (!this.region)
|
|
3687
4828
|
throw new Error("Region not set.");
|
|
@@ -3742,9 +4883,13 @@ var spine = (() => {
|
|
|
3742
4883
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
|
3743
4884
|
}
|
|
3744
4885
|
}
|
|
4886
|
+
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
|
|
4887
|
+
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
|
|
4888
|
+
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
|
|
3745
4889
|
getParentMesh() {
|
|
3746
4890
|
return this.parentMesh;
|
|
3747
4891
|
}
|
|
4892
|
+
/** @param parentMesh May be null. */
|
|
3748
4893
|
setParentMesh(parentMesh) {
|
|
3749
4894
|
this.parentMesh = parentMesh;
|
|
3750
4895
|
if (parentMesh) {
|
|
@@ -3785,6 +4930,7 @@ var spine = (() => {
|
|
|
3785
4930
|
this.sequence.apply(slot, this);
|
|
3786
4931
|
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
|
|
3787
4932
|
}
|
|
4933
|
+
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
3788
4934
|
newLinkedMesh() {
|
|
3789
4935
|
let copy = new MeshAttachment(this.name, this.path);
|
|
3790
4936
|
copy.region = this.region;
|
|
@@ -3801,9 +4947,15 @@ var spine = (() => {
|
|
|
3801
4947
|
var PathAttachment = class extends VertexAttachment {
|
|
3802
4948
|
constructor(name) {
|
|
3803
4949
|
super(name);
|
|
4950
|
+
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
3804
4951
|
this.lengths = [];
|
|
4952
|
+
/** If true, the start and end knots are connected. */
|
|
3805
4953
|
this.closed = false;
|
|
4954
|
+
/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
|
|
4955
|
+
* calculations are performed but calculating positions along the path is less accurate. */
|
|
3806
4956
|
this.constantSpeed = false;
|
|
4957
|
+
/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
|
|
4958
|
+
* rendered at runtime. */
|
|
3807
4959
|
this.color = new Color(1, 1, 1, 1);
|
|
3808
4960
|
}
|
|
3809
4961
|
copy() {
|
|
@@ -3825,6 +4977,8 @@ var spine = (() => {
|
|
|
3825
4977
|
this.x = 0;
|
|
3826
4978
|
this.y = 0;
|
|
3827
4979
|
this.rotation = 0;
|
|
4980
|
+
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
|
|
4981
|
+
* are not usually rendered at runtime. */
|
|
3828
4982
|
this.color = new Color(0.38, 0.94, 0, 1);
|
|
3829
4983
|
}
|
|
3830
4984
|
computeWorldPosition(bone, point) {
|
|
@@ -3852,22 +5006,34 @@ var spine = (() => {
|
|
|
3852
5006
|
var _RegionAttachment = class extends Attachment {
|
|
3853
5007
|
constructor(name, path) {
|
|
3854
5008
|
super(name);
|
|
5009
|
+
/** The local x translation. */
|
|
3855
5010
|
this.x = 0;
|
|
5011
|
+
/** The local y translation. */
|
|
3856
5012
|
this.y = 0;
|
|
5013
|
+
/** The local scaleX. */
|
|
3857
5014
|
this.scaleX = 1;
|
|
5015
|
+
/** The local scaleY. */
|
|
3858
5016
|
this.scaleY = 1;
|
|
5017
|
+
/** The local rotation. */
|
|
3859
5018
|
this.rotation = 0;
|
|
5019
|
+
/** The width of the region attachment in Spine. */
|
|
3860
5020
|
this.width = 0;
|
|
5021
|
+
/** The height of the region attachment in Spine. */
|
|
3861
5022
|
this.height = 0;
|
|
5023
|
+
/** The color to tint the region attachment. */
|
|
3862
5024
|
this.color = new Color(1, 1, 1, 1);
|
|
3863
5025
|
this.rendererObject = null;
|
|
3864
5026
|
this.region = null;
|
|
3865
5027
|
this.sequence = null;
|
|
5028
|
+
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
|
|
5029
|
+
*
|
|
5030
|
+
* See {@link #updateOffset()}. */
|
|
3866
5031
|
this.offset = Utils.newFloatArray(8);
|
|
3867
5032
|
this.uvs = Utils.newFloatArray(8);
|
|
3868
5033
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3869
5034
|
this.path = path;
|
|
3870
5035
|
}
|
|
5036
|
+
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
3871
5037
|
updateRegion() {
|
|
3872
5038
|
if (!this.region)
|
|
3873
5039
|
throw new Error("Region not set.");
|
|
@@ -3931,6 +5097,14 @@ var spine = (() => {
|
|
|
3931
5097
|
uvs[7] = region.v2;
|
|
3932
5098
|
}
|
|
3933
5099
|
}
|
|
5100
|
+
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
|
|
5101
|
+
* be changed.
|
|
5102
|
+
* <p>
|
|
5103
|
+
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
|
5104
|
+
* Runtimes Guide.
|
|
5105
|
+
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
|
|
5106
|
+
* @param offset The <code>worldVertices</code> index to begin writing values.
|
|
5107
|
+
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
|
|
3934
5108
|
computeWorldVertices(slot, worldVertices, offset, stride) {
|
|
3935
5109
|
if (this.sequence != null)
|
|
3936
5110
|
this.sequence.apply(slot, this);
|
|
@@ -4070,18 +5244,34 @@ var spine = (() => {
|
|
|
4070
5244
|
// spine-core/src/BoneData.ts
|
|
4071
5245
|
var BoneData = class {
|
|
4072
5246
|
constructor(index, name, parent) {
|
|
5247
|
+
/** The index of the bone in {@link Skeleton#getBones()}. */
|
|
4073
5248
|
this.index = 0;
|
|
5249
|
+
/** @returns May be null. */
|
|
4074
5250
|
this.parent = null;
|
|
5251
|
+
/** The bone's length. */
|
|
4075
5252
|
this.length = 0;
|
|
5253
|
+
/** The local x translation. */
|
|
4076
5254
|
this.x = 0;
|
|
5255
|
+
/** The local y translation. */
|
|
4077
5256
|
this.y = 0;
|
|
5257
|
+
/** The local rotation. */
|
|
4078
5258
|
this.rotation = 0;
|
|
5259
|
+
/** The local scaleX. */
|
|
4079
5260
|
this.scaleX = 1;
|
|
5261
|
+
/** The local scaleY. */
|
|
4080
5262
|
this.scaleY = 1;
|
|
5263
|
+
/** The local shearX. */
|
|
4081
5264
|
this.shearX = 0;
|
|
5265
|
+
/** The local shearX. */
|
|
4082
5266
|
this.shearY = 0;
|
|
5267
|
+
/** The transform mode for how parent world transforms affect this bone. */
|
|
4083
5268
|
this.transformMode = TransformMode.Normal;
|
|
5269
|
+
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5270
|
+
* bone.
|
|
5271
|
+
* @see Skin#bones */
|
|
4084
5272
|
this.skinRequired = false;
|
|
5273
|
+
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
|
|
5274
|
+
* rendered at runtime. */
|
|
4085
5275
|
this.color = new Color();
|
|
4086
5276
|
if (index < 0)
|
|
4087
5277
|
throw new Error("index must be >= 0.");
|
|
@@ -4092,39 +5282,62 @@ var spine = (() => {
|
|
|
4092
5282
|
this.parent = parent;
|
|
4093
5283
|
}
|
|
4094
5284
|
};
|
|
4095
|
-
var TransformMode
|
|
4096
|
-
(function(TransformMode2) {
|
|
5285
|
+
var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
|
|
4097
5286
|
TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
|
|
4098
5287
|
TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
|
|
4099
5288
|
TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
|
|
4100
5289
|
TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
|
|
4101
5290
|
TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
|
|
4102
|
-
|
|
5291
|
+
return TransformMode2;
|
|
5292
|
+
})(TransformMode || {});
|
|
4103
5293
|
|
|
4104
5294
|
// spine-core/src/Bone.ts
|
|
4105
5295
|
var Bone = class {
|
|
5296
|
+
/** @param parent May be null. */
|
|
4106
5297
|
constructor(data, skeleton, parent) {
|
|
5298
|
+
/** The parent bone, or null if this is the root bone. */
|
|
4107
5299
|
this.parent = null;
|
|
5300
|
+
/** The immediate children of this bone. */
|
|
4108
5301
|
this.children = new Array();
|
|
5302
|
+
/** The local x translation. */
|
|
4109
5303
|
this.x = 0;
|
|
5304
|
+
/** The local y translation. */
|
|
4110
5305
|
this.y = 0;
|
|
5306
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
4111
5307
|
this.rotation = 0;
|
|
5308
|
+
/** The local scaleX. */
|
|
4112
5309
|
this.scaleX = 0;
|
|
5310
|
+
/** The local scaleY. */
|
|
4113
5311
|
this.scaleY = 0;
|
|
5312
|
+
/** The local shearX. */
|
|
4114
5313
|
this.shearX = 0;
|
|
5314
|
+
/** The local shearY. */
|
|
4115
5315
|
this.shearY = 0;
|
|
5316
|
+
/** The applied local x translation. */
|
|
4116
5317
|
this.ax = 0;
|
|
5318
|
+
/** The applied local y translation. */
|
|
4117
5319
|
this.ay = 0;
|
|
5320
|
+
/** The applied local rotation in degrees, counter clockwise. */
|
|
4118
5321
|
this.arotation = 0;
|
|
5322
|
+
/** The applied local scaleX. */
|
|
4119
5323
|
this.ascaleX = 0;
|
|
5324
|
+
/** The applied local scaleY. */
|
|
4120
5325
|
this.ascaleY = 0;
|
|
5326
|
+
/** The applied local shearX. */
|
|
4121
5327
|
this.ashearX = 0;
|
|
5328
|
+
/** The applied local shearY. */
|
|
4122
5329
|
this.ashearY = 0;
|
|
5330
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4123
5331
|
this.a = 0;
|
|
5332
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4124
5333
|
this.b = 0;
|
|
5334
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4125
5335
|
this.c = 0;
|
|
5336
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4126
5337
|
this.d = 0;
|
|
5338
|
+
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4127
5339
|
this.worldY = 0;
|
|
5340
|
+
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4128
5341
|
this.worldX = 0;
|
|
4129
5342
|
this.sorted = false;
|
|
4130
5343
|
this.active = false;
|
|
@@ -4137,15 +5350,26 @@ var spine = (() => {
|
|
|
4137
5350
|
this.parent = parent;
|
|
4138
5351
|
this.setToSetupPose();
|
|
4139
5352
|
}
|
|
5353
|
+
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
|
|
5354
|
+
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
|
|
4140
5355
|
isActive() {
|
|
4141
5356
|
return this.active;
|
|
4142
5357
|
}
|
|
5358
|
+
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
4143
5359
|
update() {
|
|
4144
5360
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
4145
5361
|
}
|
|
5362
|
+
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
5363
|
+
*
|
|
5364
|
+
* See {@link #updateWorldTransformWith()}. */
|
|
4146
5365
|
updateWorldTransform() {
|
|
4147
5366
|
this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
|
|
4148
5367
|
}
|
|
5368
|
+
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
|
|
5369
|
+
* specified local transform. Child bones are not updated.
|
|
5370
|
+
*
|
|
5371
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
5372
|
+
* Runtimes Guide. */
|
|
4149
5373
|
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
|
|
4150
5374
|
this.ax = x;
|
|
4151
5375
|
this.ay = y;
|
|
@@ -4172,7 +5396,7 @@ var spine = (() => {
|
|
|
4172
5396
|
this.worldX = pa * x + pb * y + parent.worldX;
|
|
4173
5397
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
4174
5398
|
switch (this.data.transformMode) {
|
|
4175
|
-
case
|
|
5399
|
+
case 0 /* Normal */: {
|
|
4176
5400
|
let rotationY = rotation + 90 + shearY;
|
|
4177
5401
|
let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4178
5402
|
let lb = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4184,7 +5408,7 @@ var spine = (() => {
|
|
|
4184
5408
|
this.d = pc * lb + pd * ld;
|
|
4185
5409
|
return;
|
|
4186
5410
|
}
|
|
4187
|
-
case
|
|
5411
|
+
case 1 /* OnlyTranslation */: {
|
|
4188
5412
|
let rotationY = rotation + 90 + shearY;
|
|
4189
5413
|
this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4190
5414
|
this.b = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4192,7 +5416,7 @@ var spine = (() => {
|
|
|
4192
5416
|
this.d = MathUtils.sinDeg(rotationY) * scaleY;
|
|
4193
5417
|
break;
|
|
4194
5418
|
}
|
|
4195
|
-
case
|
|
5419
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4196
5420
|
let s = pa * pa + pc * pc;
|
|
4197
5421
|
let prx = 0;
|
|
4198
5422
|
if (s > 1e-4) {
|
|
@@ -4219,8 +5443,8 @@ var spine = (() => {
|
|
|
4219
5443
|
this.d = pc * lb + pd * ld;
|
|
4220
5444
|
break;
|
|
4221
5445
|
}
|
|
4222
|
-
case
|
|
4223
|
-
case
|
|
5446
|
+
case 3 /* NoScale */:
|
|
5447
|
+
case 4 /* NoScaleOrReflection */: {
|
|
4224
5448
|
let cos = MathUtils.cosDeg(rotation);
|
|
4225
5449
|
let sin = MathUtils.sinDeg(rotation);
|
|
4226
5450
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
@@ -4231,7 +5455,7 @@ var spine = (() => {
|
|
|
4231
5455
|
za *= s;
|
|
4232
5456
|
zc *= s;
|
|
4233
5457
|
s = Math.sqrt(za * za + zc * zc);
|
|
4234
|
-
if (this.data.transformMode ==
|
|
5458
|
+
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4235
5459
|
s = -s;
|
|
4236
5460
|
let r = Math.PI / 2 + Math.atan2(zc, za);
|
|
4237
5461
|
let zb = Math.cos(r) * s;
|
|
@@ -4252,6 +5476,7 @@ var spine = (() => {
|
|
|
4252
5476
|
this.c *= this.skeleton.scaleY;
|
|
4253
5477
|
this.d *= this.skeleton.scaleY;
|
|
4254
5478
|
}
|
|
5479
|
+
/** Sets this bone's local transform to the setup pose. */
|
|
4255
5480
|
setToSetupPose() {
|
|
4256
5481
|
let data = this.data;
|
|
4257
5482
|
this.x = data.x;
|
|
@@ -4262,18 +5487,30 @@ var spine = (() => {
|
|
|
4262
5487
|
this.shearX = data.shearX;
|
|
4263
5488
|
this.shearY = data.shearY;
|
|
4264
5489
|
}
|
|
5490
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
4265
5491
|
getWorldRotationX() {
|
|
4266
5492
|
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
4267
5493
|
}
|
|
5494
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
4268
5495
|
getWorldRotationY() {
|
|
4269
5496
|
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
4270
5497
|
}
|
|
5498
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
4271
5499
|
getWorldScaleX() {
|
|
4272
5500
|
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
4273
5501
|
}
|
|
5502
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
4274
5503
|
getWorldScaleY() {
|
|
4275
5504
|
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
4276
5505
|
}
|
|
5506
|
+
/** Computes the applied transform values from the world transform.
|
|
5507
|
+
*
|
|
5508
|
+
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
5509
|
+
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
|
|
5510
|
+
* constraints).
|
|
5511
|
+
*
|
|
5512
|
+
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
|
|
5513
|
+
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
|
|
4277
5514
|
updateAppliedTransform() {
|
|
4278
5515
|
let parent = this.parent;
|
|
4279
5516
|
if (!parent) {
|
|
@@ -4313,6 +5550,7 @@ var spine = (() => {
|
|
|
4313
5550
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
4314
5551
|
}
|
|
4315
5552
|
}
|
|
5553
|
+
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
4316
5554
|
worldToLocal(world) {
|
|
4317
5555
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
4318
5556
|
let x = world.x - this.worldX, y = world.y - this.worldY;
|
|
@@ -4320,21 +5558,28 @@ var spine = (() => {
|
|
|
4320
5558
|
world.y = y * this.a * invDet - x * this.c * invDet;
|
|
4321
5559
|
return world;
|
|
4322
5560
|
}
|
|
5561
|
+
/** Transforms a point from the bone's local coordinates to world coordinates. */
|
|
4323
5562
|
localToWorld(local) {
|
|
4324
5563
|
let x = local.x, y = local.y;
|
|
4325
5564
|
local.x = x * this.a + y * this.b + this.worldX;
|
|
4326
5565
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
4327
5566
|
return local;
|
|
4328
5567
|
}
|
|
5568
|
+
/** Transforms a world rotation to a local rotation. */
|
|
4329
5569
|
worldToLocalRotation(worldRotation) {
|
|
4330
5570
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
4331
5571
|
return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
|
|
4332
5572
|
}
|
|
5573
|
+
/** Transforms a local rotation to a world rotation. */
|
|
4333
5574
|
localToWorldRotation(localRotation) {
|
|
4334
5575
|
localRotation -= this.rotation - this.shearX;
|
|
4335
5576
|
let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
|
|
4336
5577
|
return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
|
|
4337
5578
|
}
|
|
5579
|
+
/** Rotates the world transform the specified amount.
|
|
5580
|
+
* <p>
|
|
5581
|
+
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
|
|
5582
|
+
* need to be called on any child bones, recursively. */
|
|
4338
5583
|
rotateWorld(degrees) {
|
|
4339
5584
|
let a = this.a, b = this.b, c = this.c, d = this.d;
|
|
4340
5585
|
let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
|
|
@@ -4476,17 +5721,21 @@ var spine = (() => {
|
|
|
4476
5721
|
let atlas = new TextureAtlas(atlasText);
|
|
4477
5722
|
let toLoad = atlas.pages.length, abort = false;
|
|
4478
5723
|
for (let page of atlas.pages) {
|
|
4479
|
-
this.loadTexture(
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
if (
|
|
4483
|
-
|
|
5724
|
+
this.loadTexture(
|
|
5725
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5726
|
+
(imagePath, texture) => {
|
|
5727
|
+
if (!abort) {
|
|
5728
|
+
page.setTexture(texture);
|
|
5729
|
+
if (--toLoad == 0)
|
|
5730
|
+
this.success(success, path, atlas);
|
|
5731
|
+
}
|
|
5732
|
+
},
|
|
5733
|
+
(imagePath, message) => {
|
|
5734
|
+
if (!abort)
|
|
5735
|
+
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
5736
|
+
abort = true;
|
|
4484
5737
|
}
|
|
4485
|
-
|
|
4486
|
-
if (!abort)
|
|
4487
|
-
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
4488
|
-
abort = true;
|
|
4489
|
-
});
|
|
5738
|
+
);
|
|
4490
5739
|
}
|
|
4491
5740
|
} catch (e) {
|
|
4492
5741
|
this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
|
|
@@ -4682,10 +5931,16 @@ var spine = (() => {
|
|
|
4682
5931
|
// spine-core/src/IkConstraint.ts
|
|
4683
5932
|
var IkConstraint = class {
|
|
4684
5933
|
constructor(data, skeleton) {
|
|
5934
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4685
5935
|
this.bendDirection = 0;
|
|
5936
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4686
5937
|
this.compress = false;
|
|
5938
|
+
/** 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
|
|
5939
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4687
5940
|
this.stretch = false;
|
|
5941
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4688
5942
|
this.mix = 1;
|
|
5943
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4689
5944
|
this.softness = 0;
|
|
4690
5945
|
this.active = false;
|
|
4691
5946
|
if (!data)
|
|
@@ -4727,6 +5982,7 @@ var spine = (() => {
|
|
|
4727
5982
|
break;
|
|
4728
5983
|
}
|
|
4729
5984
|
}
|
|
5985
|
+
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
4730
5986
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4731
5987
|
let p = bone.parent;
|
|
4732
5988
|
if (!p)
|
|
@@ -4734,11 +5990,11 @@ var spine = (() => {
|
|
|
4734
5990
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4735
5991
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4736
5992
|
switch (bone.data.transformMode) {
|
|
4737
|
-
case
|
|
5993
|
+
case 1 /* OnlyTranslation */:
|
|
4738
5994
|
tx = targetX - bone.worldX;
|
|
4739
5995
|
ty = targetY - bone.worldY;
|
|
4740
5996
|
break;
|
|
4741
|
-
case
|
|
5997
|
+
case 2 /* NoRotationOrReflection */:
|
|
4742
5998
|
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4743
5999
|
let sa = pa / bone.skeleton.scaleX;
|
|
4744
6000
|
let sc = pc / bone.skeleton.scaleY;
|
|
@@ -4761,8 +6017,8 @@ var spine = (() => {
|
|
|
4761
6017
|
let sx = bone.ascaleX, sy = bone.ascaleY;
|
|
4762
6018
|
if (compress || stretch) {
|
|
4763
6019
|
switch (bone.data.transformMode) {
|
|
4764
|
-
case
|
|
4765
|
-
case
|
|
6020
|
+
case 3 /* NoScale */:
|
|
6021
|
+
case 4 /* NoScaleOrReflection */:
|
|
4766
6022
|
tx = targetX - bone.worldX;
|
|
4767
6023
|
ty = targetY - bone.worldY;
|
|
4768
6024
|
}
|
|
@@ -4774,8 +6030,18 @@ var spine = (() => {
|
|
|
4774
6030
|
sy *= s;
|
|
4775
6031
|
}
|
|
4776
6032
|
}
|
|
4777
|
-
bone.updateWorldTransformWith(
|
|
6033
|
+
bone.updateWorldTransformWith(
|
|
6034
|
+
bone.ax,
|
|
6035
|
+
bone.ay,
|
|
6036
|
+
bone.arotation + rotationIK * alpha,
|
|
6037
|
+
sx,
|
|
6038
|
+
sy,
|
|
6039
|
+
bone.ashearX,
|
|
6040
|
+
bone.ashearY
|
|
6041
|
+
);
|
|
4778
6042
|
}
|
|
6043
|
+
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6044
|
+
* @param child A direct descendant of the parent bone. */
|
|
4779
6045
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
4780
6046
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
4781
6047
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
@@ -4930,13 +6196,23 @@ var spine = (() => {
|
|
|
4930
6196
|
var IkConstraintData = class extends ConstraintData {
|
|
4931
6197
|
constructor(name) {
|
|
4932
6198
|
super(name, 0, false);
|
|
6199
|
+
/** The bones that are constrained by this IK constraint. */
|
|
4933
6200
|
this.bones = new Array();
|
|
6201
|
+
/** The bone that is the IK target. */
|
|
4934
6202
|
this._target = null;
|
|
6203
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4935
6204
|
this.bendDirection = 1;
|
|
6205
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4936
6206
|
this.compress = false;
|
|
6207
|
+
/** 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
|
|
6208
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4937
6209
|
this.stretch = false;
|
|
6210
|
+
/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
|
|
6211
|
+
* is scaled on both the X and Y axes. */
|
|
4938
6212
|
this.uniform = false;
|
|
6213
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4939
6214
|
this.mix = 1;
|
|
6215
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4940
6216
|
this.softness = 0;
|
|
4941
6217
|
}
|
|
4942
6218
|
set target(boneData) {
|
|
@@ -4954,13 +6230,21 @@ var spine = (() => {
|
|
|
4954
6230
|
var PathConstraintData = class extends ConstraintData {
|
|
4955
6231
|
constructor(name) {
|
|
4956
6232
|
super(name, 0, false);
|
|
6233
|
+
/** The bones that will be modified by this path constraint. */
|
|
4957
6234
|
this.bones = new Array();
|
|
6235
|
+
/** The slot whose path attachment will be used to constrained the bones. */
|
|
4958
6236
|
this._target = null;
|
|
6237
|
+
/** The mode for positioning the first bone on the path. */
|
|
4959
6238
|
this.positionMode = PositionMode.Fixed;
|
|
6239
|
+
/** The mode for positioning the bones after the first bone on the path. */
|
|
4960
6240
|
this.spacingMode = SpacingMode.Fixed;
|
|
6241
|
+
/** The mode for adjusting the rotation of the bones. */
|
|
4961
6242
|
this.rotateMode = RotateMode.Chain;
|
|
6243
|
+
/** An offset added to the constrained bone rotation. */
|
|
4962
6244
|
this.offsetRotation = 0;
|
|
6245
|
+
/** The position along the path. */
|
|
4963
6246
|
this.position = 0;
|
|
6247
|
+
/** The spacing between bones. */
|
|
4964
6248
|
this.spacing = 0;
|
|
4965
6249
|
this.mixRotate = 0;
|
|
4966
6250
|
this.mixX = 0;
|
|
@@ -4976,29 +6260,31 @@ var spine = (() => {
|
|
|
4976
6260
|
return this._target;
|
|
4977
6261
|
}
|
|
4978
6262
|
};
|
|
4979
|
-
var PositionMode
|
|
4980
|
-
(function(PositionMode2) {
|
|
6263
|
+
var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
|
|
4981
6264
|
PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
|
|
4982
6265
|
PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
(
|
|
6266
|
+
return PositionMode2;
|
|
6267
|
+
})(PositionMode || {});
|
|
6268
|
+
var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
|
|
4986
6269
|
SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
|
|
4987
6270
|
SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
|
|
4988
6271
|
SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
|
|
4989
6272
|
SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
(
|
|
6273
|
+
return SpacingMode2;
|
|
6274
|
+
})(SpacingMode || {});
|
|
6275
|
+
var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
4993
6276
|
RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
|
|
4994
6277
|
RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
|
|
4995
6278
|
RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
|
|
4996
|
-
|
|
6279
|
+
return RotateMode2;
|
|
6280
|
+
})(RotateMode || {});
|
|
4997
6281
|
|
|
4998
6282
|
// spine-core/src/PathConstraint.ts
|
|
4999
6283
|
var _PathConstraint = class {
|
|
5000
6284
|
constructor(data, skeleton) {
|
|
6285
|
+
/** The position along the path. */
|
|
5001
6286
|
this.position = 0;
|
|
6287
|
+
/** The spacing between bones. */
|
|
5002
6288
|
this.spacing = 0;
|
|
5003
6289
|
this.mixRotate = 0;
|
|
5004
6290
|
this.mixX = 0;
|
|
@@ -5043,13 +6329,13 @@ var spine = (() => {
|
|
|
5043
6329
|
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
5044
6330
|
return;
|
|
5045
6331
|
let data = this.data;
|
|
5046
|
-
let tangents = data.rotateMode ==
|
|
6332
|
+
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
5047
6333
|
let bones = this.bones;
|
|
5048
6334
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5049
6335
|
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5050
6336
|
let spacing = this.spacing;
|
|
5051
6337
|
switch (data.spacingMode) {
|
|
5052
|
-
case
|
|
6338
|
+
case 2 /* Percent */:
|
|
5053
6339
|
if (scale) {
|
|
5054
6340
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
5055
6341
|
let bone = bones[i];
|
|
@@ -5064,7 +6350,7 @@ var spine = (() => {
|
|
|
5064
6350
|
}
|
|
5065
6351
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
5066
6352
|
break;
|
|
5067
|
-
case
|
|
6353
|
+
case 3 /* Proportional */:
|
|
5068
6354
|
let sum = 0;
|
|
5069
6355
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5070
6356
|
let bone = bones[i];
|
|
@@ -5089,7 +6375,7 @@ var spine = (() => {
|
|
|
5089
6375
|
}
|
|
5090
6376
|
break;
|
|
5091
6377
|
default:
|
|
5092
|
-
let lengthSpacing = data.spacingMode ==
|
|
6378
|
+
let lengthSpacing = data.spacingMode == 0 /* Length */;
|
|
5093
6379
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5094
6380
|
let bone = bones[i];
|
|
5095
6381
|
let setupLength = bone.data.length;
|
|
@@ -5110,7 +6396,7 @@ var spine = (() => {
|
|
|
5110
6396
|
let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
|
|
5111
6397
|
let tip = false;
|
|
5112
6398
|
if (offsetRotation == 0)
|
|
5113
|
-
tip = data.rotateMode ==
|
|
6399
|
+
tip = data.rotateMode == 1 /* Chain */;
|
|
5114
6400
|
else {
|
|
5115
6401
|
tip = false;
|
|
5116
6402
|
let p = this.target.bone;
|
|
@@ -5174,14 +6460,14 @@ var spine = (() => {
|
|
|
5174
6460
|
let lengths = path.lengths;
|
|
5175
6461
|
curveCount -= closed2 ? 1 : 2;
|
|
5176
6462
|
let pathLength2 = lengths[curveCount];
|
|
5177
|
-
if (this.data.positionMode ==
|
|
6463
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5178
6464
|
position *= pathLength2;
|
|
5179
6465
|
let multiplier2;
|
|
5180
6466
|
switch (this.data.spacingMode) {
|
|
5181
|
-
case
|
|
6467
|
+
case 2 /* Percent */:
|
|
5182
6468
|
multiplier2 = pathLength2;
|
|
5183
6469
|
break;
|
|
5184
|
-
case
|
|
6470
|
+
case 3 /* Proportional */:
|
|
5185
6471
|
multiplier2 = pathLength2 / spacesCount;
|
|
5186
6472
|
break;
|
|
5187
6473
|
default:
|
|
@@ -5232,7 +6518,20 @@ var spine = (() => {
|
|
|
5232
6518
|
} else
|
|
5233
6519
|
path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
|
|
5234
6520
|
}
|
|
5235
|
-
this.addCurvePosition(
|
|
6521
|
+
this.addCurvePosition(
|
|
6522
|
+
p,
|
|
6523
|
+
world[0],
|
|
6524
|
+
world[1],
|
|
6525
|
+
world[2],
|
|
6526
|
+
world[3],
|
|
6527
|
+
world[4],
|
|
6528
|
+
world[5],
|
|
6529
|
+
world[6],
|
|
6530
|
+
world[7],
|
|
6531
|
+
out,
|
|
6532
|
+
o,
|
|
6533
|
+
tangents || i > 0 && space == 0
|
|
6534
|
+
);
|
|
5236
6535
|
}
|
|
5237
6536
|
return out;
|
|
5238
6537
|
}
|
|
@@ -5284,14 +6583,14 @@ var spine = (() => {
|
|
|
5284
6583
|
x1 = x2;
|
|
5285
6584
|
y1 = y2;
|
|
5286
6585
|
}
|
|
5287
|
-
if (this.data.positionMode ==
|
|
6586
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5288
6587
|
position *= pathLength;
|
|
5289
6588
|
let multiplier;
|
|
5290
6589
|
switch (this.data.spacingMode) {
|
|
5291
|
-
case
|
|
6590
|
+
case 2 /* Percent */:
|
|
5292
6591
|
multiplier = pathLength;
|
|
5293
6592
|
break;
|
|
5294
|
-
case
|
|
6593
|
+
case 3 /* Proportional */:
|
|
5295
6594
|
multiplier = pathLength / spacesCount;
|
|
5296
6595
|
break;
|
|
5297
6596
|
default:
|
|
@@ -5424,10 +6723,18 @@ var spine = (() => {
|
|
|
5424
6723
|
// spine-core/src/Slot.ts
|
|
5425
6724
|
var Slot = class {
|
|
5426
6725
|
constructor(data, bone) {
|
|
6726
|
+
/** 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
|
|
6727
|
+
* color's alpha is not used. */
|
|
5427
6728
|
this.darkColor = null;
|
|
5428
6729
|
this.attachment = null;
|
|
5429
6730
|
this.attachmentState = 0;
|
|
6731
|
+
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
|
|
6732
|
+
* {@link Sequence#getSetupIndex()}. */
|
|
5430
6733
|
this.sequenceIndex = -1;
|
|
6734
|
+
/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
|
|
6735
|
+
* weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
|
|
6736
|
+
*
|
|
6737
|
+
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
5431
6738
|
this.deform = new Array();
|
|
5432
6739
|
if (!data)
|
|
5433
6740
|
throw new Error("data cannot be null.");
|
|
@@ -5439,12 +6746,17 @@ var spine = (() => {
|
|
|
5439
6746
|
this.darkColor = !data.darkColor ? null : new Color();
|
|
5440
6747
|
this.setToSetupPose();
|
|
5441
6748
|
}
|
|
6749
|
+
/** The skeleton this slot belongs to. */
|
|
5442
6750
|
getSkeleton() {
|
|
5443
6751
|
return this.bone.skeleton;
|
|
5444
6752
|
}
|
|
6753
|
+
/** The current attachment for the slot, or null if the slot has no attachment. */
|
|
5445
6754
|
getAttachment() {
|
|
5446
6755
|
return this.attachment;
|
|
5447
6756
|
}
|
|
6757
|
+
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
|
|
6758
|
+
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
6759
|
+
* specified attachment. */
|
|
5448
6760
|
setAttachment(attachment) {
|
|
5449
6761
|
if (this.attachment == attachment)
|
|
5450
6762
|
return;
|
|
@@ -5454,6 +6766,7 @@ var spine = (() => {
|
|
|
5454
6766
|
this.attachment = attachment;
|
|
5455
6767
|
this.sequenceIndex = -1;
|
|
5456
6768
|
}
|
|
6769
|
+
/** Sets this slot to the setup pose. */
|
|
5457
6770
|
setToSetupPose() {
|
|
5458
6771
|
this.color.setFromColor(this.data.color);
|
|
5459
6772
|
if (this.darkColor)
|
|
@@ -5505,7 +6818,7 @@ var spine = (() => {
|
|
|
5505
6818
|
return this.active;
|
|
5506
6819
|
}
|
|
5507
6820
|
update() {
|
|
5508
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.
|
|
6821
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
5509
6822
|
return;
|
|
5510
6823
|
if (this.data.local) {
|
|
5511
6824
|
if (this.data.relative)
|
|
@@ -5682,13 +6995,21 @@ var spine = (() => {
|
|
|
5682
6995
|
};
|
|
5683
6996
|
|
|
5684
6997
|
// spine-core/src/Skeleton.ts
|
|
5685
|
-
var
|
|
6998
|
+
var _Skeleton = class {
|
|
5686
6999
|
constructor(data) {
|
|
7000
|
+
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
5687
7001
|
this._updateCache = new Array();
|
|
7002
|
+
/** The skeleton's current skin. May be null. */
|
|
5688
7003
|
this.skin = null;
|
|
7004
|
+
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7005
|
+
* inheritance. */
|
|
5689
7006
|
this.scaleX = 1;
|
|
5690
|
-
|
|
7007
|
+
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7008
|
+
* inheritance. */
|
|
7009
|
+
this._scaleY = 1;
|
|
7010
|
+
/** Sets the skeleton X position, which is added to the root bone worldX position. */
|
|
5691
7011
|
this.x = 0;
|
|
7012
|
+
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
5692
7013
|
this.y = 0;
|
|
5693
7014
|
if (!data)
|
|
5694
7015
|
throw new Error("data cannot be null.");
|
|
@@ -5733,6 +7054,14 @@ var spine = (() => {
|
|
|
5733
7054
|
this.color = new Color(1, 1, 1, 1);
|
|
5734
7055
|
this.updateCache();
|
|
5735
7056
|
}
|
|
7057
|
+
get scaleY() {
|
|
7058
|
+
return _Skeleton.yDown ? -this._scaleY : this._scaleY;
|
|
7059
|
+
}
|
|
7060
|
+
set scaleY(scaleY) {
|
|
7061
|
+
this._scaleY = scaleY;
|
|
7062
|
+
}
|
|
7063
|
+
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
|
|
7064
|
+
* constraints, or weighted path attachments are added or removed. */
|
|
5736
7065
|
updateCache() {
|
|
5737
7066
|
let updateCache = this._updateCache;
|
|
5738
7067
|
updateCache.length = 0;
|
|
@@ -5900,6 +7229,10 @@ var spine = (() => {
|
|
|
5900
7229
|
bone.sorted = false;
|
|
5901
7230
|
}
|
|
5902
7231
|
}
|
|
7232
|
+
/** Updates the world transform for each bone and applies all constraints.
|
|
7233
|
+
*
|
|
7234
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7235
|
+
* Runtimes Guide. */
|
|
5903
7236
|
updateWorldTransform() {
|
|
5904
7237
|
let bones = this.bones;
|
|
5905
7238
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
@@ -5939,10 +7272,12 @@ var spine = (() => {
|
|
|
5939
7272
|
updatable.update();
|
|
5940
7273
|
}
|
|
5941
7274
|
}
|
|
7275
|
+
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
5942
7276
|
setToSetupPose() {
|
|
5943
7277
|
this.setBonesToSetupPose();
|
|
5944
7278
|
this.setSlotsToSetupPose();
|
|
5945
7279
|
}
|
|
7280
|
+
/** Sets the bones and constraints to their setup pose values. */
|
|
5946
7281
|
setBonesToSetupPose() {
|
|
5947
7282
|
let bones = this.bones;
|
|
5948
7283
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
@@ -5978,17 +7313,20 @@ var spine = (() => {
|
|
|
5978
7313
|
constraint.mixY = data.mixY;
|
|
5979
7314
|
}
|
|
5980
7315
|
}
|
|
7316
|
+
/** Sets the slots and draw order to their setup pose values. */
|
|
5981
7317
|
setSlotsToSetupPose() {
|
|
5982
7318
|
let slots = this.slots;
|
|
5983
7319
|
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
|
|
5984
7320
|
for (let i = 0, n = slots.length; i < n; i++)
|
|
5985
7321
|
slots[i].setToSetupPose();
|
|
5986
7322
|
}
|
|
7323
|
+
/** @returns May return null. */
|
|
5987
7324
|
getRootBone() {
|
|
5988
7325
|
if (this.bones.length == 0)
|
|
5989
7326
|
return null;
|
|
5990
7327
|
return this.bones[0];
|
|
5991
7328
|
}
|
|
7329
|
+
/** @returns May be null. */
|
|
5992
7330
|
findBone(boneName) {
|
|
5993
7331
|
if (!boneName)
|
|
5994
7332
|
throw new Error("boneName cannot be null.");
|
|
@@ -6000,6 +7338,9 @@ var spine = (() => {
|
|
|
6000
7338
|
}
|
|
6001
7339
|
return null;
|
|
6002
7340
|
}
|
|
7341
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7342
|
+
* repeatedly.
|
|
7343
|
+
* @returns May be null. */
|
|
6003
7344
|
findSlot(slotName) {
|
|
6004
7345
|
if (!slotName)
|
|
6005
7346
|
throw new Error("slotName cannot be null.");
|
|
@@ -6011,12 +7352,25 @@ var spine = (() => {
|
|
|
6011
7352
|
}
|
|
6012
7353
|
return null;
|
|
6013
7354
|
}
|
|
7355
|
+
/** Sets a skin by name.
|
|
7356
|
+
*
|
|
7357
|
+
* See {@link #setSkin()}. */
|
|
6014
7358
|
setSkinByName(skinName) {
|
|
6015
7359
|
let skin = this.data.findSkin(skinName);
|
|
6016
7360
|
if (!skin)
|
|
6017
7361
|
throw new Error("Skin not found: " + skinName);
|
|
6018
7362
|
this.setSkin(skin);
|
|
6019
7363
|
}
|
|
7364
|
+
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
7365
|
+
* skin is changed, {@link #updateCache()} is called.
|
|
7366
|
+
*
|
|
7367
|
+
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
|
|
7368
|
+
* old skin, each slot's setup mode attachment is attached from the new skin.
|
|
7369
|
+
*
|
|
7370
|
+
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
|
|
7371
|
+
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
|
|
7372
|
+
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7373
|
+
* @param newSkin May be null. */
|
|
6020
7374
|
setSkin(newSkin) {
|
|
6021
7375
|
if (newSkin == this.skin)
|
|
6022
7376
|
return;
|
|
@@ -6039,12 +7393,22 @@ var spine = (() => {
|
|
|
6039
7393
|
this.skin = newSkin;
|
|
6040
7394
|
this.updateCache();
|
|
6041
7395
|
}
|
|
7396
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
|
|
7397
|
+
* name.
|
|
7398
|
+
*
|
|
7399
|
+
* See {@link #getAttachment()}.
|
|
7400
|
+
* @returns May be null. */
|
|
6042
7401
|
getAttachmentByName(slotName, attachmentName) {
|
|
6043
7402
|
let slot = this.data.findSlot(slotName);
|
|
6044
7403
|
if (!slot)
|
|
6045
7404
|
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6046
7405
|
return this.getAttachment(slot.index, attachmentName);
|
|
6047
7406
|
}
|
|
7407
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
7408
|
+
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
|
|
7409
|
+
*
|
|
7410
|
+
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7411
|
+
* @returns May be null. */
|
|
6048
7412
|
getAttachment(slotIndex, attachmentName) {
|
|
6049
7413
|
if (!attachmentName)
|
|
6050
7414
|
throw new Error("attachmentName cannot be null.");
|
|
@@ -6057,6 +7421,9 @@ var spine = (() => {
|
|
|
6057
7421
|
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
6058
7422
|
return null;
|
|
6059
7423
|
}
|
|
7424
|
+
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7425
|
+
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7426
|
+
* @param attachmentName May be null to clear the slot's attachment. */
|
|
6060
7427
|
setAttachment(slotName, attachmentName) {
|
|
6061
7428
|
if (!slotName)
|
|
6062
7429
|
throw new Error("slotName cannot be null.");
|
|
@@ -6076,6 +7443,9 @@ var spine = (() => {
|
|
|
6076
7443
|
}
|
|
6077
7444
|
throw new Error("Slot not found: " + slotName);
|
|
6078
7445
|
}
|
|
7446
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7447
|
+
* than to call it repeatedly.
|
|
7448
|
+
* @return May be null. */
|
|
6079
7449
|
findIkConstraint(constraintName) {
|
|
6080
7450
|
if (!constraintName)
|
|
6081
7451
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6087,6 +7457,9 @@ var spine = (() => {
|
|
|
6087
7457
|
}
|
|
6088
7458
|
return null;
|
|
6089
7459
|
}
|
|
7460
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7461
|
+
* this method than to call it repeatedly.
|
|
7462
|
+
* @return May be null. */
|
|
6090
7463
|
findTransformConstraint(constraintName) {
|
|
6091
7464
|
if (!constraintName)
|
|
6092
7465
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6098,6 +7471,9 @@ var spine = (() => {
|
|
|
6098
7471
|
}
|
|
6099
7472
|
return null;
|
|
6100
7473
|
}
|
|
7474
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7475
|
+
* than to call it repeatedly.
|
|
7476
|
+
* @return May be null. */
|
|
6101
7477
|
findPathConstraint(constraintName) {
|
|
6102
7478
|
if (!constraintName)
|
|
6103
7479
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6109,12 +7485,18 @@ var spine = (() => {
|
|
|
6109
7485
|
}
|
|
6110
7486
|
return null;
|
|
6111
7487
|
}
|
|
7488
|
+
/** 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 }`.
|
|
7489
|
+
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
6112
7490
|
getBoundsRect() {
|
|
6113
7491
|
let offset = new Vector2();
|
|
6114
7492
|
let size = new Vector2();
|
|
6115
7493
|
this.getBounds(offset, size);
|
|
6116
7494
|
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6117
7495
|
}
|
|
7496
|
+
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
|
|
7497
|
+
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
|
7498
|
+
* @param size An output value, the width and height of the AABB.
|
|
7499
|
+
* @param temp Working memory to temporarily store attachments' computed world vertices. */
|
|
6118
7500
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6119
7501
|
if (!offset)
|
|
6120
7502
|
throw new Error("offset cannot be null.");
|
|
@@ -6153,30 +7535,59 @@ var spine = (() => {
|
|
|
6153
7535
|
size.set(maxX - minX, maxY - minY);
|
|
6154
7536
|
}
|
|
6155
7537
|
};
|
|
7538
|
+
var Skeleton = _Skeleton;
|
|
7539
|
+
Skeleton.yDown = false;
|
|
6156
7540
|
|
|
6157
7541
|
// spine-core/src/SkeletonData.ts
|
|
6158
7542
|
var SkeletonData = class {
|
|
6159
7543
|
constructor() {
|
|
7544
|
+
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
|
6160
7545
|
this.name = null;
|
|
7546
|
+
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
6161
7547
|
this.bones = new Array();
|
|
7548
|
+
// Ordered parents first.
|
|
7549
|
+
/** The skeleton's slots. */
|
|
6162
7550
|
this.slots = new Array();
|
|
7551
|
+
// Setup pose draw order.
|
|
6163
7552
|
this.skins = new Array();
|
|
7553
|
+
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
|
|
7554
|
+
*
|
|
7555
|
+
* See {@link Skeleton#getAttachmentByName()}.
|
|
7556
|
+
* May be null. */
|
|
6164
7557
|
this.defaultSkin = null;
|
|
7558
|
+
/** The skeleton's events. */
|
|
6165
7559
|
this.events = new Array();
|
|
7560
|
+
/** The skeleton's animations. */
|
|
6166
7561
|
this.animations = new Array();
|
|
7562
|
+
/** The skeleton's IK constraints. */
|
|
6167
7563
|
this.ikConstraints = new Array();
|
|
7564
|
+
/** The skeleton's transform constraints. */
|
|
6168
7565
|
this.transformConstraints = new Array();
|
|
7566
|
+
/** The skeleton's path constraints. */
|
|
6169
7567
|
this.pathConstraints = new Array();
|
|
7568
|
+
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6170
7569
|
this.x = 0;
|
|
7570
|
+
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6171
7571
|
this.y = 0;
|
|
7572
|
+
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6172
7573
|
this.width = 0;
|
|
7574
|
+
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6173
7575
|
this.height = 0;
|
|
7576
|
+
/** The Spine version used to export the skeleton data, or null. */
|
|
6174
7577
|
this.version = null;
|
|
7578
|
+
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
|
6175
7579
|
this.hash = null;
|
|
7580
|
+
// Nonessential
|
|
7581
|
+
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
|
6176
7582
|
this.fps = 0;
|
|
7583
|
+
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6177
7584
|
this.imagesPath = null;
|
|
7585
|
+
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6178
7586
|
this.audioPath = null;
|
|
6179
7587
|
}
|
|
7588
|
+
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
|
|
7589
|
+
* multiple times.
|
|
7590
|
+
* @returns May be null. */
|
|
6180
7591
|
findBone(boneName) {
|
|
6181
7592
|
if (!boneName)
|
|
6182
7593
|
throw new Error("boneName cannot be null.");
|
|
@@ -6188,6 +7599,9 @@ var spine = (() => {
|
|
|
6188
7599
|
}
|
|
6189
7600
|
return null;
|
|
6190
7601
|
}
|
|
7602
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7603
|
+
* multiple times.
|
|
7604
|
+
* @returns May be null. */
|
|
6191
7605
|
findSlot(slotName) {
|
|
6192
7606
|
if (!slotName)
|
|
6193
7607
|
throw new Error("slotName cannot be null.");
|
|
@@ -6199,6 +7613,9 @@ var spine = (() => {
|
|
|
6199
7613
|
}
|
|
6200
7614
|
return null;
|
|
6201
7615
|
}
|
|
7616
|
+
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
|
|
7617
|
+
* multiple times.
|
|
7618
|
+
* @returns May be null. */
|
|
6202
7619
|
findSkin(skinName) {
|
|
6203
7620
|
if (!skinName)
|
|
6204
7621
|
throw new Error("skinName cannot be null.");
|
|
@@ -6210,6 +7627,9 @@ var spine = (() => {
|
|
|
6210
7627
|
}
|
|
6211
7628
|
return null;
|
|
6212
7629
|
}
|
|
7630
|
+
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
|
|
7631
|
+
* multiple times.
|
|
7632
|
+
* @returns May be null. */
|
|
6213
7633
|
findEvent(eventDataName) {
|
|
6214
7634
|
if (!eventDataName)
|
|
6215
7635
|
throw new Error("eventDataName cannot be null.");
|
|
@@ -6221,6 +7641,9 @@ var spine = (() => {
|
|
|
6221
7641
|
}
|
|
6222
7642
|
return null;
|
|
6223
7643
|
}
|
|
7644
|
+
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
|
|
7645
|
+
* call it multiple times.
|
|
7646
|
+
* @returns May be null. */
|
|
6224
7647
|
findAnimation(animationName) {
|
|
6225
7648
|
if (!animationName)
|
|
6226
7649
|
throw new Error("animationName cannot be null.");
|
|
@@ -6232,6 +7655,9 @@ var spine = (() => {
|
|
|
6232
7655
|
}
|
|
6233
7656
|
return null;
|
|
6234
7657
|
}
|
|
7658
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7659
|
+
* than to call it multiple times.
|
|
7660
|
+
* @return May be null. */
|
|
6235
7661
|
findIkConstraint(constraintName) {
|
|
6236
7662
|
if (!constraintName)
|
|
6237
7663
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6243,6 +7669,9 @@ var spine = (() => {
|
|
|
6243
7669
|
}
|
|
6244
7670
|
return null;
|
|
6245
7671
|
}
|
|
7672
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7673
|
+
* this method than to call it multiple times.
|
|
7674
|
+
* @return May be null. */
|
|
6246
7675
|
findTransformConstraint(constraintName) {
|
|
6247
7676
|
if (!constraintName)
|
|
6248
7677
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6254,6 +7683,9 @@ var spine = (() => {
|
|
|
6254
7683
|
}
|
|
6255
7684
|
return null;
|
|
6256
7685
|
}
|
|
7686
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7687
|
+
* than to call it multiple times.
|
|
7688
|
+
* @return May be null. */
|
|
6257
7689
|
findPathConstraint(constraintName) {
|
|
6258
7690
|
if (!constraintName)
|
|
6259
7691
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6284,6 +7716,7 @@ var spine = (() => {
|
|
|
6284
7716
|
throw new Error("name cannot be null.");
|
|
6285
7717
|
this.name = name;
|
|
6286
7718
|
}
|
|
7719
|
+
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
6287
7720
|
setAttachment(slotIndex, name, attachment) {
|
|
6288
7721
|
if (!attachment)
|
|
6289
7722
|
throw new Error("attachment cannot be null.");
|
|
@@ -6294,6 +7727,7 @@ var spine = (() => {
|
|
|
6294
7727
|
attachments[slotIndex] = {};
|
|
6295
7728
|
attachments[slotIndex][name] = attachment;
|
|
6296
7729
|
}
|
|
7730
|
+
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
6297
7731
|
addSkin(skin) {
|
|
6298
7732
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6299
7733
|
let bone = skin.bones[i];
|
|
@@ -6325,6 +7759,8 @@ var spine = (() => {
|
|
|
6325
7759
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
6326
7760
|
}
|
|
6327
7761
|
}
|
|
7762
|
+
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
|
|
7763
|
+
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
|
|
6328
7764
|
copySkin(skin) {
|
|
6329
7765
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6330
7766
|
let bone = skin.bones[i];
|
|
@@ -6364,15 +7800,18 @@ var spine = (() => {
|
|
|
6364
7800
|
}
|
|
6365
7801
|
}
|
|
6366
7802
|
}
|
|
7803
|
+
/** Returns the attachment for the specified slot index and name, or null. */
|
|
6367
7804
|
getAttachment(slotIndex, name) {
|
|
6368
7805
|
let dictionary = this.attachments[slotIndex];
|
|
6369
7806
|
return dictionary ? dictionary[name] : null;
|
|
6370
7807
|
}
|
|
7808
|
+
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
6371
7809
|
removeAttachment(slotIndex, name) {
|
|
6372
7810
|
let dictionary = this.attachments[slotIndex];
|
|
6373
7811
|
if (dictionary)
|
|
6374
7812
|
delete dictionary[name];
|
|
6375
7813
|
}
|
|
7814
|
+
/** Returns all attachments in this skin. */
|
|
6376
7815
|
getAttachments() {
|
|
6377
7816
|
let entries = new Array();
|
|
6378
7817
|
for (var i = 0; i < this.attachments.length; i++) {
|
|
@@ -6387,6 +7826,7 @@ var spine = (() => {
|
|
|
6387
7826
|
}
|
|
6388
7827
|
return entries;
|
|
6389
7828
|
}
|
|
7829
|
+
/** Returns all attachments in this skin for the specified slot index. */
|
|
6390
7830
|
getAttachmentsForSlot(slotIndex, attachments) {
|
|
6391
7831
|
let slotAttachments = this.attachments[slotIndex];
|
|
6392
7832
|
if (slotAttachments) {
|
|
@@ -6397,11 +7837,13 @@ var spine = (() => {
|
|
|
6397
7837
|
}
|
|
6398
7838
|
}
|
|
6399
7839
|
}
|
|
7840
|
+
/** Clears all attachments, bones, and constraints. */
|
|
6400
7841
|
clear() {
|
|
6401
7842
|
this.attachments.length = 0;
|
|
6402
7843
|
this.bones.length = 0;
|
|
6403
7844
|
this.constraints.length = 0;
|
|
6404
7845
|
}
|
|
7846
|
+
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
|
|
6405
7847
|
attachAll(skeleton, oldSkin) {
|
|
6406
7848
|
let slotIndex = 0;
|
|
6407
7849
|
for (let i = 0; i < skeleton.slots.length; i++) {
|
|
@@ -6427,10 +7869,17 @@ var spine = (() => {
|
|
|
6427
7869
|
// spine-core/src/SlotData.ts
|
|
6428
7870
|
var SlotData = class {
|
|
6429
7871
|
constructor(index, name, boneData) {
|
|
7872
|
+
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
|
6430
7873
|
this.index = 0;
|
|
7874
|
+
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
|
7875
|
+
* color tinting. */
|
|
6431
7876
|
this.color = new Color(1, 1, 1, 1);
|
|
7877
|
+
/** 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
|
|
7878
|
+
* color's alpha is not used. */
|
|
6432
7879
|
this.darkColor = null;
|
|
7880
|
+
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
6433
7881
|
this.attachmentName = null;
|
|
7882
|
+
/** The blend mode for drawing the slot's attachment. */
|
|
6434
7883
|
this.blendMode = BlendMode.Normal;
|
|
6435
7884
|
if (index < 0)
|
|
6436
7885
|
throw new Error("index must be >= 0.");
|
|
@@ -6443,19 +7892,21 @@ var spine = (() => {
|
|
|
6443
7892
|
this.boneData = boneData;
|
|
6444
7893
|
}
|
|
6445
7894
|
};
|
|
6446
|
-
var BlendMode
|
|
6447
|
-
(function(BlendMode2) {
|
|
7895
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode2) => {
|
|
6448
7896
|
BlendMode2[BlendMode2["Normal"] = 0] = "Normal";
|
|
6449
7897
|
BlendMode2[BlendMode2["Additive"] = 1] = "Additive";
|
|
6450
7898
|
BlendMode2[BlendMode2["Multiply"] = 2] = "Multiply";
|
|
6451
7899
|
BlendMode2[BlendMode2["Screen"] = 3] = "Screen";
|
|
6452
|
-
|
|
7900
|
+
return BlendMode2;
|
|
7901
|
+
})(BlendMode || {});
|
|
6453
7902
|
|
|
6454
7903
|
// spine-core/src/TransformConstraintData.ts
|
|
6455
7904
|
var TransformConstraintData = class extends ConstraintData {
|
|
6456
7905
|
constructor(name) {
|
|
6457
7906
|
super(name, 0, false);
|
|
7907
|
+
/** The bones that will be modified by this transform constraint. */
|
|
6458
7908
|
this.bones = new Array();
|
|
7909
|
+
/** The target bone whose world transform will be copied to the constrained bones. */
|
|
6459
7910
|
this._target = null;
|
|
6460
7911
|
this.mixRotate = 0;
|
|
6461
7912
|
this.mixX = 0;
|
|
@@ -6463,11 +7914,17 @@ var spine = (() => {
|
|
|
6463
7914
|
this.mixScaleX = 0;
|
|
6464
7915
|
this.mixScaleY = 0;
|
|
6465
7916
|
this.mixShearY = 0;
|
|
7917
|
+
/** An offset added to the constrained bone rotation. */
|
|
6466
7918
|
this.offsetRotation = 0;
|
|
7919
|
+
/** An offset added to the constrained bone X translation. */
|
|
6467
7920
|
this.offsetX = 0;
|
|
7921
|
+
/** An offset added to the constrained bone Y translation. */
|
|
6468
7922
|
this.offsetY = 0;
|
|
7923
|
+
/** An offset added to the constrained bone scaleX. */
|
|
6469
7924
|
this.offsetScaleX = 0;
|
|
7925
|
+
/** An offset added to the constrained bone scaleY. */
|
|
6470
7926
|
this.offsetScaleY = 0;
|
|
7927
|
+
/** An offset added to the constrained bone shearY. */
|
|
6471
7928
|
this.offsetShearY = 0;
|
|
6472
7929
|
this.relative = false;
|
|
6473
7930
|
this.local = false;
|
|
@@ -6486,6 +7943,10 @@ var spine = (() => {
|
|
|
6486
7943
|
// spine-core/src/SkeletonBinary.ts
|
|
6487
7944
|
var SkeletonBinary = class {
|
|
6488
7945
|
constructor(attachmentLoader) {
|
|
7946
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
7947
|
+
* runtime than were used in Spine.
|
|
7948
|
+
*
|
|
7949
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
6489
7950
|
this.scale = 1;
|
|
6490
7951
|
this.linkedMeshes = new Array();
|
|
6491
7952
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -6618,10 +8079,10 @@ var spine = (() => {
|
|
|
6618
8079
|
data.rotateMode = input.readInt(true);
|
|
6619
8080
|
data.offsetRotation = input.readFloat();
|
|
6620
8081
|
data.position = input.readFloat();
|
|
6621
|
-
if (data.positionMode ==
|
|
8082
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
6622
8083
|
data.position *= scale;
|
|
6623
8084
|
data.spacing = input.readFloat();
|
|
6624
|
-
if (data.spacingMode ==
|
|
8085
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
6625
8086
|
data.spacing *= scale;
|
|
6626
8087
|
data.mixRotate = input.readFloat();
|
|
6627
8088
|
data.mixX = input.readFloat();
|
|
@@ -7246,10 +8707,18 @@ var spine = (() => {
|
|
|
7246
8707
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
7247
8708
|
switch (input.readByte()) {
|
|
7248
8709
|
case PATH_POSITION:
|
|
7249
|
-
timelines.push(readTimeline1(
|
|
8710
|
+
timelines.push(readTimeline1(
|
|
8711
|
+
input,
|
|
8712
|
+
new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
|
|
8713
|
+
data.positionMode == 0 /* Fixed */ ? scale : 1
|
|
8714
|
+
));
|
|
7250
8715
|
break;
|
|
7251
8716
|
case PATH_SPACING:
|
|
7252
|
-
timelines.push(readTimeline1(
|
|
8717
|
+
timelines.push(readTimeline1(
|
|
8718
|
+
input,
|
|
8719
|
+
new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
|
|
8720
|
+
data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
|
|
8721
|
+
));
|
|
7253
8722
|
break;
|
|
7254
8723
|
case PATH_MIX:
|
|
7255
8724
|
let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
|
|
@@ -7340,7 +8809,13 @@ var spine = (() => {
|
|
|
7340
8809
|
for (let frame = 0; frame < frameCount; frame++) {
|
|
7341
8810
|
let time = input.readFloat();
|
|
7342
8811
|
let modeAndIndex = input.readInt32();
|
|
7343
|
-
timeline.setFrame(
|
|
8812
|
+
timeline.setFrame(
|
|
8813
|
+
frame,
|
|
8814
|
+
time,
|
|
8815
|
+
SequenceModeValues[modeAndIndex & 15],
|
|
8816
|
+
modeAndIndex >> 4,
|
|
8817
|
+
input.readFloat()
|
|
8818
|
+
);
|
|
7344
8819
|
}
|
|
7345
8820
|
timelines.push(timeline);
|
|
7346
8821
|
break;
|
|
@@ -7501,8 +8976,7 @@ var spine = (() => {
|
|
|
7501
8976
|
this.vertices = vertices;
|
|
7502
8977
|
}
|
|
7503
8978
|
};
|
|
7504
|
-
var AttachmentType
|
|
7505
|
-
(function(AttachmentType2) {
|
|
8979
|
+
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
7506
8980
|
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
7507
8981
|
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
7508
8982
|
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
@@ -7510,7 +8984,8 @@ var spine = (() => {
|
|
|
7510
8984
|
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
7511
8985
|
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
7512
8986
|
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
7513
|
-
|
|
8987
|
+
return AttachmentType2;
|
|
8988
|
+
})(AttachmentType || {});
|
|
7514
8989
|
function readTimeline1(input, timeline, scale) {
|
|
7515
8990
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
7516
8991
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
@@ -7581,16 +9056,26 @@ var spine = (() => {
|
|
|
7581
9056
|
// spine-core/src/SkeletonBounds.ts
|
|
7582
9057
|
var SkeletonBounds = class {
|
|
7583
9058
|
constructor() {
|
|
9059
|
+
/** The left edge of the axis aligned bounding box. */
|
|
7584
9060
|
this.minX = 0;
|
|
9061
|
+
/** The bottom edge of the axis aligned bounding box. */
|
|
7585
9062
|
this.minY = 0;
|
|
9063
|
+
/** The right edge of the axis aligned bounding box. */
|
|
7586
9064
|
this.maxX = 0;
|
|
9065
|
+
/** The top edge of the axis aligned bounding box. */
|
|
7587
9066
|
this.maxY = 0;
|
|
9067
|
+
/** The visible bounding boxes. */
|
|
7588
9068
|
this.boundingBoxes = new Array();
|
|
9069
|
+
/** The world vertices for the bounding box polygons. */
|
|
7589
9070
|
this.polygons = new Array();
|
|
7590
9071
|
this.polygonPool = new Pool(() => {
|
|
7591
9072
|
return Utils.newFloatArray(16);
|
|
7592
9073
|
});
|
|
7593
9074
|
}
|
|
9075
|
+
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
|
|
9076
|
+
* box's polygon.
|
|
9077
|
+
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9078
|
+
* SkeletonBounds AABB methods will always return true. */
|
|
7594
9079
|
update(skeleton, updateAabb) {
|
|
7595
9080
|
if (!skeleton)
|
|
7596
9081
|
throw new Error("skeleton cannot be null.");
|
|
@@ -7647,9 +9132,11 @@ var spine = (() => {
|
|
|
7647
9132
|
this.maxX = maxX;
|
|
7648
9133
|
this.maxY = maxY;
|
|
7649
9134
|
}
|
|
9135
|
+
/** Returns true if the axis aligned bounding box contains the point. */
|
|
7650
9136
|
aabbContainsPoint(x, y) {
|
|
7651
9137
|
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
|
|
7652
9138
|
}
|
|
9139
|
+
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
|
7653
9140
|
aabbIntersectsSegment(x1, y1, x2, y2) {
|
|
7654
9141
|
let minX = this.minX;
|
|
7655
9142
|
let minY = this.minY;
|
|
@@ -7672,9 +9159,12 @@ var spine = (() => {
|
|
|
7672
9159
|
return true;
|
|
7673
9160
|
return false;
|
|
7674
9161
|
}
|
|
9162
|
+
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
7675
9163
|
aabbIntersectsSkeleton(bounds) {
|
|
7676
9164
|
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
|
|
7677
9165
|
}
|
|
9166
|
+
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
|
9167
|
+
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
|
|
7678
9168
|
containsPoint(x, y) {
|
|
7679
9169
|
let polygons = this.polygons;
|
|
7680
9170
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7682,6 +9172,7 @@ var spine = (() => {
|
|
|
7682
9172
|
return this.boundingBoxes[i];
|
|
7683
9173
|
return null;
|
|
7684
9174
|
}
|
|
9175
|
+
/** Returns true if the polygon contains the point. */
|
|
7685
9176
|
containsPointPolygon(polygon, x, y) {
|
|
7686
9177
|
let vertices = polygon;
|
|
7687
9178
|
let nn = polygon.length;
|
|
@@ -7699,6 +9190,9 @@ var spine = (() => {
|
|
|
7699
9190
|
}
|
|
7700
9191
|
return inside;
|
|
7701
9192
|
}
|
|
9193
|
+
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
|
|
9194
|
+
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
|
|
9195
|
+
* true. */
|
|
7702
9196
|
intersectsSegment(x1, y1, x2, y2) {
|
|
7703
9197
|
let polygons = this.polygons;
|
|
7704
9198
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7706,6 +9200,7 @@ var spine = (() => {
|
|
|
7706
9200
|
return this.boundingBoxes[i];
|
|
7707
9201
|
return null;
|
|
7708
9202
|
}
|
|
9203
|
+
/** Returns true if the polygon contains any part of the line segment. */
|
|
7709
9204
|
intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
|
|
7710
9205
|
let vertices = polygon;
|
|
7711
9206
|
let nn = polygon.length;
|
|
@@ -7728,15 +9223,18 @@ var spine = (() => {
|
|
|
7728
9223
|
}
|
|
7729
9224
|
return false;
|
|
7730
9225
|
}
|
|
9226
|
+
/** Returns the polygon for the specified bounding box, or null. */
|
|
7731
9227
|
getPolygon(boundingBox) {
|
|
7732
9228
|
if (!boundingBox)
|
|
7733
9229
|
throw new Error("boundingBox cannot be null.");
|
|
7734
9230
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
7735
9231
|
return index == -1 ? null : this.polygons[index];
|
|
7736
9232
|
}
|
|
9233
|
+
/** The width of the axis aligned bounding box. */
|
|
7737
9234
|
getWidth() {
|
|
7738
9235
|
return this.maxX - this.minX;
|
|
7739
9236
|
}
|
|
9237
|
+
/** The height of the axis aligned bounding box. */
|
|
7740
9238
|
getHeight() {
|
|
7741
9239
|
return this.maxY - this.minY;
|
|
7742
9240
|
}
|
|
@@ -7940,7 +9438,14 @@ var spine = (() => {
|
|
|
7940
9438
|
let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
|
|
7941
9439
|
let current = indices[index] << 1;
|
|
7942
9440
|
let next = indices[(index + 1) % vertexCount] << 1;
|
|
7943
|
-
return !this.positiveArea(
|
|
9441
|
+
return !this.positiveArea(
|
|
9442
|
+
vertices[previous],
|
|
9443
|
+
vertices[previous + 1],
|
|
9444
|
+
vertices[current],
|
|
9445
|
+
vertices[current + 1],
|
|
9446
|
+
vertices[next],
|
|
9447
|
+
vertices[next + 1]
|
|
9448
|
+
);
|
|
7944
9449
|
}
|
|
7945
9450
|
static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
|
|
7946
9451
|
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
|
|
@@ -8130,6 +9635,8 @@ var spine = (() => {
|
|
|
8130
9635
|
}
|
|
8131
9636
|
}
|
|
8132
9637
|
}
|
|
9638
|
+
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
|
9639
|
+
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
|
8133
9640
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8134
9641
|
let originalOutput = output;
|
|
8135
9642
|
let clipped = false;
|
|
@@ -8241,6 +9748,10 @@ var spine = (() => {
|
|
|
8241
9748
|
// spine-core/src/SkeletonJson.ts
|
|
8242
9749
|
var SkeletonJson = class {
|
|
8243
9750
|
constructor(attachmentLoader) {
|
|
9751
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
9752
|
+
* runtime than were used in Spine.
|
|
9753
|
+
*
|
|
9754
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
8244
9755
|
this.scale = 1;
|
|
8245
9756
|
this.linkedMeshes = new Array();
|
|
8246
9757
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8386,10 +9897,10 @@ var spine = (() => {
|
|
|
8386
9897
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
8387
9898
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
8388
9899
|
data.position = getValue(constraintMap, "position", 0);
|
|
8389
|
-
if (data.positionMode ==
|
|
9900
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
8390
9901
|
data.position *= scale;
|
|
8391
9902
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
8392
|
-
if (data.spacingMode ==
|
|
9903
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8393
9904
|
data.spacing *= scale;
|
|
8394
9905
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
8395
9906
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
@@ -8930,10 +10441,10 @@ var spine = (() => {
|
|
|
8930
10441
|
let frames = timelineMap.length;
|
|
8931
10442
|
if (timelineName === "position") {
|
|
8932
10443
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
8933
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode ==
|
|
10444
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
|
|
8934
10445
|
} else if (timelineName === "spacing") {
|
|
8935
10446
|
let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
|
|
8936
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode ==
|
|
10447
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
|
|
8937
10448
|
} else if (timelineName === "mix") {
|
|
8938
10449
|
let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
|
|
8939
10450
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -9187,6 +10698,6 @@ var spine = (() => {
|
|
|
9187
10698
|
}(new Float32Array(1));
|
|
9188
10699
|
}
|
|
9189
10700
|
})();
|
|
9190
|
-
return src_exports;
|
|
10701
|
+
return __toCommonJS(src_exports);
|
|
9191
10702
|
})();
|
|
9192
10703
|
//# sourceMappingURL=spine-core.js.map
|