@esotericsoftware/spine-core 4.2.7 → 4.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimationState.js +15 -11
- package/dist/Bone.js +52 -12
- package/dist/attachments/RegionAttachment.js +15 -4
- package/dist/iife/spine-core.js +75 -20
- package/dist/iife/spine-core.js.map +2 -2
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
package/dist/iife/spine-core.js
CHANGED
|
@@ -2820,13 +2820,18 @@ var spine = (() => {
|
|
|
2820
2820
|
lastTotal = timelinesRotation[i];
|
|
2821
2821
|
lastDiff = timelinesRotation[i + 1];
|
|
2822
2822
|
}
|
|
2823
|
-
let
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2823
|
+
let loops = lastTotal - lastTotal % 360;
|
|
2824
|
+
total = diff + loops;
|
|
2825
|
+
let current = diff >= 0, dir = lastTotal >= 0;
|
|
2826
|
+
if (Math.abs(lastDiff) <= 90 && MathUtils.signum(lastDiff) != MathUtils.signum(diff)) {
|
|
2827
|
+
if (Math.abs(lastTotal - loops) > 180) {
|
|
2828
|
+
total += 360 * MathUtils.signum(lastTotal);
|
|
2829
|
+
dir = current;
|
|
2830
|
+
} else if (loops != 0)
|
|
2831
|
+
total -= 360 * MathUtils.signum(lastTotal);
|
|
2832
|
+
else
|
|
2833
|
+
dir = current;
|
|
2828
2834
|
}
|
|
2829
|
-
total = diff + lastTotal - lastTotal % 360;
|
|
2830
2835
|
if (dir != current)
|
|
2831
2836
|
total += 360 * MathUtils.signum(lastTotal);
|
|
2832
2837
|
timelinesRotation[i] = total;
|
|
@@ -3872,6 +3877,18 @@ var spine = (() => {
|
|
|
3872
3877
|
if (!this.region)
|
|
3873
3878
|
throw new Error("Region not set.");
|
|
3874
3879
|
let region = this.region;
|
|
3880
|
+
let uvs = this.uvs;
|
|
3881
|
+
if (region == null) {
|
|
3882
|
+
uvs[0] = 0;
|
|
3883
|
+
uvs[1] = 0;
|
|
3884
|
+
uvs[2] = 0;
|
|
3885
|
+
uvs[3] = 1;
|
|
3886
|
+
uvs[4] = 1;
|
|
3887
|
+
uvs[5] = 1;
|
|
3888
|
+
uvs[6] = 1;
|
|
3889
|
+
uvs[7] = 0;
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3875
3892
|
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
|
|
3876
3893
|
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
|
|
3877
3894
|
let localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
|
|
@@ -3899,16 +3916,15 @@ var spine = (() => {
|
|
|
3899
3916
|
offset[5] = localY2Cos + localX2Sin;
|
|
3900
3917
|
offset[6] = localX2Cos - localYSin;
|
|
3901
3918
|
offset[7] = localYCos + localX2Sin;
|
|
3902
|
-
let uvs = this.uvs;
|
|
3903
3919
|
if (region.degrees == 90) {
|
|
3920
|
+
uvs[0] = region.u2;
|
|
3921
|
+
uvs[1] = region.v2;
|
|
3904
3922
|
uvs[2] = region.u;
|
|
3905
3923
|
uvs[3] = region.v2;
|
|
3906
3924
|
uvs[4] = region.u;
|
|
3907
3925
|
uvs[5] = region.v;
|
|
3908
3926
|
uvs[6] = region.u2;
|
|
3909
3927
|
uvs[7] = region.v;
|
|
3910
|
-
uvs[0] = region.u2;
|
|
3911
|
-
uvs[1] = region.v2;
|
|
3912
3928
|
} else {
|
|
3913
3929
|
uvs[0] = region.u;
|
|
3914
3930
|
uvs[1] = region.v2;
|
|
@@ -4277,23 +4293,62 @@ var spine = (() => {
|
|
|
4277
4293
|
}
|
|
4278
4294
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
4279
4295
|
let pid = 1 / (pa * pd - pb * pc);
|
|
4296
|
+
let ia = pd * pid, ib = pb * pid, ic = pc * pid, id = pa * pid;
|
|
4280
4297
|
let dx = this.worldX - parent.worldX, dy = this.worldY - parent.worldY;
|
|
4281
|
-
this.ax = dx *
|
|
4282
|
-
this.ay = dy *
|
|
4283
|
-
let
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4298
|
+
this.ax = dx * ia - dy * ib;
|
|
4299
|
+
this.ay = dy * id - dx * ic;
|
|
4300
|
+
let ra, rb, rc, rd;
|
|
4301
|
+
if (this.data.transformMode == TransformMode.OnlyTranslation) {
|
|
4302
|
+
ra = this.a;
|
|
4303
|
+
rb = this.b;
|
|
4304
|
+
rc = this.c;
|
|
4305
|
+
rd = this.d;
|
|
4306
|
+
} else {
|
|
4307
|
+
switch (this.data.transformMode) {
|
|
4308
|
+
case TransformMode.NoRotationOrReflection: {
|
|
4309
|
+
let s2 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4310
|
+
let sa = pa / this.skeleton.scaleX;
|
|
4311
|
+
let sc = pc / this.skeleton.scaleY;
|
|
4312
|
+
pb = -sc * s2 * this.skeleton.scaleX;
|
|
4313
|
+
pd = sa * s2 * this.skeleton.scaleY;
|
|
4314
|
+
pid = 1 / (pa * pd - pb * pc);
|
|
4315
|
+
ia = pd * pid;
|
|
4316
|
+
ib = pb * pid;
|
|
4317
|
+
break;
|
|
4318
|
+
}
|
|
4319
|
+
case TransformMode.NoScale:
|
|
4320
|
+
case TransformMode.NoScaleOrReflection:
|
|
4321
|
+
let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
|
|
4322
|
+
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
4323
|
+
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
4324
|
+
let s = Math.sqrt(pa * pa + pc * pc);
|
|
4325
|
+
if (s > 1e-5)
|
|
4326
|
+
s = 1 / s;
|
|
4327
|
+
pa *= s;
|
|
4328
|
+
pc *= s;
|
|
4329
|
+
s = Math.sqrt(pa * pa + pc * pc);
|
|
4330
|
+
if (this.data.transformMode == TransformMode.NoScale && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4331
|
+
s = -s;
|
|
4332
|
+
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
4333
|
+
pb = Math.cos(r) * s;
|
|
4334
|
+
pd = Math.sin(r) * s;
|
|
4335
|
+
pid = 1 / (pa * pd - pb * pc);
|
|
4336
|
+
ia = pd * pid;
|
|
4337
|
+
ib = pb * pid;
|
|
4338
|
+
ic = pc * pid;
|
|
4339
|
+
id = pa * pid;
|
|
4340
|
+
}
|
|
4341
|
+
ra = ia * this.a - ib * this.c;
|
|
4342
|
+
rb = ia * this.b - ib * this.d;
|
|
4343
|
+
rc = id * this.c - ic * this.a;
|
|
4344
|
+
rd = id * this.d - ic * this.b;
|
|
4345
|
+
}
|
|
4291
4346
|
this.ashearX = 0;
|
|
4292
4347
|
this.ascaleX = Math.sqrt(ra * ra + rc * rc);
|
|
4293
4348
|
if (this.ascaleX > 1e-4) {
|
|
4294
4349
|
let det = ra * rd - rb * rc;
|
|
4295
4350
|
this.ascaleY = det / this.ascaleX;
|
|
4296
|
-
this.ashearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;
|
|
4351
|
+
this.ashearY = -Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;
|
|
4297
4352
|
this.arotation = Math.atan2(rc, ra) * MathUtils.radDeg;
|
|
4298
4353
|
} else {
|
|
4299
4354
|
this.ascaleX = 0;
|