@galacean/effects-plugin-spine 1.4.4 → 1.4.5-alpha.0
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/index.js +394 -172
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +394 -173
- package/dist/index.mjs.map +1 -1
- package/dist/spine-vfx-item.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects player spine plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 十弦
|
|
6
|
-
* Version: v1.4.
|
|
6
|
+
* Version: v1.4.5-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -272,6 +272,10 @@ var Color = /** @class */ (function () {
|
|
|
272
272
|
color.g = ((value & 0x0000ff00) >>> 8) / 255;
|
|
273
273
|
color.b = ((value & 0x000000ff)) / 255;
|
|
274
274
|
};
|
|
275
|
+
Color.prototype.toRgb888 = function () {
|
|
276
|
+
var hex = function (x) { return ("0" + (x * 255).toString(16)).slice(-2); };
|
|
277
|
+
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
|
|
278
|
+
};
|
|
275
279
|
Color.fromString = function (hex) {
|
|
276
280
|
return new Color().setFromString(hex);
|
|
277
281
|
};
|
|
@@ -868,27 +872,28 @@ var Property = {
|
|
|
868
872
|
scaleY: 4,
|
|
869
873
|
shearX: 5,
|
|
870
874
|
shearY: 6,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
875
|
+
inherit: 7,
|
|
876
|
+
rgb: 8,
|
|
877
|
+
alpha: 9,
|
|
878
|
+
rgb2: 10,
|
|
879
|
+
attachment: 11,
|
|
880
|
+
deform: 12,
|
|
881
|
+
event: 13,
|
|
882
|
+
drawOrder: 14,
|
|
883
|
+
ikConstraint: 15,
|
|
884
|
+
transformConstraint: 16,
|
|
885
|
+
pathConstraintPosition: 17,
|
|
886
|
+
pathConstraintSpacing: 18,
|
|
887
|
+
pathConstraintMix: 19,
|
|
888
|
+
physicsConstraintInertia: 20,
|
|
889
|
+
physicsConstraintStrength: 21,
|
|
890
|
+
physicsConstraintDamping: 22,
|
|
891
|
+
physicsConstraintMass: 23,
|
|
892
|
+
physicsConstraintWind: 24,
|
|
893
|
+
physicsConstraintGravity: 25,
|
|
894
|
+
physicsConstraintMix: 26,
|
|
895
|
+
physicsConstraintReset: 27,
|
|
896
|
+
sequence: 28,
|
|
892
897
|
};
|
|
893
898
|
/** The interface for all timelines. */
|
|
894
899
|
var Timeline = /** @class */ (function () {
|
|
@@ -1402,7 +1407,7 @@ var ScaleYTimeline = /** @class */ (function (_super) {
|
|
|
1402
1407
|
ScaleYTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1403
1408
|
var bone = skeleton.bones[this.boneIndex];
|
|
1404
1409
|
if (bone.active)
|
|
1405
|
-
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.
|
|
1410
|
+
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1406
1411
|
};
|
|
1407
1412
|
return ScaleYTimeline;
|
|
1408
1413
|
}(CurveTimeline1));
|
|
@@ -1497,10 +1502,43 @@ var ShearYTimeline = /** @class */ (function (_super) {
|
|
|
1497
1502
|
ShearYTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1498
1503
|
var bone = skeleton.bones[this.boneIndex];
|
|
1499
1504
|
if (bone.active)
|
|
1500
|
-
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.
|
|
1505
|
+
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1501
1506
|
};
|
|
1502
1507
|
return ShearYTimeline;
|
|
1503
1508
|
}(CurveTimeline1));
|
|
1509
|
+
var InheritTimeline = /** @class */ (function (_super) {
|
|
1510
|
+
__extends(InheritTimeline, _super);
|
|
1511
|
+
function InheritTimeline(frameCount, boneIndex) {
|
|
1512
|
+
var _this = _super.call(this, frameCount, [Property.inherit + "|" + boneIndex]) || this;
|
|
1513
|
+
_this.boneIndex = 0;
|
|
1514
|
+
_this.boneIndex = boneIndex;
|
|
1515
|
+
return _this;
|
|
1516
|
+
}
|
|
1517
|
+
InheritTimeline.prototype.getFrameEntries = function () {
|
|
1518
|
+
return 2 /*ENTRIES*/;
|
|
1519
|
+
};
|
|
1520
|
+
/** Sets the transform mode for the specified frame.
|
|
1521
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
1522
|
+
* @param time The frame time in seconds. */
|
|
1523
|
+
InheritTimeline.prototype.setFrame = function (frame, time, inherit) {
|
|
1524
|
+
frame *= 2 /*ENTRIES*/;
|
|
1525
|
+
this.frames[frame] = time;
|
|
1526
|
+
this.frames[frame + 1 /*INHERIT*/] = inherit;
|
|
1527
|
+
};
|
|
1528
|
+
InheritTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1529
|
+
var bone = skeleton.bones[this.boneIndex];
|
|
1530
|
+
if (!bone.active)
|
|
1531
|
+
return;
|
|
1532
|
+
var frames = this.frames;
|
|
1533
|
+
if (time < frames[0]) {
|
|
1534
|
+
if (blend == exports.MixBlend.setup || blend == exports.MixBlend.first)
|
|
1535
|
+
bone.inherit = bone.data.inherit;
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
bone.inherit = this.frames[Timeline.search(frames, time, 2 /*ENTRIES*/) + 1 /*INHERIT*/];
|
|
1539
|
+
};
|
|
1540
|
+
return InheritTimeline;
|
|
1541
|
+
}(Timeline));
|
|
1504
1542
|
/** Changes a slot's {@link Slot#color}. */
|
|
1505
1543
|
var RGBATimeline = /** @class */ (function (_super) {
|
|
1506
1544
|
__extends(RGBATimeline, _super);
|
|
@@ -2327,7 +2365,7 @@ var IkConstraintTimeline = /** @class */ (function (_super) {
|
|
|
2327
2365
|
var _this = _super.call(this, frameCount, bezierCount, [
|
|
2328
2366
|
Property.ikConstraint + "|" + ikConstraintIndex
|
|
2329
2367
|
]) || this;
|
|
2330
|
-
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is */
|
|
2368
|
+
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
|
|
2331
2369
|
_this.constraintIndex = 0;
|
|
2332
2370
|
_this.constraintIndex = ikConstraintIndex;
|
|
2333
2371
|
return _this;
|
|
@@ -3386,8 +3424,14 @@ var AnimationState = /** @class */ (function () {
|
|
|
3386
3424
|
}
|
|
3387
3425
|
// Queue complete if completed a loop iteration or the animation.
|
|
3388
3426
|
var complete = false;
|
|
3389
|
-
if (entry.loop)
|
|
3390
|
-
|
|
3427
|
+
if (entry.loop) {
|
|
3428
|
+
if (duration == 0)
|
|
3429
|
+
complete = true;
|
|
3430
|
+
else {
|
|
3431
|
+
var cycles = Math.floor(entry.trackTime / duration);
|
|
3432
|
+
complete = cycles > 0 && cycles > Math.floor(entry.trackLast / duration);
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3391
3435
|
else
|
|
3392
3436
|
complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
|
|
3393
3437
|
if (complete)
|
|
@@ -3874,13 +3918,16 @@ var TrackEntry = /** @class */ (function () {
|
|
|
3874
3918
|
},
|
|
3875
3919
|
set: function (mixDuration) {
|
|
3876
3920
|
this._mixDuration = mixDuration;
|
|
3877
|
-
if (this.previous != null && this.delay <= 0)
|
|
3878
|
-
this.delay += this.previous.getTrackComplete() - mixDuration;
|
|
3879
|
-
this.delay = this.delay;
|
|
3880
3921
|
},
|
|
3881
3922
|
enumerable: false,
|
|
3882
3923
|
configurable: true
|
|
3883
3924
|
});
|
|
3925
|
+
TrackEntry.prototype.setMixDurationWithDelay = function (mixDuration, delay) {
|
|
3926
|
+
this._mixDuration = mixDuration;
|
|
3927
|
+
if (this.previous != null && delay <= 0)
|
|
3928
|
+
delay += this.previous.getTrackComplete() - mixDuration;
|
|
3929
|
+
this.delay = delay;
|
|
3930
|
+
};
|
|
3884
3931
|
TrackEntry.prototype.reset = function () {
|
|
3885
3932
|
this.next = null;
|
|
3886
3933
|
this.previous = null;
|
|
@@ -5134,7 +5181,7 @@ var BoneData = /** @class */ (function () {
|
|
|
5134
5181
|
/** The local shearX. */
|
|
5135
5182
|
this.shearY = 0;
|
|
5136
5183
|
/** The transform mode for how parent world transforms affect this bone. */
|
|
5137
|
-
this.
|
|
5184
|
+
this.inherit = exports.Inherit.Normal;
|
|
5138
5185
|
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5139
5186
|
* bone.
|
|
5140
5187
|
* @see Skin#bones */
|
|
@@ -5155,14 +5202,14 @@ var BoneData = /** @class */ (function () {
|
|
|
5155
5202
|
return BoneData;
|
|
5156
5203
|
}());
|
|
5157
5204
|
/** Determines how a bone inherits world transforms from parent bones. */
|
|
5158
|
-
exports.
|
|
5159
|
-
(function (
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
})(exports.
|
|
5205
|
+
exports.Inherit = void 0;
|
|
5206
|
+
(function (Inherit) {
|
|
5207
|
+
Inherit[Inherit["Normal"] = 0] = "Normal";
|
|
5208
|
+
Inherit[Inherit["OnlyTranslation"] = 1] = "OnlyTranslation";
|
|
5209
|
+
Inherit[Inherit["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
|
|
5210
|
+
Inherit[Inherit["NoScale"] = 3] = "NoScale";
|
|
5211
|
+
Inherit[Inherit["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
|
|
5212
|
+
})(exports.Inherit || (exports.Inherit = {}));
|
|
5166
5213
|
|
|
5167
5214
|
/******************************************************************************
|
|
5168
5215
|
* Spine Runtimes License Agreement
|
|
@@ -5244,6 +5291,7 @@ var Bone = /** @class */ (function () {
|
|
|
5244
5291
|
this.worldY = 0;
|
|
5245
5292
|
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
5246
5293
|
this.worldX = 0;
|
|
5294
|
+
this.inherit = exports.Inherit.Normal;
|
|
5247
5295
|
this.sorted = false;
|
|
5248
5296
|
this.active = false;
|
|
5249
5297
|
if (!data)
|
|
@@ -5300,8 +5348,8 @@ var Bone = /** @class */ (function () {
|
|
|
5300
5348
|
var pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
5301
5349
|
this.worldX = pa * x + pb * y + parent.worldX;
|
|
5302
5350
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
5303
|
-
switch (this.
|
|
5304
|
-
case exports.
|
|
5351
|
+
switch (this.inherit) {
|
|
5352
|
+
case exports.Inherit.Normal: {
|
|
5305
5353
|
var rx = (rotation + shearX) * MathUtils.degRad;
|
|
5306
5354
|
var ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5307
5355
|
var la = Math.cos(rx) * scaleX;
|
|
@@ -5314,7 +5362,7 @@ var Bone = /** @class */ (function () {
|
|
|
5314
5362
|
this.d = pc * lb + pd * ld;
|
|
5315
5363
|
return;
|
|
5316
5364
|
}
|
|
5317
|
-
case exports.
|
|
5365
|
+
case exports.Inherit.OnlyTranslation: {
|
|
5318
5366
|
var rx = (rotation + shearX) * MathUtils.degRad;
|
|
5319
5367
|
var ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5320
5368
|
this.a = Math.cos(rx) * scaleX;
|
|
@@ -5323,7 +5371,7 @@ var Bone = /** @class */ (function () {
|
|
|
5323
5371
|
this.d = Math.sin(ry) * scaleY;
|
|
5324
5372
|
break;
|
|
5325
5373
|
}
|
|
5326
|
-
case exports.
|
|
5374
|
+
case exports.Inherit.NoRotationOrReflection: {
|
|
5327
5375
|
var s = pa * pa + pc * pc;
|
|
5328
5376
|
var prx = 0;
|
|
5329
5377
|
if (s > 0.0001) {
|
|
@@ -5351,8 +5399,8 @@ var Bone = /** @class */ (function () {
|
|
|
5351
5399
|
this.d = pc * lb + pd * ld;
|
|
5352
5400
|
break;
|
|
5353
5401
|
}
|
|
5354
|
-
case exports.
|
|
5355
|
-
case exports.
|
|
5402
|
+
case exports.Inherit.NoScale:
|
|
5403
|
+
case exports.Inherit.NoScaleOrReflection: {
|
|
5356
5404
|
rotation *= MathUtils.degRad;
|
|
5357
5405
|
var cos = Math.cos(rotation), sin = Math.sin(rotation);
|
|
5358
5406
|
var za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
@@ -5363,7 +5411,7 @@ var Bone = /** @class */ (function () {
|
|
|
5363
5411
|
za *= s;
|
|
5364
5412
|
zc *= s;
|
|
5365
5413
|
s = Math.sqrt(za * za + zc * zc);
|
|
5366
|
-
if (this.
|
|
5414
|
+
if (this.inherit == exports.Inherit.NoScale
|
|
5367
5415
|
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5368
5416
|
s = -s;
|
|
5369
5417
|
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
@@ -5397,6 +5445,7 @@ var Bone = /** @class */ (function () {
|
|
|
5397
5445
|
this.scaleY = data.scaleY;
|
|
5398
5446
|
this.shearX = data.shearX;
|
|
5399
5447
|
this.shearY = data.shearY;
|
|
5448
|
+
this.inherit = data.inherit;
|
|
5400
5449
|
};
|
|
5401
5450
|
/** Computes the applied transform values from the world transform.
|
|
5402
5451
|
*
|
|
@@ -5425,15 +5474,15 @@ var Bone = /** @class */ (function () {
|
|
|
5425
5474
|
this.ax = (dx * ia - dy * ib);
|
|
5426
5475
|
this.ay = (dy * id - dx * ic);
|
|
5427
5476
|
var ra, rb, rc, rd;
|
|
5428
|
-
if (this.
|
|
5477
|
+
if (this.inherit == exports.Inherit.OnlyTranslation) {
|
|
5429
5478
|
ra = this.a;
|
|
5430
5479
|
rb = this.b;
|
|
5431
5480
|
rc = this.c;
|
|
5432
5481
|
rd = this.d;
|
|
5433
5482
|
}
|
|
5434
5483
|
else {
|
|
5435
|
-
switch (this.
|
|
5436
|
-
case exports.
|
|
5484
|
+
switch (this.inherit) {
|
|
5485
|
+
case exports.Inherit.NoRotationOrReflection: {
|
|
5437
5486
|
var s_1 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
5438
5487
|
var sa = pa / this.skeleton.scaleX;
|
|
5439
5488
|
var sc = pc / this.skeleton.scaleY;
|
|
@@ -5444,8 +5493,8 @@ var Bone = /** @class */ (function () {
|
|
|
5444
5493
|
ib = pb * pid;
|
|
5445
5494
|
break;
|
|
5446
5495
|
}
|
|
5447
|
-
case exports.
|
|
5448
|
-
case exports.
|
|
5496
|
+
case exports.Inherit.NoScale:
|
|
5497
|
+
case exports.Inherit.NoScaleOrReflection:
|
|
5449
5498
|
var cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
|
|
5450
5499
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5451
5500
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
@@ -5455,7 +5504,7 @@ var Bone = /** @class */ (function () {
|
|
|
5455
5504
|
pa *= s;
|
|
5456
5505
|
pc *= s;
|
|
5457
5506
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
5458
|
-
if (this.
|
|
5507
|
+
if (this.inherit == exports.Inherit.NoScale && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5459
5508
|
s = -s;
|
|
5460
5509
|
var r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
5461
5510
|
pb = Math.cos(r) * s;
|
|
@@ -6065,11 +6114,6 @@ var IkConstraint = /** @class */ (function () {
|
|
|
6065
6114
|
if (!skeleton)
|
|
6066
6115
|
throw new Error("skeleton cannot be null.");
|
|
6067
6116
|
this.data = data;
|
|
6068
|
-
this.mix = data.mix;
|
|
6069
|
-
this.softness = data.softness;
|
|
6070
|
-
this.bendDirection = data.bendDirection;
|
|
6071
|
-
this.compress = data.compress;
|
|
6072
|
-
this.stretch = data.stretch;
|
|
6073
6117
|
this.bones = new Array();
|
|
6074
6118
|
for (var i = 0; i < data.bones.length; i++) {
|
|
6075
6119
|
var bone = skeleton.findBone(data.bones[i].name);
|
|
@@ -6081,6 +6125,11 @@ var IkConstraint = /** @class */ (function () {
|
|
|
6081
6125
|
if (!target)
|
|
6082
6126
|
throw new Error("Couldn't find bone ".concat(data.target.name));
|
|
6083
6127
|
this.target = target;
|
|
6128
|
+
this.mix = data.mix;
|
|
6129
|
+
this.softness = data.softness;
|
|
6130
|
+
this.bendDirection = data.bendDirection;
|
|
6131
|
+
this.compress = data.compress;
|
|
6132
|
+
this.stretch = data.stretch;
|
|
6084
6133
|
}
|
|
6085
6134
|
IkConstraint.prototype.isActive = function () {
|
|
6086
6135
|
return this.active;
|
|
@@ -6114,12 +6163,12 @@ var IkConstraint = /** @class */ (function () {
|
|
|
6114
6163
|
throw new Error("IK bone must have parent.");
|
|
6115
6164
|
var pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
6116
6165
|
var rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
6117
|
-
switch (bone.
|
|
6118
|
-
case exports.
|
|
6166
|
+
switch (bone.inherit) {
|
|
6167
|
+
case exports.Inherit.OnlyTranslation:
|
|
6119
6168
|
tx = (targetX - bone.worldX) * MathUtils.signum(bone.skeleton.scaleX);
|
|
6120
6169
|
ty = (targetY - bone.worldY) * MathUtils.signum(bone.skeleton.scaleY);
|
|
6121
6170
|
break;
|
|
6122
|
-
case exports.
|
|
6171
|
+
case exports.Inherit.NoRotationOrReflection:
|
|
6123
6172
|
var s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001, pa * pa + pc * pc);
|
|
6124
6173
|
var sa = pa / bone.skeleton.scaleX;
|
|
6125
6174
|
var sc = pc / bone.skeleton.scaleY;
|
|
@@ -6148,9 +6197,9 @@ var IkConstraint = /** @class */ (function () {
|
|
|
6148
6197
|
rotationIK += 360;
|
|
6149
6198
|
var sx = bone.ascaleX, sy = bone.ascaleY;
|
|
6150
6199
|
if (compress || stretch) {
|
|
6151
|
-
switch (bone.
|
|
6152
|
-
case exports.
|
|
6153
|
-
case exports.
|
|
6200
|
+
switch (bone.inherit) {
|
|
6201
|
+
case exports.Inherit.NoScale:
|
|
6202
|
+
case exports.Inherit.NoScaleOrReflection:
|
|
6154
6203
|
tx = targetX - bone.worldX;
|
|
6155
6204
|
ty = targetY - bone.worldY;
|
|
6156
6205
|
}
|
|
@@ -6170,6 +6219,8 @@ var IkConstraint = /** @class */ (function () {
|
|
|
6170
6219
|
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6171
6220
|
* @param child A direct descendant of the parent bone. */
|
|
6172
6221
|
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
6222
|
+
if (parent.inherit != exports.Inherit.Normal || child.inherit != exports.Inherit.Normal)
|
|
6223
|
+
return;
|
|
6173
6224
|
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
6174
6225
|
var os1 = 0, os2 = 0, s2 = 0;
|
|
6175
6226
|
if (psx < 0) {
|
|
@@ -6339,7 +6390,7 @@ var IkConstraintData = /** @class */ (function (_super) {
|
|
|
6339
6390
|
/** The bone that is the IK target. */
|
|
6340
6391
|
_this._target = null;
|
|
6341
6392
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
6342
|
-
_this.bendDirection =
|
|
6393
|
+
_this.bendDirection = 0;
|
|
6343
6394
|
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
6344
6395
|
_this.compress = false;
|
|
6345
6396
|
/** 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
|
|
@@ -6349,7 +6400,7 @@ var IkConstraintData = /** @class */ (function (_super) {
|
|
|
6349
6400
|
* is scaled on both the X and Y axes. */
|
|
6350
6401
|
_this.uniform = false;
|
|
6351
6402
|
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
6352
|
-
_this.mix =
|
|
6403
|
+
_this.mix = 0;
|
|
6353
6404
|
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
6354
6405
|
_this.softness = 0;
|
|
6355
6406
|
return _this;
|
|
@@ -7038,7 +7089,8 @@ var PhysicsConstraint = /** @class */ (function () {
|
|
|
7038
7089
|
this.reset();
|
|
7039
7090
|
// Fall through.
|
|
7040
7091
|
case exports.Physics.update:
|
|
7041
|
-
|
|
7092
|
+
var delta = Math.max(this.skeleton.time - this.lastTime, 0);
|
|
7093
|
+
this.remaining += delta;
|
|
7042
7094
|
this.lastTime = this.skeleton.time;
|
|
7043
7095
|
var bx = bone.worldX, by = bone.worldY;
|
|
7044
7096
|
if (this._reset) {
|
|
@@ -7047,32 +7099,34 @@ var PhysicsConstraint = /** @class */ (function () {
|
|
|
7047
7099
|
this.uy = by;
|
|
7048
7100
|
}
|
|
7049
7101
|
else {
|
|
7050
|
-
var
|
|
7102
|
+
var a = this.remaining, i = this.inertia, q = this.data.limit * delta, t = this.data.step, f = this.skeleton.data.referenceScale, d = -1;
|
|
7051
7103
|
if (x || y) {
|
|
7052
7104
|
if (x) {
|
|
7053
|
-
|
|
7105
|
+
var u = (this.ux - bx) * i;
|
|
7106
|
+
this.xOffset += u > q ? q : u < -q ? -q : u;
|
|
7054
7107
|
this.ux = bx;
|
|
7055
7108
|
}
|
|
7056
7109
|
if (y) {
|
|
7057
|
-
|
|
7110
|
+
var u = (this.uy - by) * i;
|
|
7111
|
+
this.yOffset += u > q ? q : u < -q ? -q : u;
|
|
7058
7112
|
this.uy = by;
|
|
7059
7113
|
}
|
|
7060
|
-
if (
|
|
7061
|
-
|
|
7062
|
-
var
|
|
7114
|
+
if (a >= t) {
|
|
7115
|
+
d = Math.pow(this.damping, 60 * t);
|
|
7116
|
+
var m = this.massInverse * t, e = this.strength, w = this.wind * f, g = (Skeleton.yDown ? -this.gravity : this.gravity) * f;
|
|
7063
7117
|
do {
|
|
7064
7118
|
if (x) {
|
|
7065
7119
|
this.xVelocity += (w - this.xOffset * e) * m;
|
|
7066
|
-
this.xOffset += this.xVelocity *
|
|
7120
|
+
this.xOffset += this.xVelocity * t;
|
|
7067
7121
|
this.xVelocity *= d;
|
|
7068
7122
|
}
|
|
7069
7123
|
if (y) {
|
|
7070
|
-
this.yVelocity
|
|
7071
|
-
this.yOffset += this.yVelocity *
|
|
7124
|
+
this.yVelocity -= (g + this.yOffset * e) * m;
|
|
7125
|
+
this.yOffset += this.yVelocity * t;
|
|
7072
7126
|
this.yVelocity *= d;
|
|
7073
7127
|
}
|
|
7074
|
-
|
|
7075
|
-
} while (
|
|
7128
|
+
a -= t;
|
|
7129
|
+
} while (a >= t);
|
|
7076
7130
|
}
|
|
7077
7131
|
if (x)
|
|
7078
7132
|
bone.worldX += this.xOffset * mix * this.data.x;
|
|
@@ -7081,9 +7135,18 @@ var PhysicsConstraint = /** @class */ (function () {
|
|
|
7081
7135
|
}
|
|
7082
7136
|
if (rotateOrShearX || scaleX) {
|
|
7083
7137
|
var ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
7138
|
+
var dx = this.cx - bone.worldX, dy = this.cy - bone.worldY;
|
|
7139
|
+
if (dx > q)
|
|
7140
|
+
dx = q;
|
|
7141
|
+
else if (dx < -q) //
|
|
7142
|
+
dx = -q;
|
|
7143
|
+
if (dy > q)
|
|
7144
|
+
dy = q;
|
|
7145
|
+
else if (dy < -q) //
|
|
7146
|
+
dy = -q;
|
|
7084
7147
|
if (rotateOrShearX) {
|
|
7085
7148
|
mr = (this.data.rotate + this.data.shearX) * mix;
|
|
7086
|
-
var
|
|
7149
|
+
var r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
|
|
7087
7150
|
this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
|
|
7088
7151
|
r = this.rotateOffset * mr + ca;
|
|
7089
7152
|
c = Math.cos(r);
|
|
@@ -7099,35 +7162,36 @@ var PhysicsConstraint = /** @class */ (function () {
|
|
|
7099
7162
|
s = Math.sin(ca);
|
|
7100
7163
|
var r = l * bone.getWorldScaleX();
|
|
7101
7164
|
if (r > 0)
|
|
7102
|
-
this.scaleOffset += (
|
|
7165
|
+
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7103
7166
|
}
|
|
7104
|
-
|
|
7105
|
-
if (
|
|
7106
|
-
|
|
7107
|
-
|
|
7167
|
+
a = this.remaining;
|
|
7168
|
+
if (a >= t) {
|
|
7169
|
+
if (d == -1)
|
|
7170
|
+
d = Math.pow(this.damping, 60 * t);
|
|
7171
|
+
var m = this.massInverse * t, e = this.strength, w = this.wind, g = (Skeleton.yDown ? -this.gravity : this.gravity), h = l / f;
|
|
7108
7172
|
while (true) {
|
|
7109
|
-
|
|
7173
|
+
a -= t;
|
|
7110
7174
|
if (scaleX) {
|
|
7111
7175
|
this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
|
|
7112
|
-
this.scaleOffset += this.scaleVelocity *
|
|
7176
|
+
this.scaleOffset += this.scaleVelocity * t;
|
|
7113
7177
|
this.scaleVelocity *= d;
|
|
7114
7178
|
}
|
|
7115
7179
|
if (rotateOrShearX) {
|
|
7116
|
-
this.rotateVelocity
|
|
7117
|
-
this.rotateOffset += this.rotateVelocity *
|
|
7180
|
+
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
|
|
7181
|
+
this.rotateOffset += this.rotateVelocity * t;
|
|
7118
7182
|
this.rotateVelocity *= d;
|
|
7119
|
-
if (
|
|
7183
|
+
if (a < t)
|
|
7120
7184
|
break;
|
|
7121
7185
|
var r = this.rotateOffset * mr + ca;
|
|
7122
7186
|
c = Math.cos(r);
|
|
7123
7187
|
s = Math.sin(r);
|
|
7124
7188
|
}
|
|
7125
|
-
else if (
|
|
7189
|
+
else if (a < t) //
|
|
7126
7190
|
break;
|
|
7127
7191
|
}
|
|
7128
7192
|
}
|
|
7129
7193
|
}
|
|
7130
|
-
this.remaining =
|
|
7194
|
+
this.remaining = a;
|
|
7131
7195
|
}
|
|
7132
7196
|
this.cx = bone.worldX;
|
|
7133
7197
|
this.cy = bone.worldY;
|
|
@@ -7180,6 +7244,21 @@ var PhysicsConstraint = /** @class */ (function () {
|
|
|
7180
7244
|
}
|
|
7181
7245
|
bone.updateAppliedTransform();
|
|
7182
7246
|
};
|
|
7247
|
+
/** Translates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone moved an additional
|
|
7248
|
+
* amount in world space. */
|
|
7249
|
+
PhysicsConstraint.prototype.translate = function (x, y) {
|
|
7250
|
+
this.ux -= x;
|
|
7251
|
+
this.uy -= y;
|
|
7252
|
+
this.cx -= x;
|
|
7253
|
+
this.cy -= y;
|
|
7254
|
+
};
|
|
7255
|
+
/** Rotates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone rotated around the
|
|
7256
|
+
* specified point in world space. */
|
|
7257
|
+
PhysicsConstraint.prototype.rotate = function (x, y, degrees) {
|
|
7258
|
+
var r = degrees * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
|
|
7259
|
+
var dx = this.cx - x, dy = this.cy - y;
|
|
7260
|
+
this.translate(dx * cos - dy * sin - dx, dx * sin + dy * cos - dy);
|
|
7261
|
+
};
|
|
7183
7262
|
return PhysicsConstraint;
|
|
7184
7263
|
}());
|
|
7185
7264
|
|
|
@@ -7322,12 +7401,6 @@ var TransformConstraint = /** @class */ (function () {
|
|
|
7322
7401
|
if (!skeleton)
|
|
7323
7402
|
throw new Error("skeleton cannot be null.");
|
|
7324
7403
|
this.data = data;
|
|
7325
|
-
this.mixRotate = data.mixRotate;
|
|
7326
|
-
this.mixX = data.mixX;
|
|
7327
|
-
this.mixY = data.mixY;
|
|
7328
|
-
this.mixScaleX = data.mixScaleX;
|
|
7329
|
-
this.mixScaleY = data.mixScaleY;
|
|
7330
|
-
this.mixShearY = data.mixShearY;
|
|
7331
7404
|
this.bones = new Array();
|
|
7332
7405
|
for (var i = 0; i < data.bones.length; i++) {
|
|
7333
7406
|
var bone = skeleton.findBone(data.bones[i].name);
|
|
@@ -7339,6 +7412,12 @@ var TransformConstraint = /** @class */ (function () {
|
|
|
7339
7412
|
if (!target)
|
|
7340
7413
|
throw new Error("Couldn't find target bone ".concat(data.target.name, "."));
|
|
7341
7414
|
this.target = target;
|
|
7415
|
+
this.mixRotate = data.mixRotate;
|
|
7416
|
+
this.mixX = data.mixX;
|
|
7417
|
+
this.mixY = data.mixY;
|
|
7418
|
+
this.mixScaleX = data.mixScaleX;
|
|
7419
|
+
this.mixScaleY = data.mixScaleY;
|
|
7420
|
+
this.mixShearY = data.mixShearY;
|
|
7342
7421
|
}
|
|
7343
7422
|
TransformConstraint.prototype.isActive = function () {
|
|
7344
7423
|
return this.active;
|
|
@@ -7491,11 +7570,8 @@ var TransformConstraint = /** @class */ (function () {
|
|
|
7491
7570
|
for (var i = 0, n = bones.length; i < n; i++) {
|
|
7492
7571
|
var bone = bones[i];
|
|
7493
7572
|
var rotation = bone.arotation;
|
|
7494
|
-
if (mixRotate != 0)
|
|
7495
|
-
|
|
7496
|
-
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7497
|
-
rotation += r * mixRotate;
|
|
7498
|
-
}
|
|
7573
|
+
if (mixRotate != 0)
|
|
7574
|
+
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7499
7575
|
var x = bone.ax, y = bone.ay;
|
|
7500
7576
|
x += (target.ax - x + this.data.offsetX) * mixX;
|
|
7501
7577
|
y += (target.ay - y + this.data.offsetY) * mixY;
|
|
@@ -7505,11 +7581,8 @@ var TransformConstraint = /** @class */ (function () {
|
|
|
7505
7581
|
if (mixScaleY != 0 && scaleY != 0)
|
|
7506
7582
|
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
|
|
7507
7583
|
var shearY = bone.ashearY;
|
|
7508
|
-
if (mixShearY != 0)
|
|
7509
|
-
|
|
7510
|
-
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7511
|
-
shearY += r * mixShearY;
|
|
7512
|
-
}
|
|
7584
|
+
if (mixShearY != 0)
|
|
7585
|
+
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7513
7586
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
7514
7587
|
}
|
|
7515
7588
|
};
|
|
@@ -7806,7 +7879,7 @@ var Skeleton = /** @class */ (function () {
|
|
|
7806
7879
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7807
7880
|
* Runtimes Guide. */
|
|
7808
7881
|
Skeleton.prototype.updateWorldTransform = function (physics) {
|
|
7809
|
-
if (
|
|
7882
|
+
if (physics === undefined || physics === null)
|
|
7810
7883
|
throw new Error("physics is undefined");
|
|
7811
7884
|
var bones = this.bones;
|
|
7812
7885
|
for (var i = 0, n = bones.length; i < n; i++) {
|
|
@@ -8099,9 +8172,11 @@ var Skeleton = /** @class */ (function () {
|
|
|
8099
8172
|
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
|
|
8100
8173
|
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
|
8101
8174
|
* @param size An output value, the width and height of the AABB.
|
|
8102
|
-
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
8103
|
-
|
|
8175
|
+
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
8176
|
+
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
|
|
8177
|
+
Skeleton.prototype.getBounds = function (offset, size, temp, clipper) {
|
|
8104
8178
|
if (temp === void 0) { temp = new Array(2); }
|
|
8179
|
+
if (clipper === void 0) { clipper = null; }
|
|
8105
8180
|
if (!offset)
|
|
8106
8181
|
throw new Error("offset cannot be null.");
|
|
8107
8182
|
if (!size)
|
|
@@ -8114,19 +8189,31 @@ var Skeleton = /** @class */ (function () {
|
|
|
8114
8189
|
continue;
|
|
8115
8190
|
var verticesLength = 0;
|
|
8116
8191
|
var vertices = null;
|
|
8192
|
+
var triangles = null;
|
|
8117
8193
|
var attachment = slot.getAttachment();
|
|
8118
8194
|
if (attachment instanceof RegionAttachment) {
|
|
8119
8195
|
verticesLength = 8;
|
|
8120
8196
|
vertices = Utils.setArraySize(temp, verticesLength, 0);
|
|
8121
8197
|
attachment.computeWorldVertices(slot, vertices, 0, 2);
|
|
8198
|
+
triangles = Skeleton.quadTriangles;
|
|
8122
8199
|
}
|
|
8123
8200
|
else if (attachment instanceof MeshAttachment) {
|
|
8124
8201
|
var mesh = attachment;
|
|
8125
8202
|
verticesLength = mesh.worldVerticesLength;
|
|
8126
8203
|
vertices = Utils.setArraySize(temp, verticesLength, 0);
|
|
8127
8204
|
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
|
|
8205
|
+
triangles = mesh.triangles;
|
|
8206
|
+
}
|
|
8207
|
+
else if (attachment instanceof ClippingAttachment && clipper != null) {
|
|
8208
|
+
clipper.clipStart(slot, attachment);
|
|
8209
|
+
continue;
|
|
8128
8210
|
}
|
|
8129
|
-
if (vertices) {
|
|
8211
|
+
if (vertices && triangles) {
|
|
8212
|
+
if (clipper != null && clipper.isClipping()) {
|
|
8213
|
+
clipper.clipTriangles(vertices, verticesLength, triangles, triangles.length);
|
|
8214
|
+
vertices = clipper.clippedVertices;
|
|
8215
|
+
verticesLength = clipper.clippedVertices.length;
|
|
8216
|
+
}
|
|
8130
8217
|
for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) {
|
|
8131
8218
|
var x = vertices[ii], y = vertices[ii + 1];
|
|
8132
8219
|
minX = Math.min(minX, x);
|
|
@@ -8135,7 +8222,11 @@ var Skeleton = /** @class */ (function () {
|
|
|
8135
8222
|
maxY = Math.max(maxY, y);
|
|
8136
8223
|
}
|
|
8137
8224
|
}
|
|
8225
|
+
if (clipper != null)
|
|
8226
|
+
clipper.clipEndWithSlot(slot);
|
|
8138
8227
|
}
|
|
8228
|
+
if (clipper != null)
|
|
8229
|
+
clipper.clipEnd();
|
|
8139
8230
|
offset.set(minX, minY);
|
|
8140
8231
|
size.set(maxX - minX, maxY - minY);
|
|
8141
8232
|
};
|
|
@@ -8143,6 +8234,18 @@ var Skeleton = /** @class */ (function () {
|
|
|
8143
8234
|
Skeleton.prototype.update = function (delta) {
|
|
8144
8235
|
this.time += delta;
|
|
8145
8236
|
};
|
|
8237
|
+
Skeleton.prototype.physicsTranslate = function (x, y) {
|
|
8238
|
+
var physicsConstraints = this.physicsConstraints;
|
|
8239
|
+
for (var i = 0, n = physicsConstraints.length; i < n; i++)
|
|
8240
|
+
physicsConstraints[i].translate(x, y);
|
|
8241
|
+
};
|
|
8242
|
+
/** Calls {@link PhysicsConstraint#rotate(float, float, float)} for each physics constraint. */
|
|
8243
|
+
Skeleton.prototype.physicsRotate = function (x, y, degrees) {
|
|
8244
|
+
var physicsConstraints = this.physicsConstraints;
|
|
8245
|
+
for (var i = 0, n = physicsConstraints.length; i < n; i++)
|
|
8246
|
+
physicsConstraints[i].rotate(x, y, degrees);
|
|
8247
|
+
};
|
|
8248
|
+
Skeleton.quadTriangles = [0, 1, 2, 2, 3, 0];
|
|
8146
8249
|
Skeleton.yDown = false;
|
|
8147
8250
|
return Skeleton;
|
|
8148
8251
|
}());
|
|
@@ -8172,6 +8275,7 @@ var PhysicsConstraintData = /** @class */ (function (_super) {
|
|
|
8172
8275
|
_this.rotate = 0;
|
|
8173
8276
|
_this.scaleX = 0;
|
|
8174
8277
|
_this.shearX = 0;
|
|
8278
|
+
_this.limit = 0;
|
|
8175
8279
|
_this.step = 0;
|
|
8176
8280
|
_this.inertia = 0;
|
|
8177
8281
|
_this.strength = 0;
|
|
@@ -8243,7 +8347,7 @@ var SkeletonData = /** @class */ (function () {
|
|
|
8243
8347
|
this.name = null;
|
|
8244
8348
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
8245
8349
|
this.bones = new Array(); // Ordered parents first.
|
|
8246
|
-
/** The skeleton's slots. */
|
|
8350
|
+
/** The skeleton's slots in the setup pose draw order. */
|
|
8247
8351
|
this.slots = new Array(); // Setup pose draw order.
|
|
8248
8352
|
this.skins = new Array();
|
|
8249
8353
|
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
|
|
@@ -8271,6 +8375,9 @@ var SkeletonData = /** @class */ (function () {
|
|
|
8271
8375
|
this.width = 0;
|
|
8272
8376
|
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
|
8273
8377
|
this.height = 0;
|
|
8378
|
+
/** Baseline scale factor for applying distance-dependent effects on non-scalable properties, such as angle or scale. Default
|
|
8379
|
+
* is 100. */
|
|
8380
|
+
this.referenceScale = 100;
|
|
8274
8381
|
/** The Spine version used to export the skeleton data, or null. */
|
|
8275
8382
|
this.version = null;
|
|
8276
8383
|
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
|
@@ -8787,6 +8894,7 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8787
8894
|
skeletonData.y = input.readFloat();
|
|
8788
8895
|
skeletonData.width = input.readFloat();
|
|
8789
8896
|
skeletonData.height = input.readFloat();
|
|
8897
|
+
skeletonData.referenceScale = input.readFloat() * scale;
|
|
8790
8898
|
var nonessential = input.readBoolean();
|
|
8791
8899
|
if (nonessential) {
|
|
8792
8900
|
skeletonData.fps = input.readFloat();
|
|
@@ -8818,7 +8926,7 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8818
8926
|
data.shearX = input.readFloat();
|
|
8819
8927
|
data.shearY = input.readFloat();
|
|
8820
8928
|
data.length = input.readFloat() * scale;
|
|
8821
|
-
data.
|
|
8929
|
+
data.inherit = input.readByte();
|
|
8822
8930
|
data.skinRequired = input.readBoolean();
|
|
8823
8931
|
if (nonessential) {
|
|
8824
8932
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
@@ -8857,14 +8965,16 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8857
8965
|
for (var ii = 0; ii < nn; ii++)
|
|
8858
8966
|
data.bones.push(skeletonData.bones[input.readInt(true)]);
|
|
8859
8967
|
data.target = skeletonData.bones[input.readInt(true)];
|
|
8860
|
-
data.mix = input.readFloat();
|
|
8861
|
-
data.softness = input.readFloat() * scale;
|
|
8862
8968
|
var flags = input.readByte();
|
|
8863
8969
|
data.skinRequired = (flags & 1) != 0;
|
|
8864
8970
|
data.bendDirection = (flags & 2) != 0 ? 1 : -1;
|
|
8865
8971
|
data.compress = (flags & 4) != 0;
|
|
8866
8972
|
data.stretch = (flags & 8) != 0;
|
|
8867
8973
|
data.uniform = (flags & 16) != 0;
|
|
8974
|
+
if ((flags & 32) != 0)
|
|
8975
|
+
data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
|
|
8976
|
+
if ((flags & 128) != 0)
|
|
8977
|
+
data.softness = input.readFloat() * scale;
|
|
8868
8978
|
skeletonData.ikConstraints.push(data);
|
|
8869
8979
|
}
|
|
8870
8980
|
// Transform constraints.
|
|
@@ -8883,18 +8993,31 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8883
8993
|
data.skinRequired = (flags & 1) != 0;
|
|
8884
8994
|
data.local = (flags & 2) != 0;
|
|
8885
8995
|
data.relative = (flags & 4) != 0;
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8996
|
+
if ((flags & 8) != 0)
|
|
8997
|
+
data.offsetRotation = input.readFloat();
|
|
8998
|
+
if ((flags & 16) != 0)
|
|
8999
|
+
data.offsetX = input.readFloat() * scale;
|
|
9000
|
+
if ((flags & 32) != 0)
|
|
9001
|
+
data.offsetY = input.readFloat() * scale;
|
|
9002
|
+
if ((flags & 64) != 0)
|
|
9003
|
+
data.offsetScaleX = input.readFloat();
|
|
9004
|
+
if ((flags & 128) != 0)
|
|
9005
|
+
data.offsetScaleY = input.readFloat();
|
|
9006
|
+
flags = input.readByte();
|
|
9007
|
+
if ((flags & 1) != 0)
|
|
9008
|
+
data.offsetShearY = input.readFloat();
|
|
9009
|
+
if ((flags & 2) != 0)
|
|
9010
|
+
data.mixRotate = input.readFloat();
|
|
9011
|
+
if ((flags & 4) != 0)
|
|
9012
|
+
data.mixX = input.readFloat();
|
|
9013
|
+
if ((flags & 8) != 0)
|
|
9014
|
+
data.mixY = input.readFloat();
|
|
9015
|
+
if ((flags & 16) != 0)
|
|
9016
|
+
data.mixScaleX = input.readFloat();
|
|
9017
|
+
if ((flags & 32) != 0)
|
|
9018
|
+
data.mixScaleY = input.readFloat();
|
|
9019
|
+
if ((flags & 64) != 0)
|
|
9020
|
+
data.mixShearY = input.readFloat();
|
|
8898
9021
|
skeletonData.transformConstraints.push(data);
|
|
8899
9022
|
}
|
|
8900
9023
|
// Path constraints.
|
|
@@ -8910,10 +9033,12 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8910
9033
|
for (var ii = 0; ii < nn; ii++)
|
|
8911
9034
|
data.bones.push(skeletonData.bones[input.readInt(true)]);
|
|
8912
9035
|
data.target = skeletonData.slots[input.readInt(true)];
|
|
8913
|
-
|
|
8914
|
-
data.
|
|
8915
|
-
data.
|
|
8916
|
-
data.
|
|
9036
|
+
var flags = input.readByte();
|
|
9037
|
+
data.positionMode = flags & 1;
|
|
9038
|
+
data.spacingMode = (flags >> 1) & 3;
|
|
9039
|
+
data.rotateMode = (flags >> 3) & 3;
|
|
9040
|
+
if ((flags & 128) != 0)
|
|
9041
|
+
data.offsetRotation = input.readFloat();
|
|
8917
9042
|
data.position = input.readFloat();
|
|
8918
9043
|
if (data.positionMode == exports.PositionMode.Fixed)
|
|
8919
9044
|
data.position *= scale;
|
|
@@ -8946,14 +9071,14 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8946
9071
|
data.scaleX = input.readFloat();
|
|
8947
9072
|
if ((flags & 32) != 0)
|
|
8948
9073
|
data.shearX = input.readFloat();
|
|
8949
|
-
data.
|
|
9074
|
+
data.limit = ((flags & 64) != 0 ? input.readFloat() : 5000) * scale;
|
|
9075
|
+
data.step = 1 / input.readUnsignedByte();
|
|
8950
9076
|
data.inertia = input.readFloat();
|
|
8951
9077
|
data.strength = input.readFloat();
|
|
8952
9078
|
data.damping = input.readFloat();
|
|
8953
|
-
data.massInverse = input.readFloat();
|
|
8954
|
-
data.wind = input.readFloat()
|
|
8955
|
-
data.gravity = input.readFloat()
|
|
8956
|
-
data.mix = input.readFloat();
|
|
9079
|
+
data.massInverse = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
9080
|
+
data.wind = input.readFloat();
|
|
9081
|
+
data.gravity = input.readFloat();
|
|
8957
9082
|
flags = input.readByte();
|
|
8958
9083
|
if ((flags & 1) != 0)
|
|
8959
9084
|
data.inertiaGlobal = true;
|
|
@@ -8969,6 +9094,7 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
8969
9094
|
data.gravityGlobal = true;
|
|
8970
9095
|
if ((flags & 64) != 0)
|
|
8971
9096
|
data.mixGlobal = true;
|
|
9097
|
+
data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
8972
9098
|
skeletonData.physicsConstraints.push(data);
|
|
8973
9099
|
}
|
|
8974
9100
|
// Default skin.
|
|
@@ -9084,7 +9210,7 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
9084
9210
|
var path = (flags & 16) != 0 ? input.readStringRef() : null;
|
|
9085
9211
|
var color = (flags & 32) != 0 ? input.readInt32() : 0xffffffff;
|
|
9086
9212
|
var sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
9087
|
-
var rotation = input.readFloat();
|
|
9213
|
+
var rotation = (flags & 128) != 0 ? input.readFloat() : 0;
|
|
9088
9214
|
var x = input.readFloat();
|
|
9089
9215
|
var y = input.readFloat();
|
|
9090
9216
|
var scaleX = input.readFloat();
|
|
@@ -9243,8 +9369,6 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
9243
9369
|
return null;
|
|
9244
9370
|
};
|
|
9245
9371
|
SkeletonBinary.prototype.readSequence = function (input) {
|
|
9246
|
-
if (!input.readBoolean())
|
|
9247
|
-
return null;
|
|
9248
9372
|
var sequence = new Sequence(input.readInt(true));
|
|
9249
9373
|
sequence.start = input.readInt(true);
|
|
9250
9374
|
sequence.digits = input.readInt(true);
|
|
@@ -9501,7 +9625,16 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
9501
9625
|
for (var i = 0, n = input.readInt(true); i < n; i++) {
|
|
9502
9626
|
var boneIndex = input.readInt(true);
|
|
9503
9627
|
for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
9504
|
-
var type = input.readByte(), frameCount = input.readInt(true)
|
|
9628
|
+
var type = input.readByte(), frameCount = input.readInt(true);
|
|
9629
|
+
if (type == BONE_INHERIT) {
|
|
9630
|
+
var timeline = new InheritTimeline(frameCount, boneIndex);
|
|
9631
|
+
for (var frame = 0; frame < frameCount; frame++) {
|
|
9632
|
+
timeline.setFrame(frame, input.readFloat(), input.readByte());
|
|
9633
|
+
}
|
|
9634
|
+
timelines.push(timeline);
|
|
9635
|
+
continue;
|
|
9636
|
+
}
|
|
9637
|
+
var bezierCount = input.readInt(true);
|
|
9505
9638
|
switch (type) {
|
|
9506
9639
|
case BONE_ROTATE:
|
|
9507
9640
|
timelines.push(readTimeline1$1(input, new RotateTimeline(frameCount, bezierCount, boneIndex), 1));
|
|
@@ -9539,20 +9672,22 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
9539
9672
|
for (var i = 0, n = input.readInt(true); i < n; i++) {
|
|
9540
9673
|
var index = input.readInt(true), frameCount = input.readInt(true), frameLast = frameCount - 1;
|
|
9541
9674
|
var timeline = new IkConstraintTimeline(frameCount, input.readInt(true), index);
|
|
9542
|
-
var
|
|
9675
|
+
var flags = input.readByte();
|
|
9676
|
+
var time = input.readFloat(), mix = (flags & 1) != 0 ? ((flags & 2) != 0 ? input.readFloat() : 1) : 0;
|
|
9677
|
+
var softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9543
9678
|
for (var frame = 0, bezier = 0;; frame++) {
|
|
9544
|
-
|
|
9545
|
-
timeline.setFrame(frame, time, mix, softness, input.readByte(), (flags & 1) != 0, (flags & 2) != 0);
|
|
9679
|
+
timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
|
|
9546
9680
|
if (frame == frameLast)
|
|
9547
9681
|
break;
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9682
|
+
flags = input.readByte();
|
|
9683
|
+
var time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? ((flags & 2) != 0 ? input.readFloat() : 1) : 0;
|
|
9684
|
+
var softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9685
|
+
if ((flags & 64) != 0) {
|
|
9686
|
+
timeline.setStepped(frame);
|
|
9687
|
+
}
|
|
9688
|
+
else if ((flags & 128) != 0) {
|
|
9689
|
+
setBezier(input, timeline, bezier++, frame, 0, time, time2, mix, mix2, 1);
|
|
9690
|
+
setBezier(input, timeline, bezier++, frame, 1, time, time2, softness, softness2, scale);
|
|
9556
9691
|
}
|
|
9557
9692
|
time = time2;
|
|
9558
9693
|
mix = mix2;
|
|
@@ -9660,10 +9795,10 @@ var SkeletonBinary = /** @class */ (function () {
|
|
|
9660
9795
|
timelines.push(readTimeline1$1(input, new PhysicsConstraintMassTimeline(frameCount, bezierCount, index), 1));
|
|
9661
9796
|
break;
|
|
9662
9797
|
case PHYSICS_WIND:
|
|
9663
|
-
timelines.push(readTimeline1$1(input, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index),
|
|
9798
|
+
timelines.push(readTimeline1$1(input, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index), 1));
|
|
9664
9799
|
break;
|
|
9665
9800
|
case PHYSICS_GRAVITY:
|
|
9666
|
-
timelines.push(readTimeline1$1(input, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index),
|
|
9801
|
+
timelines.push(readTimeline1$1(input, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index), 1));
|
|
9667
9802
|
break;
|
|
9668
9803
|
case PHYSICS_MIX:
|
|
9669
9804
|
timelines.push(readTimeline1$1(input, new PhysicsConstraintMixTimeline(frameCount, bezierCount, index), 1));
|
|
@@ -9977,6 +10112,7 @@ var BONE_SCALEY = 6;
|
|
|
9977
10112
|
var BONE_SHEAR = 7;
|
|
9978
10113
|
var BONE_SHEARX = 8;
|
|
9979
10114
|
var BONE_SHEARY = 9;
|
|
10115
|
+
var BONE_INHERIT = 10;
|
|
9980
10116
|
var SLOT_ATTACHMENT = 0;
|
|
9981
10117
|
var SLOT_RGBA = 1;
|
|
9982
10118
|
var SLOT_RGB = 2;
|
|
@@ -10535,6 +10671,73 @@ var SkeletonClipping = /** @class */ (function () {
|
|
|
10535
10671
|
return this.clipAttachment != null;
|
|
10536
10672
|
};
|
|
10537
10673
|
SkeletonClipping.prototype.clipTriangles = function (vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor) {
|
|
10674
|
+
if (uvs && light && dark && typeof twoColor === 'boolean')
|
|
10675
|
+
this.clipTrianglesRender(vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor);
|
|
10676
|
+
else
|
|
10677
|
+
this.clipTrianglesNoRender(vertices, verticesLength, triangles, trianglesLength);
|
|
10678
|
+
};
|
|
10679
|
+
SkeletonClipping.prototype.clipTrianglesNoRender = function (vertices, verticesLength, triangles, trianglesLength) {
|
|
10680
|
+
var clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
10681
|
+
var clippedTriangles = this.clippedTriangles;
|
|
10682
|
+
var polygons = this.clippingPolygons;
|
|
10683
|
+
var polygonsCount = polygons.length;
|
|
10684
|
+
var vertexSize = 2;
|
|
10685
|
+
var index = 0;
|
|
10686
|
+
clippedVertices.length = 0;
|
|
10687
|
+
clippedTriangles.length = 0;
|
|
10688
|
+
outer: for (var i = 0; i < trianglesLength; i += 3) {
|
|
10689
|
+
var vertexOffset = triangles[i] << 1;
|
|
10690
|
+
var x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
|
|
10691
|
+
vertexOffset = triangles[i + 1] << 1;
|
|
10692
|
+
var x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
|
|
10693
|
+
vertexOffset = triangles[i + 2] << 1;
|
|
10694
|
+
var x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
|
|
10695
|
+
for (var p = 0; p < polygonsCount; p++) {
|
|
10696
|
+
var s = clippedVertices.length;
|
|
10697
|
+
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10698
|
+
var clipOutputLength = clipOutput.length;
|
|
10699
|
+
if (clipOutputLength == 0)
|
|
10700
|
+
continue;
|
|
10701
|
+
var clipOutputCount = clipOutputLength >> 1;
|
|
10702
|
+
var clipOutputItems = this.clipOutput;
|
|
10703
|
+
var clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize);
|
|
10704
|
+
for (var ii = 0; ii < clipOutputLength; ii += 2) {
|
|
10705
|
+
var x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
|
|
10706
|
+
clippedVerticesItems[s] = x;
|
|
10707
|
+
clippedVerticesItems[s + 1] = y;
|
|
10708
|
+
s += 2;
|
|
10709
|
+
}
|
|
10710
|
+
s = clippedTriangles.length;
|
|
10711
|
+
var clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));
|
|
10712
|
+
clipOutputCount--;
|
|
10713
|
+
for (var ii = 1; ii < clipOutputCount; ii++) {
|
|
10714
|
+
clippedTrianglesItems[s] = index;
|
|
10715
|
+
clippedTrianglesItems[s + 1] = (index + ii);
|
|
10716
|
+
clippedTrianglesItems[s + 2] = (index + ii + 1);
|
|
10717
|
+
s += 3;
|
|
10718
|
+
}
|
|
10719
|
+
index += clipOutputCount + 1;
|
|
10720
|
+
}
|
|
10721
|
+
else {
|
|
10722
|
+
var clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * vertexSize);
|
|
10723
|
+
clippedVerticesItems[s] = x1;
|
|
10724
|
+
clippedVerticesItems[s + 1] = y1;
|
|
10725
|
+
clippedVerticesItems[s + 2] = x2;
|
|
10726
|
+
clippedVerticesItems[s + 3] = y2;
|
|
10727
|
+
clippedVerticesItems[s + 4] = x3;
|
|
10728
|
+
clippedVerticesItems[s + 5] = y3;
|
|
10729
|
+
s = clippedTriangles.length;
|
|
10730
|
+
var clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);
|
|
10731
|
+
clippedTrianglesItems[s] = index;
|
|
10732
|
+
clippedTrianglesItems[s + 1] = (index + 1);
|
|
10733
|
+
clippedTrianglesItems[s + 2] = (index + 2);
|
|
10734
|
+
index += 3;
|
|
10735
|
+
continue outer;
|
|
10736
|
+
}
|
|
10737
|
+
}
|
|
10738
|
+
}
|
|
10739
|
+
};
|
|
10740
|
+
SkeletonClipping.prototype.clipTrianglesRender = function (vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor) {
|
|
10538
10741
|
var clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
|
|
10539
10742
|
var clippedTriangles = this.clippedTriangles;
|
|
10540
10743
|
var polygons = this.clippingPolygons;
|
|
@@ -10830,6 +11033,7 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10830
11033
|
this.attachmentLoader = attachmentLoader;
|
|
10831
11034
|
}
|
|
10832
11035
|
SkeletonJson.prototype.readSkeletonData = function (json) {
|
|
11036
|
+
var _a, _b;
|
|
10833
11037
|
var scale = this.scale;
|
|
10834
11038
|
var skeletonData = new SkeletonData();
|
|
10835
11039
|
var root = typeof (json) === "string" ? JSON.parse(json) : json;
|
|
@@ -10842,8 +11046,10 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10842
11046
|
skeletonData.y = skeletonMap.y;
|
|
10843
11047
|
skeletonData.width = skeletonMap.width;
|
|
10844
11048
|
skeletonData.height = skeletonMap.height;
|
|
11049
|
+
skeletonData.referenceScale = getValue(skeletonMap, "referenceScale", 100) * scale;
|
|
10845
11050
|
skeletonData.fps = skeletonMap.fps;
|
|
10846
|
-
skeletonData.imagesPath = skeletonMap.images;
|
|
11051
|
+
skeletonData.imagesPath = (_a = skeletonMap.images) !== null && _a !== void 0 ? _a : null;
|
|
11052
|
+
skeletonData.audioPath = (_b = skeletonMap.audio) !== null && _b !== void 0 ? _b : null;
|
|
10847
11053
|
}
|
|
10848
11054
|
// Bones
|
|
10849
11055
|
if (root.bones) {
|
|
@@ -10862,7 +11068,7 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10862
11068
|
data.scaleY = getValue(boneMap, "scaleY", 1);
|
|
10863
11069
|
data.shearX = getValue(boneMap, "shearX", 0);
|
|
10864
11070
|
data.shearY = getValue(boneMap, "shearY", 0);
|
|
10865
|
-
data.
|
|
11071
|
+
data.inherit = Utils.enumValue(exports.Inherit, getValue(boneMap, "inherit", "Normal"));
|
|
10866
11072
|
data.skinRequired = getValue(boneMap, "skin", false);
|
|
10867
11073
|
var color = getValue(boneMap, "color", null);
|
|
10868
11074
|
if (color)
|
|
@@ -10874,10 +11080,11 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10874
11080
|
if (root.slots) {
|
|
10875
11081
|
for (var i = 0; i < root.slots.length; i++) {
|
|
10876
11082
|
var slotMap = root.slots[i];
|
|
11083
|
+
var slotName = slotMap.name;
|
|
10877
11084
|
var boneData = skeletonData.findBone(slotMap.bone);
|
|
10878
11085
|
if (!boneData)
|
|
10879
|
-
throw new Error("Couldn't find bone ".concat(slotMap.bone, " for slot ").concat(
|
|
10880
|
-
var data = new SlotData(skeletonData.slots.length,
|
|
11086
|
+
throw new Error("Couldn't find bone ".concat(slotMap.bone, " for slot ").concat(slotName));
|
|
11087
|
+
var data = new SlotData(skeletonData.slots.length, slotName, boneData);
|
|
10881
11088
|
var color = getValue(slotMap, "color", null);
|
|
10882
11089
|
if (color)
|
|
10883
11090
|
data.color.setFromString(color);
|
|
@@ -10886,6 +11093,7 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10886
11093
|
data.darkColor = Color.fromString(dark);
|
|
10887
11094
|
data.attachmentName = getValue(slotMap, "attachment", null);
|
|
10888
11095
|
data.blendMode = Utils.enumValue(exports.BlendMode, getValue(slotMap, "blend", "normal"));
|
|
11096
|
+
data.visible = getValue(slotMap, "visible", true);
|
|
10889
11097
|
skeletonData.slots.push(data);
|
|
10890
11098
|
}
|
|
10891
11099
|
}
|
|
@@ -10986,8 +11194,8 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
10986
11194
|
skeletonData.pathConstraints.push(data);
|
|
10987
11195
|
}
|
|
10988
11196
|
}
|
|
11197
|
+
// Physics constraints.
|
|
10989
11198
|
if (root.physics) {
|
|
10990
|
-
// Physics constraints.
|
|
10991
11199
|
for (var i = 0; i < root.physics.length; i++) {
|
|
10992
11200
|
var constraintMap = root.physics[i];
|
|
10993
11201
|
var data = new PhysicsConstraintData(constraintMap.name);
|
|
@@ -11003,13 +11211,14 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
11003
11211
|
data.rotate = getValue(constraintMap, "rotate", 0);
|
|
11004
11212
|
data.scaleX = getValue(constraintMap, "scaleX", 0);
|
|
11005
11213
|
data.shearX = getValue(constraintMap, "shearX", 0);
|
|
11214
|
+
data.limit = getValue(constraintMap, "limit", 5000) * scale;
|
|
11006
11215
|
data.step = 1 / getValue(constraintMap, "fps", 60);
|
|
11007
11216
|
data.inertia = getValue(constraintMap, "inertia", 1);
|
|
11008
11217
|
data.strength = getValue(constraintMap, "strength", 100);
|
|
11009
11218
|
data.damping = getValue(constraintMap, "damping", 1);
|
|
11010
11219
|
data.massInverse = 1 / getValue(constraintMap, "mass", 1);
|
|
11011
|
-
data.wind = getValue(constraintMap, "wind", 0)
|
|
11012
|
-
data.gravity = getValue(constraintMap, "gravity", 0)
|
|
11220
|
+
data.wind = getValue(constraintMap, "wind", 0);
|
|
11221
|
+
data.gravity = getValue(constraintMap, "gravity", 0);
|
|
11013
11222
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
11014
11223
|
data.inertiaGlobal = getValue(constraintMap, "inertiaGlobal", false);
|
|
11015
11224
|
data.strengthGlobal = getValue(constraintMap, "strengthGlobal", false);
|
|
@@ -11475,6 +11684,14 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
11475
11684
|
var timeline = new ShearYTimeline(frames_2, frames_2, boneIndex);
|
|
11476
11685
|
timelines.push(readTimeline1(timelineMap, timeline, 0, 1));
|
|
11477
11686
|
}
|
|
11687
|
+
else if (timelineName === "inherit") {
|
|
11688
|
+
var timeline = new InheritTimeline(frames_2, bone.index);
|
|
11689
|
+
for (var frame = 0; frame < timelineMap.length; frame++) {
|
|
11690
|
+
var aFrame = timelineMap[frame];
|
|
11691
|
+
timeline.setFrame(frame, getValue(aFrame, "time", 0), Utils.enumValue(exports.Inherit, getValue(aFrame, "inherit", "Normal")));
|
|
11692
|
+
}
|
|
11693
|
+
timelines.push(timeline);
|
|
11694
|
+
}
|
|
11478
11695
|
}
|
|
11479
11696
|
}
|
|
11480
11697
|
}
|
|
@@ -11644,14 +11861,13 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
11644
11861
|
continue;
|
|
11645
11862
|
var frames_4 = timelineMap.length;
|
|
11646
11863
|
if (timelineName == "reset") {
|
|
11647
|
-
var timeline_1 = new PhysicsConstraintResetTimeline(
|
|
11864
|
+
var timeline_1 = new PhysicsConstraintResetTimeline(frames_4, constraintIndex);
|
|
11648
11865
|
for (var frame = 0; keyMap != null; keyMap = timelineMap[frame + 1], frame++)
|
|
11649
11866
|
timeline_1.setFrame(frame, getValue(keyMap, "time", 0));
|
|
11650
11867
|
timelines.push(timeline_1);
|
|
11651
11868
|
continue;
|
|
11652
11869
|
}
|
|
11653
11870
|
var timeline = void 0;
|
|
11654
|
-
var timelineScale = 1;
|
|
11655
11871
|
if (timelineName == "inertia")
|
|
11656
11872
|
timeline = new PhysicsConstraintInertiaTimeline(frames_4, frames_4, constraintIndex);
|
|
11657
11873
|
else if (timelineName == "strength")
|
|
@@ -11660,19 +11876,15 @@ var SkeletonJson = /** @class */ (function () {
|
|
|
11660
11876
|
timeline = new PhysicsConstraintDampingTimeline(frames_4, frames_4, constraintIndex);
|
|
11661
11877
|
else if (timelineName == "mass")
|
|
11662
11878
|
timeline = new PhysicsConstraintMassTimeline(frames_4, frames_4, constraintIndex);
|
|
11663
|
-
else if (timelineName == "wind")
|
|
11879
|
+
else if (timelineName == "wind")
|
|
11664
11880
|
timeline = new PhysicsConstraintWindTimeline(frames_4, frames_4, constraintIndex);
|
|
11665
|
-
|
|
11666
|
-
}
|
|
11667
|
-
else if (timelineName == "gravity") {
|
|
11881
|
+
else if (timelineName == "gravity")
|
|
11668
11882
|
timeline = new PhysicsConstraintGravityTimeline(frames_4, frames_4, constraintIndex);
|
|
11669
|
-
timelineScale = scale;
|
|
11670
|
-
}
|
|
11671
11883
|
else if (timelineName == "mix") //
|
|
11672
11884
|
timeline = new PhysicsConstraintMixTimeline(frames_4, frames_4, constraintIndex);
|
|
11673
11885
|
else
|
|
11674
11886
|
continue;
|
|
11675
|
-
timelines.push(readTimeline1(timelineMap, timeline, 0,
|
|
11887
|
+
timelines.push(readTimeline1(timelineMap, timeline, 0, 1));
|
|
11676
11888
|
}
|
|
11677
11889
|
}
|
|
11678
11890
|
}
|
|
@@ -12507,6 +12719,7 @@ var SpineVFXItem = /** @class */ (function (_super) {
|
|
|
12507
12719
|
this.skeleton = new Skeleton(this.skeletonData);
|
|
12508
12720
|
this.setSkin(spineOptions.activeSkin || (skinList.length ? skinList[0] : 'default'));
|
|
12509
12721
|
this.state = new AnimationState(this.animationStateData);
|
|
12722
|
+
this.resizeRule = spineOptions.resizeRule;
|
|
12510
12723
|
if (activeAnimation.length === 1) {
|
|
12511
12724
|
// 兼容旧JSON,根据时长计算速度
|
|
12512
12725
|
if (isNaN(spineOptions.speed)) {
|
|
@@ -12789,12 +13002,20 @@ var SpineVFXItem = /** @class */ (function (_super) {
|
|
|
12789
13002
|
// 将缩放比例设置到当前scale
|
|
12790
13003
|
SpineVFXItem.prototype.resize = function () {
|
|
12791
13004
|
var res = this.getBounds();
|
|
12792
|
-
if (!res) {
|
|
13005
|
+
if (!res || !this.composition) {
|
|
12793
13006
|
return;
|
|
12794
13007
|
}
|
|
12795
|
-
var width = res.width;
|
|
12796
13008
|
var scale = this.transform.scale;
|
|
12797
|
-
var
|
|
13009
|
+
var width = res.width;
|
|
13010
|
+
var scaleFactor;
|
|
13011
|
+
if (this.resizeRule) {
|
|
13012
|
+
var z = this.transform.getWorldPosition().z;
|
|
13013
|
+
var rx = this.composition.camera.getInverseVPRatio(z).x;
|
|
13014
|
+
scaleFactor = rx / 1500;
|
|
13015
|
+
}
|
|
13016
|
+
else {
|
|
13017
|
+
scaleFactor = 1 / width;
|
|
13018
|
+
}
|
|
12798
13019
|
this.scaleFactor = scaleFactor;
|
|
12799
13020
|
this.transform.setScale(this.startSize * scaleFactor, this.startSize * scaleFactor, scale.z);
|
|
12800
13021
|
};
|
|
@@ -12966,7 +13187,7 @@ var SpineLoader = /** @class */ (function (_super) {
|
|
|
12966
13187
|
}(effects.AbstractPlugin));
|
|
12967
13188
|
|
|
12968
13189
|
effects.registerPlugin('spine', SpineLoader, SpineVFXItem);
|
|
12969
|
-
var version = "1.4.
|
|
13190
|
+
var version = "1.4.5-alpha.0";
|
|
12970
13191
|
effects.logger.info('plugin spine version: ' + version);
|
|
12971
13192
|
|
|
12972
13193
|
exports.AlphaTimeline = AlphaTimeline;
|
|
@@ -13005,6 +13226,7 @@ exports.HOLD_SUBSEQUENT = HOLD_SUBSEQUENT;
|
|
|
13005
13226
|
exports.IkConstraint = IkConstraint;
|
|
13006
13227
|
exports.IkConstraintData = IkConstraintData;
|
|
13007
13228
|
exports.IkConstraintTimeline = IkConstraintTimeline;
|
|
13229
|
+
exports.InheritTimeline = InheritTimeline;
|
|
13008
13230
|
exports.IntSet = IntSet;
|
|
13009
13231
|
exports.Interpolation = Interpolation;
|
|
13010
13232
|
exports.MathUtils = MathUtils;
|