mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
parent
07d3633881
commit
6ae45f1a5a
4
spine-ts/build/spine-all.d.ts
vendored
4
spine-ts/build/spine-all.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1327,7 +1327,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-canvas.d.ts
vendored
2
spine-ts/build/spine-canvas.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-core.d.ts
vendored
2
spine-ts/build/spine-core.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-player.d.ts
vendored
4
spine-ts/build/spine-player.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1296,7 +1296,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-threejs.d.ts
vendored
2
spine-ts/build/spine-threejs.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
spine-ts/build/spine-webgl.d.ts
vendored
4
spine-ts/build/spine-webgl.d.ts
vendored
@ -501,7 +501,7 @@ declare module spine {
|
||||
isActive(): boolean;
|
||||
update(): void;
|
||||
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number): void;
|
||||
apply2(parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1296,7 +1296,7 @@ declare module spine.webgl {
|
||||
static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL: boolean;
|
||||
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, image: HTMLImageElement | ImageBitmap, useMipMaps?: boolean);
|
||||
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear;
|
||||
static validateMagFilter(magFilter: TextureFilter): TextureFilter.Nearest | TextureFilter.Linear | TextureFilter.Linear;
|
||||
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
||||
update(useMipMaps: boolean): void;
|
||||
restore(): void;
|
||||
|
||||
@ -6,8 +6,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
@ -3397,7 +3395,7 @@ var spine;
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -3448,8 +3446,8 @@ var spine;
|
||||
}
|
||||
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
|
||||
};
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
||||
var px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
var os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -3472,7 +3470,7 @@ var spine;
|
||||
os2 = 0;
|
||||
var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
var u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -3500,7 +3498,7 @@ var spine;
|
||||
var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
var dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
var p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -3513,13 +3511,21 @@ var spine;
|
||||
outer: if (u) {
|
||||
l2 *= psx;
|
||||
var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
a2 = Math.PI * bendDir;
|
||||
}
|
||||
else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch)
|
||||
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform)
|
||||
sy *= a;
|
||||
}
|
||||
}
|
||||
else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -3536,7 +3542,7 @@ var spine;
|
||||
var q = Math.sqrt(d);
|
||||
if (c1 < 0)
|
||||
q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
var r0 = q / c2, r1 = c / q;
|
||||
var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -3567,7 +3573,7 @@ var spine;
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
@ -3583,7 +3589,7 @@ var spine;
|
||||
a1 -= 360;
|
||||
else if (a1 < -180)
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * spine.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -89,7 +89,7 @@ module spine {
|
||||
this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
|
||||
break;
|
||||
case 2:
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
|
||||
this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -146,8 +146,8 @@ module spine {
|
||||
|
||||
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
||||
* @param child A direct descendant of the parent bone. */
|
||||
apply2 (parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, softness: number, alpha: number) {
|
||||
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX;
|
||||
apply2 (parent: Bone, child: Bone, targetX: number, targetY: number, bendDir: number, stretch: boolean, uniform: boolean, softness: number, alpha: number) {
|
||||
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
||||
let os1 = 0, os2 = 0, s2 = 0;
|
||||
if (psx < 0) {
|
||||
psx = -psx;
|
||||
@ -168,7 +168,7 @@ module spine {
|
||||
os2 = 0;
|
||||
let cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = parent.a, b = parent.b, c = parent.c, d = parent.d;
|
||||
let u = Math.abs(psx - psy) <= 0.0001;
|
||||
if (!u) {
|
||||
if (!u || stretch) {
|
||||
cy = 0;
|
||||
cwx = a * cx + parent.worldX;
|
||||
cwy = c * cx + parent.worldY;
|
||||
@ -195,7 +195,7 @@ module spine {
|
||||
let tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
let dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) / 2;
|
||||
softness *= psx * (csx + 1) * 0.5;
|
||||
let td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
let p = Math.min(1, sd / (softness * 2)) - 1;
|
||||
@ -209,12 +209,18 @@ module spine {
|
||||
if (u) {
|
||||
l2 *= psx;
|
||||
let cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
if (cos < -1)
|
||||
if (cos < -1) {
|
||||
cos = -1;
|
||||
else if (cos > 1) {
|
||||
a2 = Math.PI * bendDir;
|
||||
} else if (cos > 1) {
|
||||
cos = 1;
|
||||
if (stretch) sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
a2 = 0;
|
||||
if (stretch) {
|
||||
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
||||
sx *= a;
|
||||
if (uniform) sy *= a;
|
||||
}
|
||||
} else
|
||||
a2 = Math.acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * Math.sin(a2);
|
||||
@ -229,7 +235,7 @@ module spine {
|
||||
if (d >= 0) {
|
||||
let q = Math.sqrt(d);
|
||||
if (c1 < 0) q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
q = -(c1 + q) * 0.5;
|
||||
let r0 = q / c2, r1 = c / q;
|
||||
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
@ -260,7 +266,7 @@ module spine {
|
||||
maxY = y;
|
||||
}
|
||||
}
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
if (dd <= (minDist + maxDist) * 0.5) {
|
||||
a1 = ta - Math.atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
} else {
|
||||
@ -275,7 +281,7 @@ module spine {
|
||||
a1 -= 360;
|
||||
else if (a1 < -180) //
|
||||
a1 += 360;
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0);
|
||||
rotation = child.arotation;
|
||||
a2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||
if (a2 > 180)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user