mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-08 16:24:53 +08:00
[ts] Port to 4.3 (WIP)
This commit is contained in:
parent
4225089764
commit
2f23421112
@ -167,10 +167,10 @@ export class BonePose extends BoneLocal implements Update {
|
||||
const zd = Math.sin(this.rotation) * s;
|
||||
this.shearX *= MathUtils.degRad;
|
||||
this.shearY = (90 + shearY) * MathUtils.degRad;
|
||||
const la = Math.cos(shearX) * scaleX;
|
||||
const lb = Math.cos(shearY) * scaleY;
|
||||
const lc = Math.sin(shearX) * scaleX;
|
||||
const ld = Math.sin(shearY) * scaleY;
|
||||
const la = Math.cos(this.shearX) * scaleX;
|
||||
const lb = Math.cos(this.shearY) * scaleY;
|
||||
const lc = Math.sin(this.shearX) * scaleX;
|
||||
const ld = Math.sin(this.shearY) * scaleY;
|
||||
this.a = za * la + zb * lc;
|
||||
this.b = za * lb + zb * ld;
|
||||
this.c = zc * la + zd * lc;
|
||||
|
||||
@ -71,7 +71,7 @@ export class PathConstraint extends Constraint<PathConstraint, PathConstraintDat
|
||||
for (const boneData of this.data.bones)
|
||||
this.bones.push(skeleton.bones[boneData.index].constrained);
|
||||
|
||||
this.slot = skeleton.slots[data.slot.index];;
|
||||
this.slot = skeleton.slots[data.slot.index];
|
||||
}
|
||||
|
||||
public copy (skeleton: Skeleton) {
|
||||
|
||||
@ -127,7 +127,7 @@ export class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
|
||||
return;
|
||||
case Physics.reset:
|
||||
this.reset(skeleton);
|
||||
// Fall through.
|
||||
// Fall through.
|
||||
case Physics.update:
|
||||
const delta = Math.max(skeleton.time - this.lastTime, 0), aa = this.remaining;
|
||||
this.remaining += delta;
|
||||
@ -209,7 +209,6 @@ export class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
|
||||
let r = l * bone.getWorldScaleX() - this.scaleLag * Math.max(0, 1 - aa / t);
|
||||
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
||||
}
|
||||
a = this.remaining;
|
||||
if (a >= t) {
|
||||
if (d == -1) {
|
||||
d = Math.pow(p.damping, 60 * t);
|
||||
|
||||
@ -232,7 +232,7 @@ export class Skeleton {
|
||||
sortReset (bones: Array<Bone>) {
|
||||
for (let i = 0, n = bones.length; i < n; i++) {
|
||||
let bone = bones[i];
|
||||
if (!bone.active) {
|
||||
if (bone.active) {
|
||||
if (bone.sorted) this.sortReset(bone.children);
|
||||
bone.sorted = false;
|
||||
}
|
||||
|
||||
@ -254,8 +254,6 @@ export class SkeletonBinary {
|
||||
}
|
||||
case CONSTRAINT_PATH: {
|
||||
let data = new PathConstraintData(name);
|
||||
data.skinRequired = input.readBoolean();
|
||||
nn = input.readInt(true);
|
||||
for (let ii = 0; ii < nn; ii++)
|
||||
data.bones.push(bones[input.readInt(true)]);
|
||||
data.slot = skeletonData.slots[input.readInt(true)];
|
||||
@ -307,7 +305,7 @@ export class SkeletonBinary {
|
||||
constraints.push(data);
|
||||
break;
|
||||
}
|
||||
case CONSTRAINT_PHYSICS: {
|
||||
case CONSTRAINT_SLIDER: {
|
||||
const data = new SliderData(name);
|
||||
data.skinRequired = (nn & 1) != 0;
|
||||
data.loop = (nn & 2) != 0;
|
||||
|
||||
@ -202,34 +202,34 @@ export class SkeletonJson {
|
||||
let to: ToProperty;
|
||||
switch (name) {
|
||||
case "rotate": {
|
||||
rotate = true
|
||||
rotate = true;
|
||||
to = new ToRotate();
|
||||
break;
|
||||
}
|
||||
case "x": {
|
||||
x = true
|
||||
x = true;
|
||||
to = new ToX();
|
||||
toScale = scale;
|
||||
break;
|
||||
}
|
||||
case "y": {
|
||||
y = true
|
||||
y = true;
|
||||
to = new ToY();
|
||||
toScale = scale;
|
||||
break;
|
||||
}
|
||||
case "scaleX": {
|
||||
scaleX = true
|
||||
scaleX = true;
|
||||
to = new ToScaleX();
|
||||
break;
|
||||
}
|
||||
case "scaleY": {
|
||||
scaleY = true
|
||||
scaleY = true;
|
||||
to = new ToScaleY();
|
||||
break;
|
||||
}
|
||||
case "shearY": {
|
||||
shearY = true
|
||||
shearY = true;
|
||||
to = new ToShearY();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ export class Spine extends ViewContainer {
|
||||
this.updateAndSetPixiMask(slot, i === currentDrawOrder.length - 1);
|
||||
|
||||
const pose = slot.pose;
|
||||
const attachment = pose;
|
||||
const attachment = pose.attachment;
|
||||
|
||||
if (attachment) {
|
||||
if (attachment instanceof MeshAttachment || attachment instanceof RegionAttachment) {
|
||||
@ -691,6 +691,7 @@ export class Spine extends ViewContainer {
|
||||
}
|
||||
}
|
||||
else if (attachment instanceof ClippingAttachment) {
|
||||
clipper.clipEnd(slot);
|
||||
clipper.clipStart(skeleton, slot, attachment);
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user