UNPKG

@pixi-spine/runtime-3.7

Version:

Pixi runtime for spine 3.7 models

28 lines (25 loc) 878 B
import { VertexAttachment } from './Attachment.mjs'; import { AttachmentType, Color, MathUtils } from '@pixi-spine/base'; class PointAttachment extends VertexAttachment { constructor(name) { super(name); this.type = AttachmentType.Point; this.color = new Color(0.38, 0.94, 0, 1); } computeWorldPosition(bone, point) { const mat = bone.matrix; point.x = this.x * mat.a + this.y * mat.c + bone.worldX; point.y = this.x * mat.b + this.y * mat.d + bone.worldY; return point; } computeWorldRotation(bone) { const mat = bone.matrix; const cos = MathUtils.cosDeg(this.rotation); const sin = MathUtils.sinDeg(this.rotation); const x = cos * mat.a + sin * mat.c; const y = cos * mat.b + sin * mat.d; return Math.atan2(y, x) * MathUtils.radDeg; } } export { PointAttachment }; //# sourceMappingURL=PointAttachment.mjs.map