微信小程序-省心预览工具

This commit is contained in:
Yeomai committed 2026-09-28 21:23:52 +08:00
commit edf1e51846
173 files changed
+78282

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
Spine Runtimes License Agreement
Last updated April 5, 2025. Replaces all prior versions.
Copyright (c) 2013-2025, Esoteric Software LLC
Integration of the Spine Runtimes into software or otherwise creating
derivative works of the Spine Runtimes is permitted under the terms and
conditions of Section 2 of the Spine Editor License Agreement:
http://esotericsoftware.com/spine-editor-license
Otherwise, it is permitted to integrate the Spine Runtimes into software
or otherwise create derivative works of the Spine Runtimes (collectively,
"Products"), provided that each user of the Products must obtain their own
Spine Editor license and redistribution of the Products in any form must
include this license and copyright notice.
THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+3
View File
@@ -0,0 +1,3 @@
# spine-ts core
Please see the top-level [README.md](../README.md) for more information.
+486
View File
@@ -0,0 +1,486 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { VertexAttachment, Attachment } from "./attachments/Attachment.js";
import { Skeleton } from "./Skeleton.js";
import { Slot } from "./Slot.js";
import { StringSet, NumberArrayLike } from "./Utils.js";
import { Event } from "./Event.js";
import { HasTextureRegion } from "./attachments/HasTextureRegion.js";
import { SequenceMode } from "./attachments/Sequence.js";
import { PhysicsConstraint } from "./PhysicsConstraint.js";
import { PhysicsConstraintData } from "./PhysicsConstraintData.js";
import { Inherit } from "./BoneData.js";
/** A simple container for a list of timelines and a name. */
export declare class Animation {
/** The animation's name, which is unique across all animations in the skeleton. */
name: string;
timelines: Array<Timeline>;
timelineIds: StringSet;
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
duration: number;
constructor(name: string, timelines: Array<Timeline>, duration: number);
setTimelines(timelines: Array<Timeline>): void;
hasTimeline(ids: string[]): boolean;
/** Applies all the animation's timelines to the specified skeleton.
*
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
* @param loop If true, the animation repeats after {@link #getDuration()}.
* @param events May be null to ignore fired events. */
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Controls how a timeline value is mixed with the setup pose value or current pose value when a timeline's `alpha`
* < 1.
*
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */
export declare enum MixBlend {
/** Transitions from the setup value to the timeline value (the current value is not used). Before the first key, the setup
* value is set. */
setup = 0,
/** Transitions from the current value to the timeline value. Before the first key, transitions from the current value to
* the setup value. Timelines which perform instant transitions, such as {@link DrawOrderTimeline} or
* {@link AttachmentTimeline}, use the setup value before the first key.
*
* `first` is intended for the first animations applied, not for animations layered on top of those. */
first = 1,
/** Transitions from the current value to the timeline value. No change is made before the first key (the current value is
* kept until the first key).
*
* `replace` is intended for animations layered on top of others, not for the first animations applied. */
replace = 2,
/** Transitions from the current value to the current value plus the timeline value. No change is made before the first key
* (the current value is kept until the first key).
*
* `add` is intended for animations layered on top of others, not for the first animations applied. Properties
* keyed by additive animations must be set manually or by another animation before applying the additive animations, else
* the property values will increase continually. */
add = 3
}
/** Indicates whether a timeline's `alpha` is mixing out over time toward 0 (the setup or current pose value) or
* mixing in toward 1 (the timeline's value).
*
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */
export declare enum MixDirection {
mixIn = 0,
mixOut = 1
}
/** The interface for all timelines. */
export declare abstract class Timeline {
propertyIds: string[];
frames: NumberArrayLike;
constructor(frameCount: number, propertyIds: string[]);
getPropertyIds(): string[];
getFrameEntries(): number;
getFrameCount(): number;
getDuration(): number;
abstract apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event> | null, alpha: number, blend: MixBlend, direction: MixDirection): void;
static search1(frames: NumberArrayLike, time: number): number;
static search(frames: NumberArrayLike, time: number, step: number): number;
}
export interface BoneTimeline {
/** The index of the bone in {@link Skeleton#bones} that will be changed. */
boneIndex: number;
}
export interface SlotTimeline {
/** The index of the slot in {@link Skeleton#slots} that will be changed. */
slotIndex: number;
}
/** The base class for timelines that use interpolation between key frame values. */
export declare abstract class CurveTimeline extends Timeline {
protected curves: NumberArrayLike;
constructor(frameCount: number, bezierCount: number, propertyIds: string[]);
/** Sets the specified key frame to linear interpolation. */
setLinear(frame: number): void;
/** Sets the specified key frame to stepped interpolation. */
setStepped(frame: number): void;
/** Shrinks the storage for Bezier curves, for use when <code>bezierCount</code> (specified in the constructor) was larger
* than the actual number of Bezier curves. */
shrink(bezierCount: number): void;
/** Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
* one curve per frame.
* @param bezier The ordinal of this Bezier curve for this timeline, between 0 and <code>bezierCount - 1</code> (specified
* in the constructor), inclusive.
* @param frame Between 0 and <code>frameCount - 1</code>, inclusive.
* @param value The index of the value for this frame that this curve is used for.
* @param time1 The time for the first key.
* @param value1 The value for the first key.
* @param cx1 The time for the first Bezier handle.
* @param cy1 The value for the first Bezier handle.
* @param cx2 The time of the second Bezier handle.
* @param cy2 The value for the second Bezier handle.
* @param time2 The time for the second key.
* @param value2 The value for the second key. */
setBezier(bezier: number, frame: number, value: number, time1: number, value1: number, cx1: number, cy1: number, cx2: number, cy2: number, time2: number, value2: number): void;
/** Returns the Bezier interpolated value for the specified time.
* @param frameIndex The index into {@link #getFrames()} for the values of the frame before <code>time</code>.
* @param valueOffset The offset from <code>frameIndex</code> to the value this curve is used for.
* @param i The index of the Bezier segments. See {@link #getCurveType(int)}. */
getBezierValue(time: number, frameIndex: number, valueOffset: number, i: number): number;
}
export declare abstract class CurveTimeline1 extends CurveTimeline {
constructor(frameCount: number, bezierCount: number, propertyId: string);
getFrameEntries(): number;
/** Sets the time and value for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds. */
setFrame(frame: number, time: number, value: number): void;
/** Returns the interpolated value for the specified time. */
getCurveValue(time: number): number;
getRelativeValue(time: number, alpha: number, blend: MixBlend, current: number, setup: number): number;
getAbsoluteValue(time: number, alpha: number, blend: MixBlend, current: number, setup: number): number;
getAbsoluteValue2(time: number, alpha: number, blend: MixBlend, current: number, setup: number, value: number): number;
getScaleValue(time: number, alpha: number, blend: MixBlend, direction: MixDirection, current: number, setup: number): number;
}
/** The base class for a {@link CurveTimeline} which sets two properties. */
export declare abstract class CurveTimeline2 extends CurveTimeline {
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
constructor(frameCount: number, bezierCount: number, propertyId1: string, propertyId2: string);
getFrameEntries(): number;
/** Sets the time and values for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds. */
setFrame(frame: number, time: number, value1: number, value2: number): void;
}
/** Changes a bone's local {@link Bone#rotation}. */
export declare class RotateTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event> | null, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#x} and {@link Bone#y}. */
export declare class TranslateTimeline extends CurveTimeline2 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#x}. */
export declare class TranslateXTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#x}. */
export declare class TranslateYTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#scaleX)} and {@link Bone#scaleY}. */
export declare class ScaleTimeline extends CurveTimeline2 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#scaleX)} and {@link Bone#scaleY}. */
export declare class ScaleXTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#scaleX)} and {@link Bone#scaleY}. */
export declare class ScaleYTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
export declare class ShearTimeline extends CurveTimeline2 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
export declare class ShearXTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
export declare class ShearYTimeline extends CurveTimeline1 implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, bezierCount: number, boneIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
export declare class InheritTimeline extends Timeline implements BoneTimeline {
boneIndex: number;
constructor(frameCount: number, boneIndex: number);
getFrameEntries(): number;
/** Sets the transform mode for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds. */
setFrame(frame: number, time: number, inherit: Inherit): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#color}. */
export declare class RGBATimeline extends CurveTimeline implements SlotTimeline {
slotIndex: number;
constructor(frameCount: number, bezierCount: number, slotIndex: number);
getFrameEntries(): number;
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
setFrame(frame: number, time: number, r: number, g: number, b: number, a: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#color}. */
export declare class RGBTimeline extends CurveTimeline implements SlotTimeline {
slotIndex: number;
constructor(frameCount: number, bezierCount: number, slotIndex: number);
getFrameEntries(): number;
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
setFrame(frame: number, time: number, r: number, g: number, b: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
export declare class AlphaTimeline extends CurveTimeline1 implements SlotTimeline {
slotIndex: number;
constructor(frameCount: number, bezierCount: number, slotIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#color} and {@link Slot#darkColor} for two color tinting. */
export declare class RGBA2Timeline extends CurveTimeline implements SlotTimeline {
slotIndex: number;
constructor(frameCount: number, bezierCount: number, slotIndex: number);
getFrameEntries(): number;
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
setFrame(frame: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#color} and {@link Slot#darkColor} for two color tinting. */
export declare class RGB2Timeline extends CurveTimeline implements SlotTimeline {
slotIndex: number;
constructor(frameCount: number, bezierCount: number, slotIndex: number);
getFrameEntries(): number;
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
setFrame(frame: number, time: number, r: number, g: number, b: number, r2: number, g2: number, b2: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#attachment}. */
export declare class AttachmentTimeline extends Timeline implements SlotTimeline {
slotIndex: number;
/** The attachment name for each key frame. May contain null values to clear the attachment. */
attachmentNames: Array<string | null>;
constructor(frameCount: number, slotIndex: number);
getFrameCount(): number;
/** Sets the time in seconds and the attachment name for the specified key frame. */
setFrame(frame: number, time: number, attachmentName: string | null): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string | null): void;
}
/** Changes a slot's {@link Slot#deform} to deform a {@link VertexAttachment}. */
export declare class DeformTimeline extends CurveTimeline implements SlotTimeline {
slotIndex: number;
/** The attachment that will be deformed. */
attachment: VertexAttachment;
/** The vertices for each key frame. */
vertices: Array<NumberArrayLike>;
constructor(frameCount: number, bezierCount: number, slotIndex: number, attachment: VertexAttachment);
getFrameCount(): number;
/** Sets the time in seconds and the vertices for the specified key frame.
* @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */
setFrame(frame: number, time: number, vertices: NumberArrayLike): void;
/** @param value1 Ignored (0 is used for a deform timeline).
* @param value2 Ignored (1 is used for a deform timeline). */
setBezier(bezier: number, frame: number, value: number, time1: number, value1: number, cx1: number, cy1: number, cx2: number, cy2: number, time2: number, value2: number): void;
getCurvePercent(time: number, frame: number): number;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Fires an {@link Event} when specific animation times are reached. */
export declare class EventTimeline extends Timeline {
static propertyIds: string[];
/** The event for each key frame. */
events: Array<Event>;
constructor(frameCount: number);
getFrameCount(): number;
/** Sets the time in seconds and the event for the specified key frame. */
setFrame(frame: number, event: Event): void;
/** Fires events for frames > `lastTime` and <= `time`. */
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a skeleton's {@link Skeleton#drawOrder}. */
export declare class DrawOrderTimeline extends Timeline {
static propertyIds: string[];
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
drawOrders: Array<Array<number> | null>;
constructor(frameCount: number);
getFrameCount(): number;
/** Sets the time in seconds and the draw order for the specified key frame.
* @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose
* draw order. */
setFrame(frame: number, time: number, drawOrder: Array<number> | null): void;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes an IK constraint's {@link IkConstraint#mix}, {@link IkConstraint#softness},
* {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */
export declare class IkConstraintTimeline extends CurveTimeline {
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
constraintIndex: number;
constructor(frameCount: number, bezierCount: number, ikConstraintIndex: number);
getFrameEntries(): number;
/** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */
setFrame(frame: number, time: number, mix: number, softness: number, bendDirection: number, compress: boolean, stretch: boolean): void;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a transform constraint's {@link TransformConstraint#rotateMix}, {@link TransformConstraint#translateMix},
* {@link TransformConstraint#scaleMix}, and {@link TransformConstraint#shearMix}. */
export declare class TransformConstraintTimeline extends CurveTimeline {
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
constraintIndex: number;
constructor(frameCount: number, bezierCount: number, transformConstraintIndex: number);
getFrameEntries(): number;
/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */
setFrame(frame: number, time: number, mixRotate: number, mixX: number, mixY: number, mixScaleX: number, mixScaleY: number, mixShearY: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a path constraint's {@link PathConstraint#position}. */
export declare class PathConstraintPositionTimeline extends CurveTimeline1 {
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
* applied. */
constraintIndex: number;
constructor(frameCount: number, bezierCount: number, pathConstraintIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a path constraint's {@link PathConstraint#spacing}. */
export declare class PathConstraintSpacingTimeline extends CurveTimeline1 {
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
* applied. */
constraintIndex: number;
constructor(frameCount: number, bezierCount: number, pathConstraintIndex: number);
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a transform constraint's {@link PathConstraint#getMixRotate()}, {@link PathConstraint#getMixX()}, and
* {@link PathConstraint#getMixY()}. */
export declare class PathConstraintMixTimeline extends CurveTimeline {
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
* applied. */
constraintIndex: number;
constructor(frameCount: number, bezierCount: number, pathConstraintIndex: number);
getFrameEntries(): number;
setFrame(frame: number, time: number, mixRotate: number, mixX: number, mixY: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** The base class for most {@link PhysicsConstraint} timelines. */
export declare abstract class PhysicsConstraintTimeline extends CurveTimeline1 {
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
* is applied, or -1 if all physics constraints in the skeleton will be changed. */
constraintIndex: number;
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number, property: number);
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
abstract setup(constraint: PhysicsConstraint): number;
abstract get(constraint: PhysicsConstraint): number;
abstract set(constraint: PhysicsConstraint, value: number): void;
abstract global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getInertia()}. */
export declare class PhysicsConstraintInertiaTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getStrength()}. */
export declare class PhysicsConstraintStrengthTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getDamping()}. */
export declare class PhysicsConstraintDampingTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getMassInverse()}. The timeline values are not inverted. */
export declare class PhysicsConstraintMassTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getWind()}. */
export declare class PhysicsConstraintWindTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getGravity()}. */
export declare class PhysicsConstraintGravityTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Changes a physics constraint's {@link PhysicsConstraint#getMix()}. */
export declare class PhysicsConstraintMixTimeline extends PhysicsConstraintTimeline {
constructor(frameCount: number, bezierCount: number, physicsConstraintIndex: number);
setup(constraint: PhysicsConstraint): number;
get(constraint: PhysicsConstraint): number;
set(constraint: PhysicsConstraint, value: number): void;
global(constraint: PhysicsConstraintData): boolean;
}
/** Resets a physics constraint when specific animation times are reached. */
export declare class PhysicsConstraintResetTimeline extends Timeline {
private static propertyIds;
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
* applied, or -1 if all physics constraints in the skeleton will be reset. */
constraintIndex: number;
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
constructor(frameCount: number, physicsConstraintIndex: number);
getFrameCount(): number;
/** Sets the time for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive. */
setFrame(frame: number, time: number): void;
/** Resets the physics constraint when frames > <code>lastTime</code> and <= <code>time</code>. */
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
/** Changes a slot's {@link Slot#getSequenceIndex()} for an attachment's {@link Sequence}. */
export declare class SequenceTimeline extends Timeline implements SlotTimeline {
static ENTRIES: number;
static MODE: number;
static DELAY: number;
slotIndex: number;
attachment: HasTextureRegion;
constructor(frameCount: number, slotIndex: number, attachment: HasTextureRegion);
getFrameEntries(): number;
getSlotIndex(): number;
getAttachment(): Attachment;
/** Sets the time, mode, index, and frame time for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time Seconds between frames. */
setFrame(frame: number, time: number, mode: SequenceMode, index: number, delay: number): void;
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
File diff suppressed because it is too large. Load diff
+411
View File
@@ -0,0 +1,411 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Animation, MixBlend, AttachmentTimeline, RotateTimeline } from "./Animation.js";
import { AnimationStateData } from "./AnimationStateData.js";
import { Skeleton } from "./Skeleton.js";
import { Slot } from "./Slot.js";
import { StringSet, Pool } from "./Utils.js";
import { Event } from "./Event.js";
/** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
* multiple animations on top of each other (layering).
*
* See [Applying Animations](http://esotericsoftware.com/spine-applying-animations/) in the Spine Runtimes Guide. */
export declare class AnimationState {
static _emptyAnimation: Animation;
private static emptyAnimation;
/** The AnimationStateData to look up mix durations. */
data: AnimationStateData;
/** The list of tracks that currently have animations, which may contain null entries. */
tracks: (TrackEntry | null)[];
/** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
* or faster. Defaults to 1.
*
* See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
timeScale: number;
unkeyedState: number;
events: Event[];
listeners: AnimationStateListener[];
queue: EventQueue;
propertyIDs: StringSet;
animationsChanged: boolean;
trackEntryPool: Pool<TrackEntry>;
constructor(data: AnimationStateData);
/** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
update(delta: number): void;
/** Returns true when all mixing from entries are complete. */
updateMixingFrom(to: TrackEntry, delta: number): boolean;
/** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
* animation state can be applied to multiple skeletons to pose them identically.
* @returns True if any animations were applied. */
apply(skeleton: Skeleton): boolean;
applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean): void;
setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string | null, attachments: boolean): void;
applyRotateTimeline(timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
queueEvents(entry: TrackEntry, animationTime: number): void;
/** Removes all animations from all tracks, leaving skeletons in their current pose.
*
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
* rather than leaving them in their current pose. */
clearTracks(): void;
/** Removes all animations from the track, leaving skeletons in their current pose.
*
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
* rather than leaving them in their current pose. */
clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
/** Sets an animation by name.
*
* See {@link #setAnimationWith()}. */
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
* applied to a skeleton, it is replaced (not mixed from).
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
* after the {@link AnimationStateListener#dispose()} event occurs. */
setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
/** Queues an animation by name.
*
* See {@link #addAnimationWith()}. */
addAnimation(trackIndex: number, animationName: string, loop?: boolean, delay?: number): TrackEntry;
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
* equivalent to calling {@link #setAnimationWith()}.
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
* minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
* ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
* previous entry is looping, its next loop completion is used instead of its duration.
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
* after the {@link AnimationStateListener#dispose()} event occurs. */
addAnimationWith(trackIndex: number, animation: Animation, loop?: boolean, delay?: number): TrackEntry;
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
* {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
*
* Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
* {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
* 0 still mixes out over one frame.
*
* Mixing in is done by first setting an empty animation, then adding an animation using
* {@link #addAnimation()} and on the returned track entry, set the
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
setEmptyAnimation(trackIndex: number, mixDuration?: number): TrackEntry;
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
* {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
* {@link #setEmptyAnimation()}.
*
* See {@link #setEmptyAnimation()}.
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
* minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
* before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
* loop completion is used instead of its duration.
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
* after the {@link AnimationStateListener#dispose()} event occurs. */
addEmptyAnimation(trackIndex: number, mixDuration?: number, delay?: number): TrackEntry;
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
* duration. */
setEmptyAnimations(mixDuration?: number): void;
expandToIndex(index: number): TrackEntry | null;
/** @param last May be null. */
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry | null): TrackEntry;
/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
clearNext(entry: TrackEntry): void;
_animationsChanged(): void;
computeHold(entry: TrackEntry): void;
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
getCurrent(trackIndex: number): TrackEntry | null;
/** Adds a listener to receive events for all track entries. */
addListener(listener: AnimationStateListener): void;
/** Removes the listener added with {@link #addListener()}. */
removeListener(listener: AnimationStateListener): void;
/** Removes all listeners added with {@link #addListener()}. */
clearListeners(): void;
/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
* {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
* are not wanted because new animations are being set. */
clearListenerNotifications(): void;
}
/** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.
*
* References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */
export declare class TrackEntry {
/** The animation to apply for this track entry. */
animation: Animation | null;
previous: TrackEntry | null;
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
next: TrackEntry | null;
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
* mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
mixingFrom: TrackEntry | null;
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
* currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
mixingTo: TrackEntry | null;
/** The listener for events generated by this track entry, or null.
*
* A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
* for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
listener: AnimationStateListener | null;
/** The index of the track where this track entry is either current or queued.
*
* See {@link AnimationState#getCurrent()}. */
trackIndex: number;
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
* duration. */
loop: boolean;
/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
* of being mixed out.
*
* When mixing between animations that key the same property, if a lower track also keys that property then the value will
* briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
* while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
* at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
* keys the property, only when a higher track also keys the property.
*
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
* previous animation. */
holdPrevious: boolean;
reverse: boolean;
shortestRotation: boolean;
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
* `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
* timelines are not applied while this animation is being mixed out. */
eventThreshold: number;
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
* 0, so attachment timelines are not applied while this animation is being mixed out. */
mixAttachmentThreshold: number;
/** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
* Defaults to 0, so attachment timelines are always applied. */
alphaAttachmentThreshold: number;
/** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
* <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
* 0, so draw order timelines are not applied while this animation is being mixed out. */
mixDrawOrderThreshold: number;
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
*
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
* value to prevent timeline keys before the start time from triggering. */
animationStart: number;
/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
* loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
animationEnd: number;
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
* animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
* is applied. */
animationLast: number;
nextAnimationLast: number;
/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
* postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
* the start of the previous animation to when this track entry will become the current track entry (ie when the previous
* track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
*
* {@link #timeScale} affects the delay. */
delay: number;
/** Current time in seconds this track entry has been the current track entry. The track time determines
* {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
* looping. */
trackTime: number;
trackLast: number;
nextTrackLast: number;
/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
* value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
* is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
* properties keyed by the animation are set to the setup pose and the track is cleared.
*
* It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
* abruptly cease being applied. */
trackEnd: number;
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
* faster. Defaults to 1.
*
* {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
* match the animation speed.
*
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
* the time scale is not 1, the delay may need to be adjusted.
*
* See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
timeScale: number;
/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
* to 1, which overwrites the skeleton's current pose with this animation.
*
* Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
* use alpha on track 0 if the skeleton pose is from the last frame render. */
alpha: number;
/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
* slightly more than `mixDuration` when the mix is complete. */
mixTime: number;
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
* {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
*
* A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
* properties it was animating.
*
* The `mixDuration` can be set manually rather than use the value from
* {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
* track entry only before {@link AnimationState#update(float)} is first called.
*
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
* afterward. */
_mixDuration: number;
interruptAlpha: number;
totalAlpha: number;
get mixDuration(): number;
set mixDuration(mixDuration: number);
setMixDurationWithDelay(mixDuration: number, delay: number): void;
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
* the values from the lower tracks.
*
* The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
* called. */
mixBlend: MixBlend;
timelineMode: number[];
timelineHoldMix: TrackEntry[];
timelinesRotation: number[];
reset(): void;
/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
* and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
* `animationStart` time. */
getAnimationTime(): number;
setAnimationLast(animationLast: number): void;
/** Returns true if at least one loop has been completed.
*
* See {@link AnimationStateListener#complete()}. */
isComplete(): boolean;
/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
* long way around when using {@link #alpha} and starting animations on other tracks.
*
* Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
* the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
* way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
* long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
resetRotationDirections(): void;
getTrackComplete(): number;
/** Returns true if this track entry has been applied at least once.
* <p>
* See {@link AnimationState#apply(Skeleton)}. */
wasApplied(): boolean;
/** Returns true if there is a {@link #getNext()} track entry and it will become the current track entry during the next
* {@link AnimationState#update(float)}. */
isNextReady(): boolean;
}
export declare class EventQueue {
objects: Array<any>;
drainDisabled: boolean;
animState: AnimationState;
constructor(animState: AnimationState);
start(entry: TrackEntry): void;
interrupt(entry: TrackEntry): void;
end(entry: TrackEntry): void;
dispose(entry: TrackEntry): void;
complete(entry: TrackEntry): void;
event(entry: TrackEntry, event: Event): void;
drain(): void;
clear(): void;
}
export declare enum EventType {
start = 0,
interrupt = 1,
end = 2,
dispose = 3,
complete = 4,
event = 5
}
/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
* events.
*
* See TrackEntry {@link TrackEntry#listener} and AnimationState
* {@link AnimationState#addListener()}. */
export interface AnimationStateListener {
/** Invoked when this entry has been set as the current entry. */
start?: (entry: TrackEntry) => void;
/** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for
* mixing. */
interrupt?: (entry: TrackEntry) => void;
/** Invoked when this entry is no longer the current entry and will never be applied again. */
end?: (entry: TrackEntry) => void;
/** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.
* References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */
dispose?: (entry: TrackEntry) => void;
/** Invoked every time this entry's animation completes a loop. */
complete?: (entry: TrackEntry) => void;
/** Invoked when this entry's animation triggers an event. */
event?: (entry: TrackEntry, event: Event) => void;
}
export declare abstract class AnimationStateAdapter implements AnimationStateListener {
start(entry: TrackEntry): void;
interrupt(entry: TrackEntry): void;
end(entry: TrackEntry): void;
dispose(entry: TrackEntry): void;
complete(entry: TrackEntry): void;
event(entry: TrackEntry, event: Event): void;
}
/** 1. A previously applied timeline has set this property.
*
* Result: Mix from the current pose to the timeline pose. */
export declare const SUBSEQUENT = 0;
/** 1. This is the first timeline to set this property.
* 2. The next track entry applied after this one does not have a timeline to set this property.
*
* Result: Mix from the setup pose to the timeline pose. */
export declare const FIRST = 1;
/** 1) A previously applied timeline has set this property.<br>
* 2) The next track entry to be applied does have a timeline to set this property.<br>
* 3) The next track entry after that one does not have a timeline to set this property.<br>
* Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading
* animations that key the same property. A subsequent timeline will set this property using a mix. */
export declare const HOLD_SUBSEQUENT = 2;
/** 1) This is the first timeline to set this property.<br>
* 2) The next track entry to be applied does have a timeline to set this property.<br>
* 3) The next track entry after that one does not have a timeline to set this property.<br>
* Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading animations
* that key the same property. A subsequent timeline will set this property using a mix. */
export declare const HOLD_FIRST = 3;
/** 1. This is the first timeline to set this property.
* 2. The next track entry to be applied does have a timeline to set this property.
* 3. The next track entry after that one does have a timeline to set this property.
* 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.
*
* Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than
* 2 track entries in a row have a timeline that sets the same property.
*
* Eg, A -> B -> C -> D where A, B, and C have a timeline setting same property, but D does not. When A is applied, to avoid
* "dipping" A is not mixed out, however D (the first entry that doesn't set the property) mixing in is used to mix out A
* (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into
* place. */
export declare const HOLD_MIX = 4;
export declare const SETUP = 1;
export declare const CURRENT = 2;
File diff suppressed because it is too large. Load diff
+51
View File
@@ -0,0 +1,51 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Animation } from "./Animation.js";
import { SkeletonData } from "./SkeletonData.js";
import { StringMap } from "./Utils.js";
/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */
export declare class AnimationStateData {
/** The SkeletonData to look up animations when they are specified by name. */
skeletonData: SkeletonData;
animationToMixTime: StringMap<number>;
/** The mix duration to use when no mix duration has been defined between two animations. */
defaultMix: number;
constructor(skeletonData: SkeletonData);
/** Sets a mix duration by animation name.
*
* See {@link #setMixWith()}. */
setMix(fromName: string, toName: string, duration: number): void;
/** Sets the mix duration when changing from the specified animation to the other.
*
* See {@link TrackEntry#mixDuration}. */
setMixWith(from: Animation, to: Animation, duration: number): void;
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
* no mix duration has been set. */
getMix(from: Animation, to: Animation): number;
}
+72
View File
@@ -0,0 +1,72 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */
export class AnimationStateData {
/** The SkeletonData to look up animations when they are specified by name. */
skeletonData;
animationToMixTime = {};
/** The mix duration to use when no mix duration has been defined between two animations. */
defaultMix = 0;
constructor(skeletonData) {
if (!skeletonData)
throw new Error("skeletonData cannot be null.");
this.skeletonData = skeletonData;
}
/** Sets a mix duration by animation name.
*
* See {@link #setMixWith()}. */
setMix(fromName, toName, duration) {
let from = this.skeletonData.findAnimation(fromName);
if (!from)
throw new Error("Animation not found: " + fromName);
let to = this.skeletonData.findAnimation(toName);
if (!to)
throw new Error("Animation not found: " + toName);
this.setMixWith(from, to, duration);
}
/** Sets the mix duration when changing from the specified animation to the other.
*
* See {@link TrackEntry#mixDuration}. */
setMixWith(from, to, duration) {
if (!from)
throw new Error("from cannot be null.");
if (!to)
throw new Error("to cannot be null.");
let key = from.name + "." + to.name;
this.animationToMixTime[key] = duration;
}
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
* no mix duration has been set. */
getMix(from, to) {
let key = from.name + "." + to.name;
let value = this.animationToMixTime[key];
return value === undefined ? this.defaultMix : value;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQW5pbWF0aW9uU3RhdGVEYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0FuaW1hdGlvblN0YXRlRGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFPL0UseUdBQXlHO0FBQ3pHLE1BQU0sT0FBTyxrQkFBa0I7SUFDOUIsOEVBQThFO0lBQzlFLFlBQVksQ0FBZTtJQUUzQixrQkFBa0IsR0FBc0IsRUFBRSxDQUFDO0lBRTNDLDRGQUE0RjtJQUM1RixVQUFVLEdBQUcsQ0FBQyxDQUFDO0lBRWYsWUFBYSxZQUEwQjtRQUN0QyxJQUFJLENBQUMsWUFBWTtZQUFFLE1BQU0sSUFBSSxLQUFLLENBQUMsOEJBQThCLENBQUMsQ0FBQztRQUNuRSxJQUFJLENBQUMsWUFBWSxHQUFHLFlBQVksQ0FBQztJQUNsQyxDQUFDO0lBRUQ7O29DQUVnQztJQU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ubyBtaXggZHVyYXRpb24gaGFzIGJlZW4gZGVmaW5lZCBiZXR3ZWVuIHR3byBhbmltYXRpb Line truncated
+97
View File
@@ -0,0 +1,97 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Texture } from "./Texture.js";
import { TextureAtlas } from "./TextureAtlas.js";
import { Disposable, StringMap } from "./Utils.js";
export declare class AssetManagerBase implements Disposable {
private pathPrefix;
private textureLoader;
private downloader;
private cache;
private errors;
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture, pathPrefix?: string, downloader?: Downloader, cache?: AssetCache);
private start;
private success;
private error;
loadAll(): Promise<AssetManagerBase>;
setRawDataURI(path: string, data: string): void;
loadBinary(path: string, success?: (path: string, binary: Uint8Array) => void, error?: (path: string, message: string) => void): void;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, message: string) => void): void;
loadJson(path: string, success?: (path: string, object: object) => void, error?: (path: string, message: string) => void): void;
reuseAssets(path: string, success?: (path: string, data: any) => void, error?: (path: string, message: string) => void): boolean;
loadTexture(path: string, success?: (path: string, texture: Texture) => void, error?: (path: string, message: string) => void): void;
loadTextureAtlas(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void, fileAlias?: {
[keyword: string]: string;
}): void;
loadTextureAtlasButNoTextures(path: string, success?: (path: string, atlas: TextureAtlas) => void, error?: (path: string, message: string) => void, fileAlias?: {
[keyword: string]: string;
}): void;
loadBinaryAsync(path: string): Promise<unknown>;
loadJsonAsync(path: string): Promise<unknown>;
loadTextureAsync(path: string): Promise<Texture>;
loadTextureAtlasAsync(path: string): Promise<unknown>;
loadTextureAtlasButNoTexturesAsync(path: string): Promise<TextureAtlas>;
setCache(cache: AssetCache): void;
get(path: string): any;
require(path: string): any;
remove(path: string): any;
removeAll(): void;
isLoadingComplete(): boolean;
getToLoad(): number;
getLoaded(): number;
dispose(): void;
disposeAsset(path: string): void;
hasErrors(): boolean;
getErrors(): StringMap<string>;
private disposeAssetInternal;
private createTextureAtlas;
private createTexture;
}
export declare class AssetCache {
assets: StringMap<any>;
assetsRefCount: StringMap<number>;
assetsLoaded: StringMap<Promise<any>>;
static AVAILABLE_CACHES: Map<string, AssetCache>;
static getCache(id: string): AssetCache;
addAsset(path: string, asset: any): Promise<void>;
}
export declare class Downloader {
private callbacks;
rawDataUris: StringMap<string>;
dataUriToString(dataUri: string): string;
base64ToUint8Array(base64: string): Uint8Array;
dataUriToUint8Array(dataUri: string): Uint8Array;
downloadText(url: string, success: (data: string) => void, error: (status: number, responseText: string) => void): void;
downloadJson(url: string, success: (data: object) => void, error: (status: number, responseText: string) => void): void;
downloadBinary(url: string, success: (data: Uint8Array) => void, error: (status: number, responseText: string) => void): void;
private start;
private finish;
}
+494
View File
@@ -0,0 +1,494 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureAtlas } from "./TextureAtlas.js";
export class AssetManagerBase {
pathPrefix = "";
textureLoader;
downloader;
cache;
errors = {};
toLoad = 0;
loaded = 0;
constructor(textureLoader, pathPrefix = "", downloader = new Downloader(), cache = new AssetCache()) {
this.textureLoader = textureLoader;
this.pathPrefix = pathPrefix;
this.downloader = downloader;
this.cache = cache;
}
start(path) {
this.toLoad++;
return this.pathPrefix + path;
}
success(callback, path, asset) {
this.toLoad--;
this.loaded++;
this.cache.assets[path] = asset;
this.cache.assetsRefCount[path] = (this.cache.assetsRefCount[path] || 0) + 1;
if (callback)
callback(path, asset);
}
error(callback, path, message) {
this.toLoad--;
this.loaded++;
this.errors[path] = message;
if (callback)
callback(path, message);
}
loadAll() {
let promise = new Promise((resolve, reject) => {
let check = () => {
if (this.isLoadingComplete()) {
if (this.hasErrors())
reject(this.errors);
else
resolve(this);
return;
}
requestAnimationFrame(check);
};
requestAnimationFrame(check);
});
return promise;
}
setRawDataURI(path, data) {
this.downloader.rawDataUris[this.pathPrefix + path] = data;
}
loadBinary(path, success = () => { }, error = () => { }) {
path = this.start(path);
if (this.reuseAssets(path, success, error))
return;
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
this.downloader.downloadBinary(path, (data) => {
this.success(success, path, data);
resolve(data);
}, (status, responseText) => {
const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
this.error(error, path, errorMsg);
reject(errorMsg);
});
});
}
loadText(path, success = () => { }, error = () => { }) {
path = this.start(path);
this.downloader.downloadText(path, (data) => {
this.success(success, path, data);
}, (status, responseText) => {
this.error(error, path, `Couldn't load text ${path}: status ${status}, ${responseText}`);
});
}
loadJson(path, success = () => { }, error = () => { }) {
path = this.start(path);
if (this.reuseAssets(path, success, error))
return;
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
this.downloader.downloadJson(path, (data) => {
this.success(success, path, data);
resolve(data);
}, (status, responseText) => {
const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
this.error(error, path, errorMsg);
reject(errorMsg);
});
});
}
reuseAssets(path, success = () => { }, error = () => { }) {
const loadedStatus = this.cache.assetsLoaded[path];
const alreadyExistsOrLoading = loadedStatus !== undefined;
if (alreadyExistsOrLoading) {
this.cache.assetsLoaded[path] = loadedStatus
.then(data => {
// necessary when user preloads an image into the cache.
// texture loader is not avaiable in the cache, so we transform in GLTexture at first use
data = (data instanceof Image || data instanceof ImageBitmap) ? this.textureLoader(data) : data;
this.success(success, path, data);
return data;
})
.catch(errorMsg => this.error(error, path, errorMsg));
}
return alreadyExistsOrLoading;
}
loadTexture(path, success = () => { }, error = () => { }) {
path = this.start(path);
if (this.reuseAssets(path, success, error))
return;
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
let isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document);
let isWebWorker = !isBrowser; // && typeof importScripts !== 'undefined';
if (isWebWorker) {
fetch(path, { mode: "cors" }).then((response) => {
if (response.ok)
return response.blob();
const errorMsg = `Couldn't load image: ${path}`;
this.error(error, path, `Couldn't load image: ${path}`);
reject(errorMsg);
}).then((blob) => {
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
}).then((bitmap) => {
if (bitmap) {
const texture = this.createTexture(path, bitmap);
this.success(success, path, texture);
resolve(texture);
}
;
});
}
else {
let image = new Image();
image.crossOrigin = "anonymous";
image.onload = () => {
const texture = this.createTexture(path, image);
this.success(success, path, texture);
resolve(texture);
};
image.onerror = () => {
const errorMsg = `Couldn't load image: ${path}`;
this.error(error, path, errorMsg);
reject(errorMsg);
};
if (this.downloader.rawDataUris[path])
path = this.downloader.rawDataUris[path];
image.src = path;
}
});
}
loadTextureAtlas(path, success = () => { }, error = () => { }, fileAlias) {
let index = path.lastIndexOf("/");
let parent = index >= 0 ? path.substring(0, index + 1) : "";
path = this.start(path);
if (this.reuseAssets(path, success, error))
return;
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
this.downloader.downloadText(path, (atlasText) => {
try {
const atlas = this.createTextureAtlas(path, atlasText);
let toLoad = atlas.pages.length, abort = false;
if (toLoad === 0) {
this.success(success, path, atlas);
resolve(atlas);
return;
}
for (let page of atlas.pages) {
this.loadTexture(!fileAlias ? parent + page.name : fileAlias[page.name], (imagePath, texture) => {
if (!abort) {
page.setTexture(texture);
if (--toLoad == 0) {
this.success(success, path, atlas);
resolve(atlas);
}
}
}, (imagePath, message) => {
if (!abort) {
const errorMsg = `Couldn't load texture ${path} page image: ${imagePath}`;
this.error(error, path, errorMsg);
reject(errorMsg);
}
abort = true;
});
}
}
catch (e) {
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
this.error(error, path, errorMsg);
reject(errorMsg);
}
}, (status, responseText) => {
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
this.error(error, path, errorMsg);
reject(errorMsg);
});
});
}
loadTextureAtlasButNoTextures(path, success = () => { }, error = () => { }, fileAlias) {
path = this.start(path);
if (this.reuseAssets(path, success, error))
return;
this.cache.assetsLoaded[path] = new Promise((resolve, reject) => {
this.downloader.downloadText(path, (atlasText) => {
try {
const atlas = this.createTextureAtlas(path, atlasText);
this.success(success, path, atlas);
resolve(atlas);
}
catch (e) {
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
this.error(error, path, errorMsg);
reject(errorMsg);
}
}, (status, responseText) => {
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
this.error(error, path, errorMsg);
reject(errorMsg);
});
});
}
// Promisified versions of load function
async loadBinaryAsync(path) {
return new Promise((resolve, reject) => {
this.loadBinary(path, (_, binary) => resolve(binary), (_, message) => reject(message));
});
}
async loadJsonAsync(path) {
return new Promise((resolve, reject) => {
this.loadJson(path, (_, object) => resolve(object), (_, message) => reject(message));
});
}
async loadTextureAsync(path) {
return new Promise((resolve, reject) => {
this.loadTexture(path, (_, texture) => resolve(texture), (_, message) => reject(message));
});
}
async loadTextureAtlasAsync(path) {
return new Promise((resolve, reject) => {
this.loadTextureAtlas(path, (_, atlas) => resolve(atlas), (_, message) => reject(message));
});
}
async loadTextureAtlasButNoTexturesAsync(path) {
return new Promise((resolve, reject) => {
this.loadTextureAtlasButNoTextures(path, (_, atlas) => resolve(atlas), (_, message) => reject(message));
});
}
setCache(cache) {
this.cache = cache;
}
get(path) {
return this.cache.assets[this.pathPrefix + path];
}
require(path) {
path = this.pathPrefix + path;
let asset = this.cache.assets[path];
if (asset)
return asset;
let error = this.errors[path];
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
}
remove(path) {
path = this.pathPrefix + path;
let asset = this.cache.assets[path];
if (asset.dispose)
asset.dispose();
delete this.cache.assets[path];
delete this.cache.assetsRefCount[path];
delete this.cache.assetsLoaded[path];
return asset;
}
removeAll() {
for (let path in this.cache.assets) {
let asset = this.cache.assets[path];
if (asset.dispose)
asset.dispose();
}
this.cache.assets = {};
this.cache.assetsLoaded = {};
this.cache.assetsRefCount = {};
}
isLoadingComplete() {
return this.toLoad == 0;
}
getToLoad() {
return this.toLoad;
}
getLoaded() {
return this.loaded;
}
dispose() {
this.removeAll();
}
// dispose asset only if it's not used by others
disposeAsset(path) {
const asset = this.cache.assets[path];
if (asset instanceof TextureAtlas) {
asset.dispose();
return;
}
this.disposeAssetInternal(path);
}
hasErrors() {
return Object.keys(this.errors).length > 0;
}
getErrors() {
return this.errors;
}
disposeAssetInternal(path) {
if (this.cache.assetsRefCount[path] > 0 && --this.cache.assetsRefCount[path] === 0) {
return this.remove(path);
}
}
createTextureAtlas(path, atlasText) {
const atlas = new TextureAtlas(atlasText);
atlas.dispose = () => {
if (this.cache.assetsRefCount[path] <= 0)
return;
this.disposeAssetInternal(path);
for (const page of atlas.pages) {
page.texture?.dispose();
}
};
return atlas;
}
createTexture(path, image) {
const texture = this.textureLoader(image);
const textureDispose = texture.dispose.bind(texture);
texture.dispose = () => {
if (this.disposeAssetInternal(path))
textureDispose();
};
return texture;
}
}
export class AssetCache {
assets = {};
assetsRefCount = {};
assetsLoaded = {};
static AVAILABLE_CACHES = new Map();
static getCache(id) {
const cache = AssetCache.AVAILABLE_CACHES.get(id);
if (cache)
return cache;
const newCache = new AssetCache();
AssetCache.AVAILABLE_CACHES.set(id, newCache);
return newCache;
}
async addAsset(path, asset) {
this.assetsLoaded[path] = Promise.resolve(asset);
this.assets[path] = await asset;
}
}
export class Downloader {
callbacks = {};
rawDataUris = {};
dataUriToString(dataUri) {
if (!dataUri.startsWith("data:")) {
throw new Error("Not a data URI.");
}
let base64Idx = dataUri.indexOf("base64,");
if (base64Idx != -1) {
base64Idx += "base64,".length;
return atob(dataUri.substr(base64Idx));
}
else {
return dataUri.substr(dataUri.indexOf(",") + 1);
}
}
base64ToUint8Array(base64) {
var binary_string = window.atob(base64);
var len = binary_string.length;
var bytes = new Uint8Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
return bytes;
}
dataUriToUint8Array(dataUri) {
if (!dataUri.startsWith("data:")) {
throw new Error("Not a data URI.");
}
let base64Idx = dataUri.indexOf("base64,");
if (base64Idx == -1)
throw new Error("Not a binary data URI.");
base64Idx += "base64,".length;
return this.base64ToUint8Array(dataUri.substr(base64Idx));
}
downloadText(url, success, error) {
if (this.start(url, success, error))
return;
const rawDataUri = this.rawDataUris[url];
// we assume if a "." is included in a raw data uri, it is used to rewrite an asset URL
if (rawDataUri && !rawDataUri.includes(".")) {
try {
this.finish(url, 200, this.dataUriToString(rawDataUri));
}
catch (e) {
this.finish(url, 400, JSON.stringify(e));
}
return;
}
let request = new XMLHttpRequest();
request.overrideMimeType("text/html");
request.open("GET", rawDataUri ? rawDataUri : url, true);
let done = () => {
this.finish(url, request.status, request.responseText);
};
request.onload = done;
request.onerror = done;
request.send();
}
downloadJson(url, success, error) {
this.downloadText(url, (data) => {
success(JSON.parse(data));
}, error);
}
downloadBinary(url, success, error) {
if (this.start(url, success, error))
return;
const rawDataUri = this.rawDataUris[url];
// we assume if a "." is included in a raw data uri, it is used to rewrite an asset URL
if (rawDataUri && !rawDataUri.includes(".")) {
try {
this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
}
catch (e) {
this.finish(url, 400, JSON.stringify(e));
}
return;
}
let request = new XMLHttpRequest();
request.open("GET", rawDataUri ? rawDataUri : url, true);
request.responseType = "arraybuffer";
let onerror = () => {
this.finish(url, request.status, request.response);
};
request.onload = () => {
if (request.status == 200 || request.status == 0)
this.finish(url, 200, new Uint8Array(request.response));
else
onerror();
};
request.onerror = onerror;
request.send();
}
start(url, success, error) {
let callbacks = this.callbacks[url];
try {
if (callbacks)
return true;
this.callbacks[url] = callbacks = [];
}
finally {
callbacks.push(success, error);
}
}
finish(url, status, data) {
let callbacks = this.callbacks[url];
delete this.callbacks[url];
let args = status == 200 || status == 0 ? [data] : [status, data];
for (let i = args.length - 1, n = callbacks.length; i < n; i += 2)
callbacks[i].apply(null, args);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXNzZXRNYW5hZ2VyQmFzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Bc3NldE1hbmFnZXJCYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUcvRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFHakQsTUFBTSxPQUFPLGdCQUFnQjtJQUNwQixVQUFVLEdBQVcsRUFBRSxDQUFDO0lBQ3hCLGFBQWEsQ0FBcUQ7SUFDbEUsVUFBVSxDQUFhO0lBQ3ZCLEtBQUssQ0FBYTtJQUNsQixNQUFNLEdBQXNCLEVBQUUsQ0FBQztJQUMvQixNQUFNLEdBQUcsQ0FBQyxDQUFDO0lBQ1gsTUFBTSxHQUFHLENBQUMsQ0FBQztJQUVuQixZQUFhLGFBQWlFLEVBQUUsYUFBcU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LEVBQUUsQ0FBQztnQkFDakYsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUUsSUFBSSxFQUFFLFFBQVEsQ0FBQyxDQUFDO2dCQUNsQyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUM7WUFDbEIsQ0FBQyxDQUFDLENBQUM7UUFDSixDQUFDLENBQUMsQ0FBQztJQUNKLENBQUM7SUFFR Line truncated
@@ -0,0 +1,53 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { AttachmentLoader } from "./attachments/AttachmentLoader.js";
import { BoundingBoxAttachment } from "./attachments/BoundingBoxAttachment.js";
import { ClippingAttachment } from "./attachments/ClippingAttachment.js";
import { MeshAttachment } from "./attachments/MeshAttachment.js";
import { PathAttachment } from "./attachments/PathAttachment.js";
import { PointAttachment } from "./attachments/PointAttachment.js";
import { RegionAttachment } from "./attachments/RegionAttachment.js";
import { Skin } from "./Skin.js";
import { TextureAtlas } from "./TextureAtlas.js";
import { Sequence } from "./attachments/Sequence.js";
/** An {@link AttachmentLoader} that configures attachments using texture regions from an {@link TextureAtlas}.
*
* See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the
* Spine Runtimes Guide. */
export declare class AtlasAttachmentLoader implements AttachmentLoader {
atlas: TextureAtlas;
constructor(atlas: TextureAtlas);
loadSequence(name: string, basePath: string, sequence: Sequence): void;
newRegionAttachment(skin: Skin, name: string, path: string, sequence: Sequence): RegionAttachment;
newMeshAttachment(skin: Skin, name: string, path: string, sequence: Sequence): MeshAttachment;
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
newPathAttachment(skin: Skin, name: string): PathAttachment;
newPointAttachment(skin: Skin, name: string): PointAttachment;
newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
}
@@ -0,0 +1,93 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoundingBoxAttachment } from "./attachments/BoundingBoxAttachment.js";
import { ClippingAttachment } from "./attachments/ClippingAttachment.js";
import { MeshAttachment } from "./attachments/MeshAttachment.js";
import { PathAttachment } from "./attachments/PathAttachment.js";
import { PointAttachment } from "./attachments/PointAttachment.js";
import { RegionAttachment } from "./attachments/RegionAttachment.js";
/** An {@link AttachmentLoader} that configures attachments using texture regions from an {@link TextureAtlas}.
*
* See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the
* Spine Runtimes Guide. */
export class AtlasAttachmentLoader {
atlas;
constructor(atlas) {
this.atlas = atlas;
}
loadSequence(name, basePath, sequence) {
let regions = sequence.regions;
for (let i = 0, n = regions.length; i < n; i++) {
let path = sequence.getPath(basePath, i);
let region = this.atlas.findRegion(path);
if (region == null)
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
regions[i] = region;
}
}
newRegionAttachment(skin, name, path, sequence) {
let attachment = new RegionAttachment(name, path);
if (sequence != null) {
this.loadSequence(name, path, sequence);
}
else {
let region = this.atlas.findRegion(path);
if (!region)
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
attachment.region = region;
}
return attachment;
}
newMeshAttachment(skin, name, path, sequence) {
let attachment = new MeshAttachment(name, path);
if (sequence != null) {
this.loadSequence(name, path, sequence);
}
else {
let region = this.atlas.findRegion(path);
if (!region)
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
attachment.region = region;
}
return attachment;
}
newBoundingBoxAttachment(skin, name) {
return new BoundingBoxAttachment(name);
}
newPathAttachment(skin, name) {
return new PathAttachment(name);
}
newPointAttachment(skin, name) {
return new PointAttachment(name);
}
newClippingAttachment(skin, name) {
return new ClippingAttachment(name);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXRsYXNBdHRhY2htZW50TG9hZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0F0bGFzQXR0YWNobWVudExvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFHL0UsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFDL0UsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFDekUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDbkUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFLckU7OzsyQkFHMkI7QUFDM0IsTUFBTSxPQUFPLH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k9UIExJTUlURUQgVE8sIFBST0NVUkVNRU5UIE9GIFNVQlNUSVRVVEUgR09PRFMgT1IgU0VSVklDR Line truncated
+143
View File
@@ -0,0 +1,143 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoneData, Inherit } from "./BoneData.js";
import { Physics, Skeleton } from "./Skeleton.js";
import { Updatable } from "./Updatable.js";
import { Vector2 } from "./Utils.js";
/** Stores a bone's current pose.
*
* A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a
* local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a
* constraint or application code modifies the world transform after it was computed from the local transform. */
export declare class Bone implements Updatable {
/** The bone's setup pose data. */
data: BoneData;
/** The skeleton this bone belongs to. */
skeleton: Skeleton;
/** The parent bone, or null if this is the root bone. */
parent: Bone | null;
/** The immediate children of this bone. */
children: Bone[];
/** The local x translation. */
x: number;
/** The local y translation. */
y: number;
/** The local rotation in degrees, counter clockwise. */
rotation: number;
/** The local scaleX. */
scaleX: number;
/** The local scaleY. */
scaleY: number;
/** The local shearX. */
shearX: number;
/** The local shearY. */
shearY: number;
/** The applied local x translation. */
ax: number;
/** The applied local y translation. */
ay: number;
/** The applied local rotation in degrees, counter clockwise. */
arotation: number;
/** The applied local scaleX. */
ascaleX: number;
/** The applied local scaleY. */
ascaleY: number;
/** The applied local shearX. */
ashearX: number;
/** The applied local shearY. */
ashearY: number;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
a: number;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
b: number;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
c: number;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
d: number;
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
worldY: number;
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
worldX: number;
inherit: Inherit;
sorted: boolean;
active: boolean;
/** @param parent May be null. */
constructor(data: BoneData, skeleton: Skeleton, parent: Bone | null);
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
isActive(): boolean;
/** Computes the world transform using the parent bone and this bone's local applied transform. */
update(physics: Physics): void;
/** Computes the world transform using the parent bone and this bone's local transform.
*
* See {@link #updateWorldTransformWith()}. */
updateWorldTransform(): void;
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
* specified local transform. Child bones are not updated.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide. */
updateWorldTransformWith(x: number, y: number, rotation: number, scaleX: number, scaleY: number, shearX: number, shearY: number): void;
/** Sets this bone's local transform to the setup pose. */
setToSetupPose(): void;
/** Computes the applied transform values from the world transform.
*
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
* constraints).
*
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
updateAppliedTransform(): void;
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
getWorldRotationX(): number;
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
getWorldRotationY(): number;
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
getWorldScaleX(): number;
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
getWorldScaleY(): number;
/** Transforms a point from world coordinates to the bone's local coordinates. */
worldToLocal(world: Vector2): Vector2;
/** Transforms a point from the bone's local coordinates to world coordinates. */
localToWorld(local: Vector2): Vector2;
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
worldToParent(world: Vector2): Vector2;
/** Transforms a point from the parent bone's coordinates to world coordinates. */
parentToWorld(world: Vector2): Vector2;
/** Transforms a world rotation to a local rotation. */
worldToLocalRotation(worldRotation: number): number;
/** Transforms a local rotation to a world rotation. */
localToWorldRotation(localRotation: number): number;
/** Rotates the world transform the specified amount.
* <p>
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
* {@link #update(Physics)} will need to be called on any child bones, recursively. */
rotateWorld(degrees: number): void;
}
+398
View File
@@ -0,0 +1,398 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Inherit } from "./BoneData.js";
import { MathUtils } from "./Utils.js";
/** Stores a bone's current pose.
*
* A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a
* local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a
* constraint or application code modifies the world transform after it was computed from the local transform. */
export class Bone {
/** The bone's setup pose data. */
data;
/** The skeleton this bone belongs to. */
skeleton;
/** The parent bone, or null if this is the root bone. */
parent = null;
/** The immediate children of this bone. */
children = new Array();
/** The local x translation. */
x = 0;
/** The local y translation. */
y = 0;
/** The local rotation in degrees, counter clockwise. */
rotation = 0;
/** The local scaleX. */
scaleX = 0;
/** The local scaleY. */
scaleY = 0;
/** The local shearX. */
shearX = 0;
/** The local shearY. */
shearY = 0;
/** The applied local x translation. */
ax = 0;
/** The applied local y translation. */
ay = 0;
/** The applied local rotation in degrees, counter clockwise. */
arotation = 0;
/** The applied local scaleX. */
ascaleX = 0;
/** The applied local scaleY. */
ascaleY = 0;
/** The applied local shearX. */
ashearX = 0;
/** The applied local shearY. */
ashearY = 0;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
a = 0;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
b = 0;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
c = 0;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
d = 0;
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
worldY = 0;
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
worldX = 0;
inherit = Inherit.Normal;
sorted = false;
active = false;
/** @param parent May be null. */
constructor(data, skeleton, parent) {
if (!data)
throw new Error("data cannot be null.");
if (!skeleton)
throw new Error("skeleton cannot be null.");
this.data = data;
this.skeleton = skeleton;
this.parent = parent;
this.setToSetupPose();
}
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
isActive() {
return this.active;
}
/** Computes the world transform using the parent bone and this bone's local applied transform. */
update(physics) {
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
}
/** Computes the world transform using the parent bone and this bone's local transform.
*
* See {@link #updateWorldTransformWith()}. */
updateWorldTransform() {
this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
}
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
* specified local transform. Child bones are not updated.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide. */
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
this.ax = x;
this.ay = y;
this.arotation = rotation;
this.ascaleX = scaleX;
this.ascaleY = scaleY;
this.ashearX = shearX;
this.ashearY = shearY;
let parent = this.parent;
if (!parent) { // Root bone.
let skeleton = this.skeleton;
const sx = skeleton.scaleX, sy = skeleton.scaleY;
const rx = (rotation + shearX) * MathUtils.degRad;
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
this.a = Math.cos(rx) * scaleX * sx;
this.b = Math.cos(ry) * scaleY * sx;
this.c = Math.sin(rx) * scaleX * sy;
this.d = Math.sin(ry) * scaleY * sy;
this.worldX = x * sx + skeleton.x;
this.worldY = y * sy + skeleton.y;
return;
}
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
this.worldX = pa * x + pb * y + parent.worldX;
this.worldY = pc * x + pd * y + parent.worldY;
switch (this.inherit) {
case Inherit.Normal: {
const rx = (rotation + shearX) * MathUtils.degRad;
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
const la = Math.cos(rx) * scaleX;
const lb = Math.cos(ry) * scaleY;
const lc = Math.sin(rx) * scaleX;
const ld = Math.sin(ry) * scaleY;
this.a = pa * la + pb * lc;
this.b = pa * lb + pb * ld;
this.c = pc * la + pd * lc;
this.d = pc * lb + pd * ld;
return;
}
case Inherit.OnlyTranslation: {
const rx = (rotation + shearX) * MathUtils.degRad;
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
this.a = Math.cos(rx) * scaleX;
this.b = Math.cos(ry) * scaleY;
this.c = Math.sin(rx) * scaleX;
this.d = Math.sin(ry) * scaleY;
break;
}
case Inherit.NoRotationOrReflection: {
let sx = 1 / this.skeleton.scaleX, sy = 1 / this.skeleton.scaleY;
pa *= sx;
pc *= sy;
let s = pa * pa + pc * pc;
let prx = 0;
if (s > 0.0001) {
s = Math.abs(pa * pd * sy - pb * sx * pc) / s;
pb = pc * s;
pd = pa * s;
prx = Math.atan2(pc, pa) * MathUtils.radDeg;
}
else {
pa = 0;
pc = 0;
prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;
}
const rx = (rotation + shearX - prx) * MathUtils.degRad;
const ry = (rotation + shearY - prx + 90) * MathUtils.degRad;
const la = Math.cos(rx) * scaleX;
const lb = Math.cos(ry) * scaleY;
const lc = Math.sin(rx) * scaleX;
const ld = Math.sin(ry) * scaleY;
this.a = pa * la - pb * lc;
this.b = pa * lb - pb * ld;
this.c = pc * la + pd * lc;
this.d = pc * lb + pd * ld;
break;
}
case Inherit.NoScale:
case Inherit.NoScaleOrReflection: {
rotation *= MathUtils.degRad;
const cos = Math.cos(rotation), sin = Math.sin(rotation);
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
let s = Math.sqrt(za * za + zc * zc);
if (s > 0.00001)
s = 1 / s;
za *= s;
zc *= s;
s = Math.sqrt(za * za + zc * zc);
if (this.inherit == Inherit.NoScale
&& (pa * pd - pb * pc < 0) != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
rotation = Math.PI / 2 + Math.atan2(zc, za);
const zb = Math.cos(rotation) * s;
const zd = Math.sin(rotation) * s;
shearX *= MathUtils.degRad;
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;
this.a = za * la + zb * lc;
this.b = za * lb + zb * ld;
this.c = zc * la + zd * lc;
this.d = zc * lb + zd * ld;
break;
}
}
this.a *= this.skeleton.scaleX;
this.b *= this.skeleton.scaleX;
this.c *= this.skeleton.scaleY;
this.d *= this.skeleton.scaleY;
}
/** Sets this bone's local transform to the setup pose. */
setToSetupPose() {
let data = this.data;
this.x = data.x;
this.y = data.y;
this.rotation = data.rotation;
this.scaleX = data.scaleX;
this.scaleY = data.scaleY;
this.shearX = data.shearX;
this.shearY = data.shearY;
this.inherit = data.inherit;
}
/** Computes the applied transform values from the world transform.
*
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
* constraints).
*
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
updateAppliedTransform() {
let parent = this.parent;
if (!parent) {
this.ax = this.worldX - this.skeleton.x;
this.ay = this.worldY - this.skeleton.y;
this.arotation = Math.atan2(this.c, this.a) * MathUtils.radDeg;
this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c);
this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d);
this.ashearX = 0;
this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * MathUtils.radDeg;
return;
}
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
let pid = 1 / (pa * pd - pb * pc);
let ia = pd * pid, ib = pb * pid, ic = pc * pid, id = pa * pid;
let dx = this.worldX - parent.worldX, dy = this.worldY - parent.worldY;
this.ax = (dx * ia - dy * ib);
this.ay = (dy * id - dx * ic);
let ra, rb, rc, rd;
if (this.inherit == Inherit.OnlyTranslation) {
ra = this.a;
rb = this.b;
rc = this.c;
rd = this.d;
}
else {
switch (this.inherit) {
case Inherit.NoRotationOrReflection: {
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
pb = -pc * this.skeleton.scaleX * s / this.skeleton.scaleY;
pd = pa * this.skeleton.scaleY * s / this.skeleton.scaleX;
pid = 1 / (pa * pd - pb * pc);
ia = pd * pid;
ib = pb * pid;
break;
}
case Inherit.NoScale:
case Inherit.NoScaleOrReflection:
let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
let s = Math.sqrt(pa * pa + pc * pc);
if (s > 0.00001)
s = 1 / s;
pa *= s;
pc *= s;
s = Math.sqrt(pa * pa + pc * pc);
if (this.inherit == Inherit.NoScale && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
s = -s;
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
pb = Math.cos(r) * s;
pd = Math.sin(r) * s;
pid = 1 / (pa * pd - pb * pc);
ia = pd * pid;
ib = pb * pid;
ic = pc * pid;
id = pa * pid;
}
ra = ia * this.a - ib * this.c;
rb = ia * this.b - ib * this.d;
rc = id * this.c - ic * this.a;
rd = id * this.d - ic * this.b;
}
this.ashearX = 0;
this.ascaleX = Math.sqrt(ra * ra + rc * rc);
if (this.ascaleX > 0.0001) {
let det = ra * rd - rb * rc;
this.ascaleY = det / this.ascaleX;
this.ashearY = -Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg;
this.arotation = Math.atan2(rc, ra) * MathUtils.radDeg;
}
else {
this.ascaleX = 0;
this.ascaleY = Math.sqrt(rb * rb + rd * rd);
this.ashearY = 0;
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
}
}
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
getWorldRotationX() {
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
}
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
getWorldRotationY() {
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
}
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
getWorldScaleX() {
return Math.sqrt(this.a * this.a + this.c * this.c);
}
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
getWorldScaleY() {
return Math.sqrt(this.b * this.b + this.d * this.d);
}
/** Transforms a point from world coordinates to the bone's local coordinates. */
worldToLocal(world) {
let invDet = 1 / (this.a * this.d - this.b * this.c);
let x = world.x - this.worldX, y = world.y - this.worldY;
world.x = x * this.d * invDet - y * this.b * invDet;
world.y = y * this.a * invDet - x * this.c * invDet;
return world;
}
/** Transforms a point from the bone's local coordinates to world coordinates. */
localToWorld(local) {
let x = local.x, y = local.y;
local.x = x * this.a + y * this.b + this.worldX;
local.y = x * this.c + y * this.d + this.worldY;
return local;
}
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
worldToParent(world) {
if (world == null)
throw new Error("world cannot be null.");
return this.parent == null ? world : this.parent.worldToLocal(world);
}
/** Transforms a point from the parent bone's coordinates to world coordinates. */
parentToWorld(world) {
if (world == null)
throw new Error("world cannot be null.");
return this.parent == null ? world : this.parent.localToWorld(world);
}
/** Transforms a world rotation to a local rotation. */
worldToLocalRotation(worldRotation) {
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
}
/** Transforms a local rotation to a world rotation. */
localToWorldRotation(localRotation) {
localRotation -= this.rotation - this.shearX;
let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
}
/** Rotates the world transform the specified amount.
* <p>
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
* {@link #update(Physics)} will need to be called on any child bones, recursively. */
rotateWorld(degrees) {
degrees *= MathUtils.degRad;
const sin = Math.sin(degrees), cos = Math.cos(degrees);
const ra = this.a, rb = this.b;
this.a = cos * ra - sin * this.c;
this.b = cos * rb - sin * this.d;
this.c = sin * ra + cos * this.c;
this.d = sin * rb + cos * this.d;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQm9uZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Cb25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3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BQztZQUNsQyxPQUFPO1FBQ1IsQ0FBQztRQUVELElBQUksRUFBRSxHQUFHLE1BQU0sQ0FBQyxDQUFDLEVBQUUsRUFBRSxHQUFHLE1BQU0sQ0FBQyxDQUFDLEVBQUUsRUFBRSxHQUFHLE1BQU0sQ0FBQyxDQUFDLEVBQUUsRUFBRSxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDL0QsSUFBSSxDQUFDLE1BQU0sR0FBRyxFQUFFLEdBQUcsQ0FBQyxHQUFHLEVBQUUsR0FBRyxDQUFDLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQztRQUM5QyxJQUFJLENBQUMsTUFBTSxHQUFHLEVBQUUsR0FBRyxDQUFDLEdBQUcsRUFBRSxHQUFHLENBQUMsR0FBRyxNQUFNLENBQUMsTUFBTSxDQUFDO1FBRTlDLFFBQVEsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1lBQ3RCLEtBQUssT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7Z0JBQ3JCLE1BQU0sRUFBRSxHQUFHLENBQUMsUUFBUSxHQUFHLE1BQU0sQ0FBQyxHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUM7Z0JBQ2xELE1BQU0sRUFBRSxHQUFHL Line truncated
+76
View File
@@ -0,0 +1,76 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "./Utils.js";
/** Stores the setup pose for a {@link Bone}. */
export declare class BoneData {
/** The index of the bone in {@link Skeleton#getBones()}. */
index: number;
/** The name of the bone, which is unique across all bones in the skeleton. */
name: string;
/** @returns May be null. */
parent: BoneData | null;
/** The bone's length. */
length: number;
/** The local x translation. */
x: number;
/** The local y translation. */
y: number;
/** The local rotation in degrees, counter clockwise. */
rotation: number;
/** The local scaleX. */
scaleX: number;
/** The local scaleY. */
scaleY: number;
/** The local shearX. */
shearX: number;
/** The local shearX. */
shearY: number;
/** The transform mode for how parent world transforms affect this bone. */
inherit: Inherit;
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
* bone.
* @see Skin#bones */
skinRequired: boolean;
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
* rendered at runtime. */
color: Color;
/** The bone icon as it was in Spine, or null if nonessential data was not exported. */
icon?: string;
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
visible: boolean;
constructor(index: number, name: string, parent: BoneData | null);
}
/** Determines how a bone inherits world transforms from parent bones. */
export declare enum Inherit {
Normal = 0,
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4
}
+86
View File
@@ -0,0 +1,86 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "./Utils.js";
/** Stores the setup pose for a {@link Bone}. */
export class BoneData {
/** The index of the bone in {@link Skeleton#getBones()}. */
index = 0;
/** The name of the bone, which is unique across all bones in the skeleton. */
name;
/** @returns May be null. */
parent = null;
/** The bone's length. */
length = 0;
/** The local x translation. */
x = 0;
/** The local y translation. */
y = 0;
/** The local rotation in degrees, counter clockwise. */
rotation = 0;
/** The local scaleX. */
scaleX = 1;
/** The local scaleY. */
scaleY = 1;
/** The local shearX. */
shearX = 0;
/** The local shearX. */
shearY = 0;
/** The transform mode for how parent world transforms affect this bone. */
inherit = Inherit.Normal;
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
* bone.
* @see Skin#bones */
skinRequired = false;
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
* rendered at runtime. */
color = new Color();
/** The bone icon as it was in Spine, or null if nonessential data was not exported. */
icon;
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
visible = false;
constructor(index, name, parent) {
if (index < 0)
throw new Error("index must be >= 0.");
if (!name)
throw new Error("name cannot be null.");
this.index = index;
this.name = name;
this.parent = parent;
}
}
/** Determines how a bone inherits world transforms from parent bones. */
export var Inherit;
(function (Inherit) {
Inherit[Inherit["Normal"] = 0] = "Normal";
Inherit[Inherit["OnlyTranslation"] = 1] = "OnlyTranslation";
Inherit[Inherit["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
Inherit[Inherit["NoScale"] = 3] = "NoScale";
Inherit[Inherit["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
})(Inherit || (Inherit = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQm9uZURhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvQm9uZURhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRS9FLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxZQ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WxsLiAqL1xuXHRwYXJlbnQ6IEJvbmVEYXRhIHwgbnVsbCA9IG51bGw7XG5cblx0LyoqIFRoZSBib25lJ3MgbGVuZ3RoLiAqL1xuXHRsZW5ndGg6IG51bWJlciA9IDA7XG5cblx0LyoqIFRoZSBsb2NhbCB4IHRyYW5zbGF0aW9uLiAqL1xuXHR4ID0gMDtcblxuXHQvKiogVGhlIGxvY2FsIHkgdHJhbnNsYXRpb24uICovXG5cdHkgPSAwO1xuXG5cdC8qKiBUaGUgbG9jYWwgcm90YXRpb24gaW4gZGVncmVlcywgY291bnRlciBjbG9ja3dpc2UuICovXG5cdHJvdGF0aW9uID0gMDtcblxuXHQvKiogVGhlIGxvY2FsIHNjYWxlWC4gKi9cblx0c2NhbGVYID0gMTtcblxuXHQvKiogV Line truncated
+35
View File
@@ -0,0 +1,35 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** The base class for all constraint datas. */
export declare abstract class ConstraintData {
name: string;
order: number;
skinRequired: boolean;
constructor(name: string, order: number, skinRequired: boolean);
}
+40
View File
@@ -0,0 +1,40 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** The base class for all constraint datas. */
export class ConstraintData {
name;
order;
skinRequired;
constructor(name, order, skinRequired) {
this.name = name;
this.order = order;
this.skinRequired = skinRequired;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3RyYWludERhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvQ29uc3RyYWludERhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRS9FLCtDQUErQztBQUMvQyxNQUFNLE9BQWdCLGNBQWM7SUFDZjtJQUFxQjtJQUFzQjtJQUEvRCxZQUFvQixJQUFZLEVBQVMsS0FBYSxFQUFTLFlBQXFCO1FBQWhFLFNBQUksR0FBSixJQUFJLENBQVE7UUFBUyxVQUFLLEdBQUwsS0FBSyxDQUFRO1FBQVMsaUJBQVksR0FBWixZQUFZLENBQVM7SUFBSSxDQUFDO0NBQ3pGIiwic291cmNlc0NvbnRlbnQiOlsiLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuICogU3BpbmUgUnVudGltZXMgTGljZW5zZSBBZ3JlZW1lbnRcbiAqIExhc3QgdXBkYXRlZCBBcHJpbCA1LCAyMDI1LiBSZXBsYWNlcyBhbGwgcHJpb3IgdmVyc2lvbnMuXG4gKlxuICogQ29weXJpZ2h0IChjKSAyMDEzLTIwMjUsIEVzb3RlcmljIFNvZnR3YXJlIExMQ1xuICpcbiAqIEludGVncmF0aW9uIG9mIHRoZSBTcGluZSBSd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yLCBwdWJsaWMgc2tpblJlcXVpcmVkOiBib29sZWFuKSB7IH1cbn1cbiJdfQ==
+44
View File
@@ -0,0 +1,44 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { EventData } from "./EventData.js";
/** Stores the current pose values for an {@link Event}.
*
* See Timeline {@link Timeline#apply()},
* AnimationStateListener {@link AnimationStateListener#event()}, and
* [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
export declare class Event {
data: EventData;
intValue: number;
floatValue: number;
stringValue: string | null;
time: number;
volume: number;
balance: number;
constructor(time: number, data: EventData);
}
+49
View File
@@ -0,0 +1,49 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** Stores the current pose values for an {@link Event}.
*
* See Timeline {@link Timeline#apply()},
* AnimationStateListener {@link AnimationStateListener#event()}, and
* [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
export class Event {
data;
intValue = 0;
floatValue = 0;
stringValue = null;
time = 0;
volume = 0;
balance = 0;
constructor(time, data) {
if (!data)
throw new Error("data cannot be null.");
this.time = time;
this.data = data;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvRXZlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBSS9FOzs7O2lGQUlpRjtBQUNqRixNQUFNLE9BQU8sS0FBSztJQUNqQixJQUFJLENBQVk7SUFDaEIsUUFBUSxHQUFXLENBQUMsQ0FBQztJQUNyQixVQUFVLEdBQVcsQ0FBQyxDQUFDO0lBQ3ZCLFdBQVcsR0FBa0IsSUFBSSxDQUFDO0lBQ2xDLElBQUksR0FBVyxDQUFDLENBQUM7SUFDakIsTUFBTSxHQUFXLENBQUMsQ0FBQztJQUNuQixPQUFPLEdBQVcsQ0FBQyxDQUFDO0lBRXBCLFlBQWEsSUFBWSxFQUFFLElBQWU7UUFDekMsSUFBSSxDQUFDLElBQUk7WUFBRSxNQUFNLElBQUksS0FBSyxDQUFDLHNCQUFzQixDQUFDLENBQUM7UUFDbkQsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7UUFDakIsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7SUFDbEIsQ0FBQztDQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKlxuICogU3BpbmUgUnVudGltZXMgTGljZW5zZSBBZ3JlZW1lbnRcbiAqIExhc3QgdXBkYXRlZCBBcHJpbCA1LCAyMDI1LiBSZXBsYWNlcyBhbGwgcHJpb3IgdmV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qIFN0b3JlcyB0aGUgY3VycmVudCBwb3NlIHZhbHVlcyBmb3IgYW4ge0BsaW5rIEV2ZW50fS5cbiAqXG4gKiBTZWUgVGltZWxpbmUge0BsaW5rIFRpbWVsaW5lI2FwcGx5KCl9LFxuICogQW5pbWF0aW9uU3RhdGVMaXN0ZW5lciB7QGxpbmsgQW5pbWF0aW9uU3RhdGVMaXN0ZW5lciNldmVudCgpfSwgYW5kXG4gKiBbRXZlbnRzXShodHRwOi8vZXNvdGVyaWNzb2Z0d2FyZS5jb20vc3BpbmUtZXZlbnRzKSBpbiB0aGUgU3BpbmUgVXNlciBHdWlkZS4gKi9cbmV4cG9ydCBjbGFzcyBFdmVudCB7XG5cdGRhdGE6IEV2ZW50RGF0YTtcblx0aW50VmFsdWU6IG51bWJlciA9IDA7XG5cdGZsb2F0VmFsdWU6IG51bWJlciA9IDA7XG5cdHN0cmluZ1ZhbHVlOiBzdHJpbmcgfCBudWxsID0gbnVsbDtcblx0dGltZTogbnVtYmVyID0gMDtcblx0dm9sdW1lOiBudW1iZXIgPSAwO1xuXHRiYWxhbmNlOiBudW1iZXIgPSAwO1xuXG5cdGNvbnN0cnVjdG9yICh0aW1lOiBudW1iZXIsIGRhdGE6IEV2ZW50RGF0YSkge1xuXHRcdGlmICghZGF0YSkgdGhyb3cgbmV3IEVycm9yKFwiZGF0YSBjYW5ub3QgYmUgbnVsbC5cIik7XG5cdFx0dGhpcy50aW1lID0gdGltZTtcblx0XHR0aGlzLmRhdGEgPSBkYXRhO1xuXHR9XG59XG4iXX0=
+41
View File
@@ -0,0 +1,41 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** Stores the setup pose values for an {@link Event}.
*
* See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
export declare class EventData {
name: string;
intValue: number;
floatValue: number;
stringValue: string | null;
audioPath: string | null;
volume: number;
balance: number;
constructor(name: string);
}
+44
View File
@@ -0,0 +1,44 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** Stores the setup pose values for an {@link Event}.
*
* See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
export class EventData {
name;
intValue = 0;
floatValue = 0;
stringValue = null;
audioPath = null;
volume = 0;
balance = 0;
constructor(name) {
this.name = name;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnREYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0V2ZW50RGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFFL0U7O3FGQUVxRjtBQUNyRixNQUFNLE9BQU8sU0FBUztJQUNyQixJQUFJLENBQVM7SUFDYixRQUFRLEdBQVcsQ0FBQyxDQUFDO0l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XRVZFUiBDQVVTRUQgQU5EXG4gKiBPTiBBTlkgVEhFT1JZIE9GIExJQUJJTElUWSwgV0hFVEhFUiBJTiBDT05UUkFDVCwgU1RSSUNUIExJQUJJTElUWSwgT1IgVE9SVFxuICogKElOQ0xVRElORyBORUdMSUdFTkNFIE9SIE9USEVSV0lTRSkgQVJJU0lORyBJTiBBTlkgV0FZIE9VVCBPRiBUSEUgVVNFIE9GXG4gKiBUSEUgU1BJTkUgUlVOVElNRVMsIEVWRU4gSUYgQURWSVNFRCBPRiBUSEUgUE9TU0lCSUxJVFkgT0YgU1VDSCBEQU1BR0UuXG4gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cbi8qKiBTdG9yZXMgdGhlIHNldHVwIHBvc2UgdmFsdWVzIGZvciBhbiB7QGxpbmsgRXZlbnR9LlxuICpcbiAqIFNlZSBbRXZlbnRzXShodHRwOi8vZXNvdGVyaWNzb2Z0d2FyZS5jb20vc3BpbmUtZXZlbnRzKSBpbiB0aGUgU3BpbmUgVXNlciBHdWlkZS4gKi9cbmV4cG9ydCBjbGFzcyBFdmVudERhdGEge1xuXHRuYW1lOiBzdHJpbmc7XG5cdGludFZhbHVlOiBudW1iZXIgPSAwO1xuXHRmbG9hdFZhbHVlOiBudW1iZXIgPSAwO1xuXHRzdHJpbmdWYWx1ZTogc3RyaW5nIHwgbnVsbCA9IG51bGw7XG5cdGF1ZGlvUGF0aDogc3RyaW5nIHwgbnVsbCA9IG51bGw7XG5cdHZvbHVtZTogbnVtYmVyID0gMDtcblx0YmFsYW5jZTogbnVtYmVyID0gMDtcblxuXHRjb25zdHJ1Y3RvciAobmFtZTogc3RyaW5nKSB7XG5cdFx0dGhpcy5uYW1lID0gbmFtZTtcblx0fVxufVxuIl19
+65
View File
@@ -0,0 +1,65 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Bone } from "./Bone.js";
import { IkConstraintData } from "./IkConstraintData.js";
import { Physics, Skeleton } from "./Skeleton.js";
import { Updatable } from "./Updatable.js";
/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of
* the last bone is as close to the target bone as possible.
*
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
export declare class IkConstraint implements Updatable {
/** The IK constraint's setup pose data. */
data: IkConstraintData;
/** The bones that will be modified by this IK constraint. */
bones: Array<Bone>;
/** The bone that is the IK target. */
target: Bone;
/** Controls the bend direction of the IK bones, either 1 or -1. */
bendDirection: number;
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
compress: boolean;
/** 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
* and the parent bone has local nonuniform scale, stretch is not applied. */
stretch: boolean;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
mix: number;
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
softness: number;
active: boolean;
constructor(data: IkConstraintData, skeleton: Skeleton);
isActive(): boolean;
setToSetupPose(): void;
update(physics: Physics): void;
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
apply1(bone: Bone, targetX: number, targetY: number, compress: boolean, stretch: boolean, uniform: boolean, alpha: number): void;
/** 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, uniform: boolean, softness: number, alpha: number): void;
}
+323
View File
@@ -0,0 +1,323 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Inherit } from "./BoneData.js";
import { MathUtils } from "./Utils.js";
/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of
* the last bone is as close to the target bone as possible.
*
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
export class IkConstraint {
/** The IK constraint's setup pose data. */
data;
/** The bones that will be modified by this IK constraint. */
bones;
/** The bone that is the IK target. */
target;
/** Controls the bend direction of the IK bones, either 1 or -1. */
bendDirection = 0;
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
compress = false;
/** 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
* and the parent bone has local nonuniform scale, stretch is not applied. */
stretch = false;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
mix = 1;
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
softness = 0;
active = false;
constructor(data, skeleton) {
if (!data)
throw new Error("data cannot be null.");
if (!skeleton)
throw new Error("skeleton cannot be null.");
this.data = data;
this.bones = new Array();
for (let i = 0; i < data.bones.length; i++) {
let bone = skeleton.findBone(data.bones[i].name);
if (!bone)
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
this.bones.push(bone);
}
let target = skeleton.findBone(data.target.name);
if (!target)
throw new Error(`Couldn't find bone ${data.target.name}`);
this.target = target;
this.mix = data.mix;
this.softness = data.softness;
this.bendDirection = data.bendDirection;
this.compress = data.compress;
this.stretch = data.stretch;
}
isActive() {
return this.active;
}
setToSetupPose() {
const data = this.data;
this.mix = data.mix;
this.softness = data.softness;
this.bendDirection = data.bendDirection;
this.compress = data.compress;
this.stretch = data.stretch;
}
update(physics) {
if (this.mix == 0)
return;
let target = this.target;
let bones = this.bones;
switch (bones.length) {
case 1:
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.data.uniform, this.softness, this.mix);
break;
}
}
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
let p = bone.parent;
if (!p)
throw new Error("IK bone must have parent.");
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
switch (bone.inherit) {
case Inherit.OnlyTranslation:
tx = (targetX - bone.worldX) * MathUtils.signum(bone.skeleton.scaleX);
ty = (targetY - bone.worldY) * MathUtils.signum(bone.skeleton.scaleY);
break;
case Inherit.NoRotationOrReflection:
let s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001, pa * pa + pc * pc);
let sa = pa / bone.skeleton.scaleX;
let sc = pc / bone.skeleton.scaleY;
pb = -sc * s * bone.skeleton.scaleX;
pd = sa * s * bone.skeleton.scaleY;
rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
// Fall through
default:
let x = targetX - p.worldX, y = targetY - p.worldY;
let d = pa * pd - pb * pc;
if (Math.abs(d) <= 0.0001) {
tx = 0;
ty = 0;
}
else {
tx = (x * pd - y * pb) / d - bone.ax;
ty = (y * pa - x * pc) / d - bone.ay;
}
}
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
if (bone.ascaleX < 0)
rotationIK += 180;
if (rotationIK > 180)
rotationIK -= 360;
else if (rotationIK < -180)
rotationIK += 360;
let sx = bone.ascaleX, sy = bone.ascaleY;
if (compress || stretch) {
switch (bone.inherit) {
case Inherit.NoScale:
case Inherit.NoScaleOrReflection:
tx = targetX - bone.worldX;
ty = targetY - bone.worldY;
}
const b = bone.data.length * sx;
if (b > 0.0001) {
const dd = tx * tx + ty * ty;
if ((compress && dd < b * b) || (stretch && dd > b * b)) {
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
sx *= s;
if (uniform)
sy *= s;
}
}
}
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
}
/** Applies 2 bone IK. The target is specified in the world coordinate system.
* @param child A direct descendant of the parent bone. */
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
if (parent.inherit != Inherit.Normal || child.inherit != Inherit.Normal)
return;
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;
os1 = 180;
s2 = -1;
}
else {
os1 = 0;
s2 = 1;
}
if (psy < 0) {
psy = -psy;
s2 = -s2;
}
if (csx < 0) {
csx = -csx;
os2 = 180;
}
else
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 || stretch) {
cy = 0;
cwx = a * cx + parent.worldX;
cwy = c * cx + parent.worldY;
}
else {
cy = child.ay;
cwx = a * cx + b * cy + parent.worldX;
cwy = c * cx + d * cy + parent.worldY;
}
let pp = parent.parent;
if (!pp)
throw new Error("IK parent must itself have a parent.");
a = pp.a;
b = pp.b;
c = pp.c;
d = pp.d;
let id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY;
id = Math.abs(id) <= 0.0001 ? 0 : 1 / id;
let dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
let l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;
if (l1 < 0.0001) {
this.apply1(parent, targetX, targetY, false, stretch, false, alpha);
child.updateWorldTransformWith(cx, cy, 0, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);
return;
}
x = targetX - pp.worldX;
y = targetY - pp.worldY;
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) * 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;
p = (sd - softness * (1 - p * p)) / td;
tx -= p * tx;
ty -= p * ty;
dd = tx * tx + ty * ty;
}
}
outer: if (u) {
l2 *= psx;
let cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
if (cos < -1) {
cos = -1;
a2 = Math.PI * bendDir;
}
else if (cos > 1) {
cos = 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);
a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b);
}
else {
a = psx * l2;
b = psy * l2;
let aa = a * a, bb = b * b, ta = Math.atan2(ty, tx);
c = bb * l1 * l1 + aa * dd - aa * bb;
let c1 = -2 * bb * l1, c2 = bb - aa;
d = c1 * c1 - 4 * c2 * c;
if (d >= 0) {
let q = Math.sqrt(d);
if (c1 < 0)
q = -q;
q = -(c1 + q) * 0.5;
let r0 = q / c2, r1 = c / q;
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
r0 = dd - r * r;
if (r0 >= 0) {
y = Math.sqrt(r0) * bendDir;
a1 = ta - Math.atan2(y, r);
a2 = Math.atan2(y / psy, (r - l1) / psx);
break outer;
}
}
let minAngle = MathUtils.PI, minX = l1 - a, minDist = minX * minX, minY = 0;
let maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
c = -a * l1 / (aa - bb);
if (c >= -1 && c <= 1) {
c = Math.acos(c);
x = a * Math.cos(c) + l1;
y = b * Math.sin(c);
d = x * x + y * y;
if (d < minDist) {
minAngle = c;
minDist = d;
minX = x;
minY = y;
}
if (d > maxDist) {
maxAngle = c;
maxDist = d;
maxX = x;
maxY = y;
}
}
if (dd <= (minDist + maxDist) * 0.5) {
a1 = ta - Math.atan2(minY * bendDir, minX);
a2 = minAngle * bendDir;
}
else {
a1 = ta - Math.atan2(maxY * bendDir, maxX);
a2 = maxAngle * bendDir;
}
}
let os = Math.atan2(cy, cx) * s2;
let rotation = parent.arotation;
a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;
if (a1 > 180)
a1 -= 360;
else if (a1 < -180) //
a1 += 360;
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)
a2 -= 360;
else if (a2 < -180) //
a2 += 360;
child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSWtDb25zdHJhaW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0lrQ29uc3RyYWludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFHL0UsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUl4QyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRXZDO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QUFLLE9BQU8sQ0FBQyxzQkFBc0I7Z0JBQ2xDLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQyxNQUFNLEVBQUUsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7Z0JBQzFFLElBQUksRUFBRSxHQUFHLEVBQUUsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQztnQkFDbkMsSUFBSSxFQUFFLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDO2dCQUNuQyxFQUFFLEdBQUcsQ0FBQyxFQUFFLEdBQ Line truncated
+56
View File
@@ -0,0 +1,56 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoneData } from "./BoneData.js";
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for an {@link IkConstraint}.
* <p>
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
export declare class IkConstraintData extends ConstraintData {
/** The bones that are constrained by this IK constraint. */
bones: BoneData[];
/** The bone that is the IK target. */
private _target;
set target(boneData: BoneData);
get target(): BoneData;
/** Controls the bend direction of the IK bones, either 1 or -1. */
bendDirection: number;
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
compress: boolean;
/** 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
* and the parent bone has local nonuniform scale, stretch is not applied. */
stretch: boolean;
/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
* is scaled on both the X and Y axes. */
uniform: boolean;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
mix: number;
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
softness: number;
constructor(name: string);
}
+63
View File
@@ -0,0 +1,63 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for an {@link IkConstraint}.
* <p>
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
export class IkConstraintData extends ConstraintData {
/** The bones that are constrained by this IK constraint. */
bones = new Array();
/** The bone that is the IK target. */
_target = null;
set target(boneData) { this._target = boneData; }
get target() {
if (!this._target)
throw new Error("BoneData not set.");
else
return this._target;
}
/** Controls the bend direction of the IK bones, either 1 or -1. */
bendDirection = 0;
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
compress = false;
/** 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
* and the parent bone has local nonuniform scale, stretch is not applied. */
stretch = false;
/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
* is scaled on both the X and Y axes. */
uniform = false;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
mix = 0;
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
softness = 0;
constructor(name) {
super(name, 0, false);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSWtDb25zdHJhaW50RGF0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Ja0NvbnN0cmFpbnREYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUcvRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFHckQ7O3FHQUVxRztBQUNyRyxNQUFNLE9BQU8sZ0JBQWlCLFNBQVEsY0FBYztJQUNuRCw0REFBNEQ7SUFDNUQsS0FBSyxHQUFHLElBQUksS0FBSyxFQUFZLENBQUM7SUFFOUIsc0NBQXNDO0lBQzlCLE9BQU8sR0FBb0IsSUFBSSxDQUFDO0lBQ3hDLElBQVcsTUFBTSxDQUFFLFFBQWtCLElBQUksSUFBSSxDQUFDLE9BQU8sR0FBRyxRQUFRLENBQUMsQ0FBQyxDQUFDO0lBQ25FLElBQVcsTUFBTTtRQUNoQixJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU87WUFBRSxNQUFNLElBQUksS0FBSyxDQUFDLG1CQUFtQixDQUFDLENBQUE7O1lBQ2xELE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUMxQixDQUFDO0lBRUQsbUVBQW1FO0lBQ25FLGFBQWEsR0FBRyxDQUFDLENBQUM7SUFFbEIseUhBQXlIO0lBQ3pILFFBQVEsR0FBRyxLQUFLLENBQUM7SUFFakI7aUZBQzZFO0lBQzdFLE9BQU8sR0FBRyxLQUFLLENBQUM7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25lRGF0YSB8IG51bGwgPSBudWxsO1xuXHRwdWJsaWMgc2V0IHRhcmdldCAoYm9uZURhdGE6IEJvbmVEYXRhKSB7IHRoaXMuX3RhcmdldCA9IGJvbmVEYXRhOyB9XG5cdHB1YmxpYyBnZXQgdGFyZ2V0ICgpIHtcblx0XHRpZiAoIXRoaXMuX3RhcmdldCkgdGhyb3cgbmV3IEVycm9yKFwiQm9uZURhdGEgbm90IHNldC5cIilcblx0XHRlbHNlIHJldHVybiB0aGlzLl90YXJnZXQ7XG5cdH1cblxuXHQvKiogQ29udHJvbHMgdGhlIGJlbmQgZGlyZWN0aW9uIG9mIHRoZSBJSyBib25lcywgZWl0aGVyIDEgb3IgLTEuICovXG5cdGJlbmREaXJlY3Rpb24gPSAwO1xuXG5cdC8qKiBXaGVuIHRydWUgYW5kIG9ubHkgYSBzaW5nbGUgYm9uZSBpcyBiZWluZyBjb25zdHJhaW5lZCwgaWYgdGhlIHRhcmdldCBpcyB0b28gY2xvc2UsIHRoZSBib25lIGlzIHNjYWxlZCB0byByZWFjaCBpdC4gKi9cblx0Y29tcHJlc3MgPSBmYWxzZTtcblxuXHQvKiogV2hlbiB0cnVlLCBpZiB0aGUgdGFyZ2V0IGlzIG91dCBvZiByYW5nZSwgdGhlIHBhcmVudCBib25lIGlzIHNjYWxlZCB0byByZWFjaCBpdC4gSWYgbW9yZSB0aGFuIG9uZSBib25lIGlzIGJlaW5nIGNvbnN0cmFpbmVkXG5cdCAqIGFuZCB0a Line truncated
+72
View File
@@ -0,0 +1,72 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { PathAttachment } from "./attachments/PathAttachment.js";
import { Bone } from "./Bone.js";
import { PathConstraintData } from "./PathConstraintData.js";
import { Physics, Skeleton } from "./Skeleton.js";
import { Slot } from "./Slot.js";
import { Updatable } from "./Updatable.js";
/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the
* constrained bones so they follow a {@link PathAttachment}.
*
* See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */
export declare class PathConstraint implements Updatable {
static NONE: number;
static BEFORE: number;
static AFTER: number;
static epsilon: number;
/** The path constraint's setup pose data. */
data: PathConstraintData;
/** The bones that will be modified by this path constraint. */
bones: Array<Bone>;
/** The slot whose path attachment will be used to constrained the bones. */
target: Slot;
/** The position along the path. */
position: number;
/** The spacing between bones. */
spacing: number;
mixRotate: number;
mixX: number;
mixY: number;
spaces: number[];
positions: number[];
world: number[];
curves: number[];
lengths: number[];
segments: number[];
active: boolean;
constructor(data: PathConstraintData, skeleton: Skeleton);
isActive(): boolean;
setToSetupPose(): void;
update(physics: Physics): void;
computeWorldPositions(path: PathAttachment, spacesCount: number, tangents: boolean): number[];
addBeforePosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
addAfterPosition(p: number, temp: Array<number>, i: number, out: Array<number>, o: number): void;
addCurvePosition(p: number, x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, out: Array<number>, o: number, tangents: boolean): void;
}
+486
View File
@@ -0,0 +1,486 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { PathAttachment } from "./attachments/PathAttachment.js";
import { RotateMode, SpacingMode, PositionMode } from "./PathConstraintData.js";
import { Utils, MathUtils } from "./Utils.js";
/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the
* constrained bones so they follow a {@link PathAttachment}.
*
* See [Path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */
export class PathConstraint {
static NONE = -1;
static BEFORE = -2;
static AFTER = -3;
static epsilon = 0.00001;
/** The path constraint's setup pose data. */
data;
/** The bones that will be modified by this path constraint. */
bones;
/** The slot whose path attachment will be used to constrained the bones. */
target;
/** The position along the path. */
position = 0;
/** The spacing between bones. */
spacing = 0;
mixRotate = 0;
mixX = 0;
mixY = 0;
spaces = new Array();
positions = new Array();
world = new Array();
curves = new Array();
lengths = new Array();
segments = new Array();
active = false;
constructor(data, skeleton) {
if (!data)
throw new Error("data cannot be null.");
if (!skeleton)
throw new Error("skeleton cannot be null.");
this.data = data;
this.bones = new Array();
for (let i = 0, n = data.bones.length; i < n; i++) {
let bone = skeleton.findBone(data.bones[i].name);
if (!bone)
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
this.bones.push(bone);
}
let target = skeleton.findSlot(data.target.name);
if (!target)
throw new Error(`Couldn't find target bone ${data.target.name}`);
this.target = target;
this.position = data.position;
this.spacing = data.spacing;
this.mixRotate = data.mixRotate;
this.mixX = data.mixX;
this.mixY = data.mixY;
}
isActive() {
return this.active;
}
setToSetupPose() {
const data = this.data;
this.position = data.position;
this.spacing = data.spacing;
this.mixRotate = data.mixRotate;
this.mixX = data.mixX;
this.mixY = data.mixY;
}
update(physics) {
let attachment = this.target.getAttachment();
if (!(attachment instanceof PathAttachment))
return;
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
if (mixRotate == 0 && mixX == 0 && mixY == 0)
return;
let data = this.data;
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
let bones = this.bones;
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
let spacing = this.spacing;
switch (data.spacingMode) {
case SpacingMode.Percent:
if (scale) {
for (let i = 0, n = spacesCount - 1; i < n; i++) {
let bone = bones[i];
let setupLength = bone.data.length;
let x = setupLength * bone.a, y = setupLength * bone.c;
lengths[i] = Math.sqrt(x * x + y * y);
}
}
Utils.arrayFill(spaces, 1, spacesCount, spacing);
break;
case SpacingMode.Proportional:
let sum = 0;
for (let i = 0, n = spacesCount - 1; i < n;) {
let bone = bones[i];
let setupLength = bone.data.length;
if (setupLength < PathConstraint.epsilon) {
if (scale)
lengths[i] = 0;
spaces[++i] = spacing;
}
else {
let x = setupLength * bone.a, y = setupLength * bone.c;
let length = Math.sqrt(x * x + y * y);
if (scale)
lengths[i] = length;
spaces[++i] = length;
sum += length;
}
}
if (sum > 0) {
sum = spacesCount / sum * spacing;
for (let i = 1; i < spacesCount; i++)
spaces[i] *= sum;
}
break;
default:
let lengthSpacing = data.spacingMode == SpacingMode.Length;
for (let i = 0, n = spacesCount - 1; i < n;) {
let bone = bones[i];
let setupLength = bone.data.length;
if (setupLength < PathConstraint.epsilon) {
if (scale)
lengths[i] = 0;
spaces[++i] = spacing;
}
else {
let x = setupLength * bone.a, y = setupLength * bone.c;
let length = Math.sqrt(x * x + y * y);
if (scale)
lengths[i] = length;
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
}
}
}
let positions = this.computeWorldPositions(attachment, spacesCount, tangents);
let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
let tip = false;
if (offsetRotation == 0)
tip = data.rotateMode == RotateMode.Chain;
else {
tip = false;
let p = this.target.bone;
offsetRotation *= p.a * p.d - p.b * p.c > 0 ? MathUtils.degRad : -MathUtils.degRad;
}
for (let i = 0, p = 3; i < boneCount; i++, p += 3) {
let bone = bones[i];
bone.worldX += (boneX - bone.worldX) * mixX;
bone.worldY += (boneY - bone.worldY) * mixY;
let x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;
if (scale) {
let length = lengths[i];
if (length != 0) {
let s = (Math.sqrt(dx * dx + dy * dy) / length - 1) * mixRotate + 1;
bone.a *= s;
bone.c *= s;
}
}
boneX = x;
boneY = y;
if (mixRotate > 0) {
let a = bone.a, b = bone.b, c = bone.c, d = bone.d, r = 0, cos = 0, sin = 0;
if (tangents)
r = positions[p - 1];
else if (spaces[i + 1] == 0)
r = positions[p + 2];
else
r = Math.atan2(dy, dx);
r -= Math.atan2(c, a);
if (tip) {
cos = Math.cos(r);
sin = Math.sin(r);
let length = bone.data.length;
boneX += (length * (cos * a - sin * c) - dx) * mixRotate;
boneY += (length * (sin * a + cos * c) - dy) * mixRotate;
}
else {
r += offsetRotation;
}
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
r += MathUtils.PI2;
r *= mixRotate;
cos = Math.cos(r);
sin = Math.sin(r);
bone.a = cos * a - sin * c;
bone.b = cos * b - sin * d;
bone.c = sin * a + cos * c;
bone.d = sin * b + cos * d;
}
bone.updateAppliedTransform();
}
}
computeWorldPositions(path, spacesCount, tangents) {
let target = this.target;
let position = this.position;
let spaces = this.spaces, out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = this.world;
let closed = path.closed;
let verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PathConstraint.NONE;
if (!path.constantSpeed) {
let lengths = path.lengths;
curveCount -= closed ? 1 : 2;
let pathLength = lengths[curveCount];
if (this.data.positionMode == PositionMode.Percent)
position *= pathLength;
let multiplier;
switch (this.data.spacingMode) {
case SpacingMode.Percent:
multiplier = pathLength;
break;
case SpacingMode.Proportional:
multiplier = pathLength / spacesCount;
break;
default:
multiplier = 1;
}
world = Utils.setArraySize(this.world, 8);
for (let i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) {
let space = spaces[i] * multiplier;
position += space;
let p = position;
if (closed) {
p %= pathLength;
if (p < 0)
p += pathLength;
curve = 0;
}
else if (p < 0) {
if (prevCurve != PathConstraint.BEFORE) {
prevCurve = PathConstraint.BEFORE;
path.computeWorldVertices(target, 2, 4, world, 0, 2);
}
this.addBeforePosition(p, world, 0, out, o);
continue;
}
else if (p > pathLength) {
if (prevCurve != PathConstraint.AFTER) {
prevCurve = PathConstraint.AFTER;
path.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2);
}
this.addAfterPosition(p - pathLength, world, 0, out, o);
continue;
}
// Determine curve containing position.
for (;; curve++) {
let length = lengths[curve];
if (p > length)
continue;
if (curve == 0)
p /= length;
else {
let prev = lengths[curve - 1];
p = (p - prev) / (length - prev);
}
break;
}
if (curve != prevCurve) {
prevCurve = curve;
if (closed && curve == curveCount) {
path.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2);
path.computeWorldVertices(target, 0, 4, world, 4, 2);
}
else
path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
}
this.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || (i > 0 && space == 0));
}
return out;
}
// World vertices.
if (closed) {
verticesLength += 2;
world = Utils.setArraySize(this.world, verticesLength);
path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2);
path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2);
world[verticesLength - 2] = world[0];
world[verticesLength - 1] = world[1];
}
else {
curveCount--;
verticesLength -= 4;
world = Utils.setArraySize(this.world, verticesLength);
path.computeWorldVertices(target, 2, verticesLength, world, 0, 2);
}
// Curve lengths.
let curves = Utils.setArraySize(this.curves, curveCount);
let pathLength = 0;
let x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0;
let tmpx = 0, tmpy = 0, dddfx = 0, dddfy = 0, ddfx = 0, ddfy = 0, dfx = 0, dfy = 0;
for (let i = 0, w = 2; i < curveCount; i++, w += 6) {
cx1 = world[w];
cy1 = world[w + 1];
cx2 = world[w + 2];
cy2 = world[w + 3];
x2 = world[w + 4];
y2 = world[w + 5];
tmpx = (x1 - cx1 * 2 + cx2) * 0.1875;
tmpy = (y1 - cy1 * 2 + cy2) * 0.1875;
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375;
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375;
ddfx = tmpx * 2 + dddfx;
ddfy = tmpy * 2 + dddfy;
dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667;
dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667;
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
dfx += ddfx;
dfy += ddfy;
ddfx += dddfx;
ddfy += dddfy;
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
dfx += ddfx;
dfy += ddfy;
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
dfx += ddfx + dddfx;
dfy += ddfy + dddfy;
pathLength += Math.sqrt(dfx * dfx + dfy * dfy);
curves[i] = pathLength;
x1 = x2;
y1 = y2;
}
if (this.data.positionMode == PositionMode.Percent)
position *= pathLength;
let multiplier;
switch (this.data.spacingMode) {
case SpacingMode.Percent:
multiplier = pathLength;
break;
case SpacingMode.Proportional:
multiplier = pathLength / spacesCount;
break;
default:
multiplier = 1;
}
let segments = this.segments;
let curveLength = 0;
for (let i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) {
let space = spaces[i] * multiplier;
position += space;
let p = position;
if (closed) {
p %= pathLength;
if (p < 0)
p += pathLength;
curve = 0;
}
else if (p < 0) {
this.addBeforePosition(p, world, 0, out, o);
continue;
}
else if (p > pathLength) {
this.addAfterPosition(p - pathLength, world, verticesLength - 4, out, o);
continue;
}
// Determine curve containing position.
for (;; curve++) {
let length = curves[curve];
if (p > length)
continue;
if (curve == 0)
p /= length;
else {
let prev = curves[curve - 1];
p = (p - prev) / (length - prev);
}
break;
}
// Curve segment lengths.
if (curve != prevCurve) {
prevCurve = curve;
let ii = curve * 6;
x1 = world[ii];
y1 = world[ii + 1];
cx1 = world[ii + 2];
cy1 = world[ii + 3];
cx2 = world[ii + 4];
cy2 = world[ii + 5];
x2 = world[ii + 6];
y2 = world[ii + 7];
tmpx = (x1 - cx1 * 2 + cx2) * 0.03;
tmpy = (y1 - cy1 * 2 + cy2) * 0.03;
dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006;
dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006;
ddfx = tmpx * 2 + dddfx;
ddfy = tmpy * 2 + dddfy;
dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667;
dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667;
curveLength = Math.sqrt(dfx * dfx + dfy * dfy);
segments[0] = curveLength;
for (ii = 1; ii < 8; ii++) {
dfx += ddfx;
dfy += ddfy;
ddfx += dddfx;
ddfy += dddfy;
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
segments[ii] = curveLength;
}
dfx += ddfx;
dfy += ddfy;
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
segments[8] = curveLength;
dfx += ddfx + dddfx;
dfy += ddfy + dddfy;
curveLength += Math.sqrt(dfx * dfx + dfy * dfy);
segments[9] = curveLength;
segment = 0;
}
// Weight by segment length.
p *= curveLength;
for (;; segment++) {
let length = segments[segment];
if (p > length)
continue;
if (segment == 0)
p /= length;
else {
let prev = segments[segment - 1];
p = segment + (p - prev) / (length - prev);
}
break;
}
this.addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0));
}
return out;
}
addBeforePosition(p, temp, i, out, o) {
let x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = Math.atan2(dy, dx);
out[o] = x1 + p * Math.cos(r);
out[o + 1] = y1 + p * Math.sin(r);
out[o + 2] = r;
}
addAfterPosition(p, temp, i, out, o) {
let x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = Math.atan2(dy, dx);
out[o] = x1 + p * Math.cos(r);
out[o + 1] = y1 + p * Math.sin(r);
out[o + 2] = r;
}
addCurvePosition(p, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents) {
if (p == 0 || isNaN(p)) {
out[o] = x1;
out[o + 1] = y1;
out[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);
return;
}
let tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;
let ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p;
let x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
out[o] = x;
out[o + 1] = y;
if (tangents) {
if (p < 0.001)
out[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);
else
out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGF0aENvbnN0cmFpbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvUGF0aENvbnN0cmFpbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRS9FLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQXNCLFVBQVUsRUFBRSxXQUFXLEVBQU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BQUcsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7d0JBQ2pELElBQUksSUFBSSxHQUFHLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQzt3QkFDcEIsSUFBSSxXQUFXLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUM7d0JBQ25DLElBQUksQ0FBQyxHQUFHLFdBQVcsR0FBRyxJQUFJLENBQUMsQ0FBQyxFQUFFLENBQUMsR0FBRyxXQUFXLEdBQUcsSUFBSSxDQUFDLENBQUMsQ0FBQzt3QkFDdkQsT0FBTyxDQUFDLENBQUMsQ0FBQyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQ Line truncated
+82
View File
@@ -0,0 +1,82 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoneData } from "./BoneData.js";
import { ConstraintData } from "./ConstraintData.js";
import { SlotData } from "./SlotData.js";
/** Stores the setup pose for a {@link PathConstraint}.
*
* See [path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */
export declare class PathConstraintData extends ConstraintData {
/** The bones that will be modified by this path constraint. */
bones: BoneData[];
/** The slot whose path attachment will be used to constrained the bones. */
private _target;
set target(slotData: SlotData);
get target(): SlotData;
/** The mode for positioning the first bone on the path. */
positionMode: PositionMode;
/** The mode for positioning the bones after the first bone on the path. */
spacingMode: SpacingMode;
/** The mode for adjusting the rotation of the bones. */
rotateMode: RotateMode;
/** An offset added to the constrained bone rotation. */
offsetRotation: number;
/** The position along the path. */
position: number;
/** The spacing between bones. */
spacing: number;
mixRotate: number;
mixX: number;
mixY: number;
constructor(name: string);
}
/** Controls how the first bone is positioned along the path.
*
* See [position](http://esotericsoftware.com/spine-path-constraints#Position) in the Spine User Guide. */
export declare enum PositionMode {
Fixed = 0,
Percent = 1
}
/** Controls how bones after the first bone are positioned along the path.
*
* See [spacing](http://esotericsoftware.com/spine-path-constraints#Spacing) in the Spine User Guide. */
export declare enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Proportional = 3
}
/** Controls how bones are rotated, translated, and scaled to match the path.
*
* See [rotate mix](http://esotericsoftware.com/spine-path-constraints#Rotate-mix) in the Spine User Guide. */
export declare enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2
}
+91
View File
@@ -0,0 +1,91 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for a {@link PathConstraint}.
*
* See [path constraints](http://esotericsoftware.com/spine-path-constraints) in the Spine User Guide. */
export class PathConstraintData extends ConstraintData {
/** The bones that will be modified by this path constraint. */
bones = new Array();
/** The slot whose path attachment will be used to constrained the bones. */
_target = null;
set target(slotData) { this._target = slotData; }
get target() {
if (!this._target)
throw new Error("SlotData not set.");
else
return this._target;
}
/** The mode for positioning the first bone on the path. */
positionMode = PositionMode.Fixed;
/** The mode for positioning the bones after the first bone on the path. */
spacingMode = SpacingMode.Fixed;
/** The mode for adjusting the rotation of the bones. */
rotateMode = RotateMode.Chain;
/** An offset added to the constrained bone rotation. */
offsetRotation = 0;
/** The position along the path. */
position = 0;
/** The spacing between bones. */
spacing = 0;
mixRotate = 0;
mixX = 0;
mixY = 0;
constructor(name) {
super(name, 0, false);
}
}
/** Controls how the first bone is positioned along the path.
*
* See [position](http://esotericsoftware.com/spine-path-constraints#Position) in the Spine User Guide. */
export var PositionMode;
(function (PositionMode) {
PositionMode[PositionMode["Fixed"] = 0] = "Fixed";
PositionMode[PositionMode["Percent"] = 1] = "Percent";
})(PositionMode || (PositionMode = {}));
/** Controls how bones after the first bone are positioned along the path.
*
* See [spacing](http://esotericsoftware.com/spine-path-constraints#Spacing) in the Spine User Guide. */
export var SpacingMode;
(function (SpacingMode) {
SpacingMode[SpacingMode["Length"] = 0] = "Length";
SpacingMode[SpacingMode["Fixed"] = 1] = "Fixed";
SpacingMode[SpacingMode["Percent"] = 2] = "Percent";
SpacingMode[SpacingMode["Proportional"] = 3] = "Proportional";
})(SpacingMode || (SpacingMode = {}));
/** Controls how bones are rotated, translated, and scaled to match the path.
*
* See [rotate mix](http://esotericsoftware.com/spine-path-constraints#Rotate-mix) in the Spine User Guide. */
export var RotateMode;
(function (RotateMode) {
RotateMode[RotateMode["Tangent"] = 0] = "Tangent";
RotateMode[RotateMode["Chain"] = 1] = "Chain";
RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale";
})(RotateMode || (RotateMode = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGF0aENvbnN0cmFpbnREYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1BhdGhDb25zdHJhaW50RGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQ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Bmb3IgYSB7QGxpbmsgUGF0aENvbnN0cmFpbnR9LlxuICpcbiAqIFNlZSBbcGF0aCBjb25zdHJhaW50c10oaHR0cDovL2Vzb3Rlcmljc29mdHdhcmUuY29tL3NwaW5lLXBhdGgtY29uc3RyYWludHMpIGluIHRoZSBTcGluZSBVc2VyIEd1aWRlLiAqL1xuZXhwb3J0IGNsYXNzIFBhdGhDb25zdHJhaW50RGF0YSBleHRlbmRzIENvbnN0cmFpbnREYXRhIHtcblxuXHQvKiogVGhlIGJvbmVzIHRoYXQgd2lsbCBiZSBtb2RpZmllZCBieSB0aGlzIHBhdGggY29uc3RyYWludC4gKi9cblx0Ym9uZXMgPSBuZXcgQXJyYXk8Qm9uZURhdGE+KCk7XG5cblx0LyoqIFRoZSBzbG90IHdob3NlIHBhdGggYXR0YWNobWVudCB3aWxsIGJlIHVzZWQgdG8gY29uc3RyYWluZWQgdGhlIGJvbmVzLiAqL Line truncated
+80
View File
@@ -0,0 +1,80 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Bone } from "./Bone.js";
import { PhysicsConstraintData } from "./PhysicsConstraintData.js";
import { Physics, Skeleton } from "./Skeleton.js";
import { Updatable } from "./Updatable.js";
/** Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
* <p>
* See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
export declare class PhysicsConstraint implements Updatable {
readonly data: PhysicsConstraintData;
private _bone;
/** The bone constrained by this physics constraint. */
set bone(bone: Bone);
get bone(): Bone;
inertia: number;
strength: number;
damping: number;
massInverse: number;
wind: number;
gravity: number;
mix: number;
_reset: boolean;
ux: number;
uy: number;
cx: number;
cy: number;
tx: number;
ty: number;
xOffset: number;
xVelocity: number;
yOffset: number;
yVelocity: number;
rotateOffset: number;
rotateVelocity: number;
scaleOffset: number;
scaleVelocity: number;
active: boolean;
readonly skeleton: Skeleton;
remaining: number;
lastTime: number;
constructor(data: PhysicsConstraintData, skeleton: Skeleton);
reset(): void;
setToSetupPose(): void;
isActive(): boolean;
/** Applies the constraint to the constrained bones. */
update(physics: Physics): void;
/** Translates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone moved an additional
* amount in world space. */
translate(x: number, y: number): void;
/** Rotates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone rotated around the
* specified point in world space. */
rotate(x: number, y: number, degrees: number): void;
}
+298
View File
@@ -0,0 +1,298 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Physics, Skeleton } from "./Skeleton.js";
import { MathUtils } from "./Utils.js";
/** Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
* <p>
* See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
export class PhysicsConstraint {
data;
_bone = null;
/** The bone constrained by this physics constraint. */
set bone(bone) { this._bone = bone; }
get bone() {
if (!this._bone)
throw new Error("Bone not set.");
else
return this._bone;
}
inertia = 0;
strength = 0;
damping = 0;
massInverse = 0;
wind = 0;
gravity = 0;
mix = 0;
_reset = true;
ux = 0;
uy = 0;
cx = 0;
cy = 0;
tx = 0;
ty = 0;
xOffset = 0;
xVelocity = 0;
yOffset = 0;
yVelocity = 0;
rotateOffset = 0;
rotateVelocity = 0;
scaleOffset = 0;
scaleVelocity = 0;
active = false;
skeleton;
remaining = 0;
lastTime = 0;
constructor(data, skeleton) {
this.data = data;
this.skeleton = skeleton;
this.bone = skeleton.bones[data.bone.index];
this.inertia = data.inertia;
this.strength = data.strength;
this.damping = data.damping;
this.massInverse = data.massInverse;
this.wind = data.wind;
this.gravity = data.gravity;
this.mix = data.mix;
}
reset() {
this.remaining = 0;
this.lastTime = this.skeleton.time;
this._reset = true;
this.xOffset = 0;
this.xVelocity = 0;
this.yOffset = 0;
this.yVelocity = 0;
this.rotateOffset = 0;
this.rotateVelocity = 0;
this.scaleOffset = 0;
this.scaleVelocity = 0;
}
setToSetupPose() {
const data = this.data;
this.inertia = data.inertia;
this.strength = data.strength;
this.damping = data.damping;
this.massInverse = data.massInverse;
this.wind = data.wind;
this.gravity = data.gravity;
this.mix = data.mix;
}
isActive() {
return this.active;
}
/** Applies the constraint to the constrained bones. */
update(physics) {
const mix = this.mix;
if (mix == 0)
return;
const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
const bone = this.bone;
const l = bone.data.length;
switch (physics) {
case Physics.none:
return;
case Physics.reset:
this.reset();
// Fall through.
case Physics.update:
const skeleton = this.skeleton;
const delta = Math.max(this.skeleton.time - this.lastTime, 0);
this.remaining += delta;
this.lastTime = skeleton.time;
const bx = bone.worldX, by = bone.worldY;
if (this._reset) {
this._reset = false;
this.ux = bx;
this.uy = by;
}
else {
let a = this.remaining, i = this.inertia, t = this.data.step, f = this.skeleton.data.referenceScale, d = -1;
let qx = this.data.limit * delta, qy = qx * Math.abs(skeleton.scaleY);
qx *= Math.abs(skeleton.scaleX);
if (x || y) {
if (x) {
const u = (this.ux - bx) * i;
this.xOffset += u > qx ? qx : u < -qx ? -qx : u;
this.ux = bx;
}
if (y) {
const u = (this.uy - by) * i;
this.yOffset += u > qy ? qy : u < -qy ? -qy : u;
this.uy = by;
}
if (a >= t) {
d = Math.pow(this.damping, 60 * t);
const m = this.massInverse * t, e = this.strength, w = this.wind * f * skeleton.scaleX, g = this.gravity * f * skeleton.scaleY;
do {
if (x) {
this.xVelocity += (w - this.xOffset * e) * m;
this.xOffset += this.xVelocity * t;
this.xVelocity *= d;
}
if (y) {
this.yVelocity -= (g + this.yOffset * e) * m;
this.yOffset += this.yVelocity * t;
this.yVelocity *= d;
}
a -= t;
} while (a >= t);
}
if (x)
bone.worldX += this.xOffset * mix * this.data.x;
if (y)
bone.worldY += this.yOffset * mix * this.data.y;
}
if (rotateOrShearX || scaleX) {
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
let dx = this.cx - bone.worldX, dy = this.cy - bone.worldY;
if (dx > qx)
dx = qx;
else if (dx < -qx) //
dx = -qx;
if (dy > qy)
dy = qy;
else if (dy < -qy) //
dy = -qy;
if (rotateOrShearX) {
mr = (this.data.rotate + this.data.shearX) * mix;
let r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
r = this.rotateOffset * mr + ca;
c = Math.cos(r);
s = Math.sin(r);
if (scaleX) {
r = l * bone.getWorldScaleX();
if (r > 0)
this.scaleOffset += (dx * c + dy * s) * i / r;
}
}
else {
c = Math.cos(ca);
s = Math.sin(ca);
const r = l * bone.getWorldScaleX();
if (r > 0)
this.scaleOffset += (dx * c + dy * s) * i / r;
}
a = this.remaining;
if (a >= t) {
if (d == -1)
d = Math.pow(this.damping, 60 * t);
const m = this.massInverse * t, e = this.strength, w = this.wind, g = (Skeleton.yDown ? -this.gravity : this.gravity), h = l / f;
while (true) {
a -= t;
if (scaleX) {
this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
this.scaleOffset += this.scaleVelocity * t;
this.scaleVelocity *= d;
}
if (rotateOrShearX) {
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
this.rotateOffset += this.rotateVelocity * t;
this.rotateVelocity *= d;
if (a < t)
break;
const r = this.rotateOffset * mr + ca;
c = Math.cos(r);
s = Math.sin(r);
}
else if (a < t) //
break;
}
}
}
this.remaining = a;
}
this.cx = bone.worldX;
this.cy = bone.worldY;
break;
case Physics.pose:
if (x)
bone.worldX += this.xOffset * mix * this.data.x;
if (y)
bone.worldY += this.yOffset * mix * this.data.y;
}
if (rotateOrShearX) {
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
if (this.data.shearX > 0) {
let r = 0;
if (this.data.rotate > 0) {
r = o * this.data.rotate;
s = Math.sin(r);
c = Math.cos(r);
a = bone.b;
bone.b = c * a - s * bone.d;
bone.d = s * a + c * bone.d;
}
r += o * this.data.shearX;
s = Math.sin(r);
c = Math.cos(r);
a = bone.a;
bone.a = c * a - s * bone.c;
bone.c = s * a + c * bone.c;
}
else {
o *= this.data.rotate;
s = Math.sin(o);
c = Math.cos(o);
a = bone.a;
bone.a = c * a - s * bone.c;
bone.c = s * a + c * bone.c;
a = bone.b;
bone.b = c * a - s * bone.d;
bone.d = s * a + c * bone.d;
}
}
if (scaleX) {
const s = 1 + this.scaleOffset * mix * this.data.scaleX;
bone.a *= s;
bone.c *= s;
}
if (physics != Physics.pose) {
this.tx = l * bone.a;
this.ty = l * bone.c;
}
bone.updateAppliedTransform();
}
/** Translates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone moved an additional
* amount in world space. */
translate(x, y) {
this.ux -= x;
this.uy -= y;
this.cx -= x;
this.cy -= y;
}
/** Rotates the physics constraint so next {@link #update(Physics)} forces are applied as if the bone rotated around the
* specified point in world space. */
rotate(x, y, degrees) {
const r = degrees * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
const dx = this.cx - x, dy = this.cy - y;
this.translate(dx * cos - dy * sin - dx, dx * sin + dy * cos - dy);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGh5c2ljc0NvbnN0cmFpbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvUGh5c2ljc0NvbnN0cmFpbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBSS9FLE9BQU8sRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRWxELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFHdkM7OzBIQUUwSDtBQUMxSCxNQUFNLE9BQU8saUJBQWlCO0lBQ3BCLElBQUksQ0FBd0I7SUFDN0IsS0FBSyxHQUFnQixJQUFJLENBQUM7SUFDbEMsdURBQXVEO0lBQ3ZELElBQVcsSUFBSSxDQUFFLElBQVUsSUFBSSxJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDbkQsSUFBVyxJQUFJO1FBQ2QsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLO1lBQUUsTUFBTSxJQUFJLEtBQUssQ0FBQyxlQUFlLENBQUMsQ0FBQTs7WUFDNUMsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDO0lBQ3hCLENBQUM7SUFDRCxPQUFPLEdBQUcsQ0FBQyxDQUFDO0lBQ1osUUFBUSxHQUFHLENBQUMsQ0FBQztJQUNiLE9BQU8sR0FBRyxDQUFDLENBQUM7SUFDWixXQUFXLEdBQUcsQ0FBQyxDQUFDO0lBQ2hCLElBQUksR0FBRyxDQUFDLENBQUM7SUFDVCxPQUFPL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yxPQUFPLENBQUMsSUFBSTtnQkFDaEIsT0FBTztZQUNSLEtBQUssT0FBTyxDQUFDLEtBQUs7Z0JBQ2pCLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQztZQUNkLGdCQUFnQjtZQUNoQixLQUFLLE9BQU8sQ0FBQyxNQUFNO2dCQUNsQixNQUFNLFFBQVEsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDO2dCQUMvQixNQUFNLEtBQUssR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDLENBQUM7Z0JBQzlELElBQUksQ0FBQyxTQUFTLElBQUksS0FBSyxDQUFDO2dCQUN4QixJQUFJLENBQUMsUUFBUSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUM7Z0JBRTlCLE1BQU0sRUFBRSxHQUFHLElBQUksQ0FBQyxNQUFNLEVBQUUsRUFBRSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7Z0JBQ3pDLElBQUksSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDO29CQUNqQixJQUFJLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQztvQkFDcEIsSUFBSSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUM7b0JBQ2IsSUFBSSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUM7Z0JBQ2QsQ0FBQztxQkFBTSxDQUFDO29CQUNQLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxTQUFTLEVBQUUsQ0FBQyxHQ Line truncated
@@ -0,0 +1,62 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoneData } from "./BoneData.js";
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for a {@link PhysicsConstraint}.
* <p>
* See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
export declare class PhysicsConstraintData extends ConstraintData {
private _bone;
/** The bone constrained by this physics constraint. */
set bone(boneData: BoneData);
get bone(): BoneData;
x: number;
y: number;
rotate: number;
scaleX: number;
shearX: number;
limit: number;
step: number;
inertia: number;
strength: number;
damping: number;
massInverse: number;
wind: number;
gravity: number;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
mix: number;
inertiaGlobal: boolean;
strengthGlobal: boolean;
dampingGlobal: boolean;
massGlobal: boolean;
windGlobal: boolean;
gravityGlobal: boolean;
mixGlobal: boolean;
constructor(name: string);
}
@@ -0,0 +1,69 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for a {@link PhysicsConstraint}.
* <p>
* See <a href="http://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
export class PhysicsConstraintData extends ConstraintData {
_bone = null;
/** The bone constrained by this physics constraint. */
set bone(boneData) { this._bone = boneData; }
get bone() {
if (!this._bone)
throw new Error("BoneData not set.");
else
return this._bone;
}
x = 0;
y = 0;
rotate = 0;
scaleX = 0;
shearX = 0;
limit = 0;
step = 0;
inertia = 0;
strength = 0;
damping = 0;
massInverse = 0;
wind = 0;
gravity = 0;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
mix = 0;
inertiaGlobal = false;
strengthGlobal = false;
dampingGlobal = false;
massGlobal = false;
windGlobal = false;
gravityGlobal = false;
mixGlobal = false;
constructor(name) {
super(name, 0, false);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGh5c2ljc0NvbnN0cmFpbnREYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1BoeXNpY3NDb25zdHJhaW50RGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFHL0UsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBR3JEOzswSEFFMEg7QUFDMUgsTUFBTSxPQUFPLHFCQUFzQixTQUFRLGNBQWM7SUFDaEQsS0FBSyxHQUFvQixJQUFJLENBQUM7SUFDdEMsdURBQXVEO0lBQ3ZELElBQVcsSUFBSSxDQUFFLFFBQWtCLElBQUksSUFBSSxDQUFDLEtBQUssR0FBRyxRQUFRLENBQUMsQ0FBQyxDQUFDO0lBQy9ELElBQVcsSUFBSTtRQUNkLElBQUksQ0FBQyxJQUFJLENBQUMsS0FBSztZQUFFLE1BQU0sSUFBSSxLQUFLLENBQUMsbUJBQW1CLENBQUMsQ0FBQTs7WUFDaEQsT0FBTyxJQUFJLENBQUMsS0FBSyxDQUFDO0lBQ3hCLENBQUM7SUFFRCxDQUFDLEdBQUcsQ0FBQyxDQUFDO0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HJhaW50RGF0YSB9IGZyb20gXCIuL0NvbnN0cmFpbnREYXRhLmpzXCI7XG5cblxuLyoqIFN0b3JlcyB0aGUgc2V0dXAgcG9zZSBmb3IgYSB7QGxpbmsgUGh5c2ljc0NvbnN0cmFpbnR9LlxuICogPHA+XG4gKiBTZWUgPGEgaHJlZj1cImh0dHA6Ly9lc290ZXJpY3NvZnR3YXJlLmNvbS9zcGluZS1waHlzaWNzLWNvbnN0cmFpbnRzXCI+UGh5c2ljcyBjb25zdHJhaW50czwvYT4gaW4gdGhlIFNwaW5lIFVzZXIgR3VpZGUuICovXG5leHBvcnQgY2xhc3MgUGh5c2ljc0NvbnN0cmFpbnREYXRhIGV4dGVuZHMgQ29uc3RyYWludERhdGEge1xuXHRwcml2YXRlIF9ib25lOiBCb25lRGF0YSB8IG51bGwgPSBudWxsO1xuXHQvKiogVGhlIGJvbmUgY29uc3RyYWluZWQgYnkgdGhpcyBwaHlzaWNzIGNvbnN0cmFpbnQuICovXG5cdHB1YmxpYyBzZXQgYm9uZSAoYm9uZURhdGE6IEJvbmVEYXRhKSB7IHRoaXMuX2JvbmUgPSBib25lRGF0YTsgfVxuXHRwdWJsaWMgZ2V0IGJvbmUgKCkge1xuXHRcdGlmICghdGhpcy5fYm9uZSkgdGhyb3cgbmV3IEVycm9yKFwiQm9uZURhdGEgbm90IHNldC5cIilcblx0XHRlbHNlIHJldHVybiB0aGlzLl9ib25lO1xuXHR9XG5cblx0eCA9IDA7XG5cdHkgPSAwO1xuXHRyb3RhdGUgPSAwO1xuXHRzY2FsZVggPSAwO1xuXHRzaGVhclggPSAwO1xuXHRsaW1pdCA9IDA7XG5cdHN0ZXAgPSAwO1xuXHRpbmVydGlhID0gMDtcblx0c3RyZW5ndGggPSAwO1xuXHRkYW1waW5nID0gMDtcblx0bWFzc0ludmVyc2UgPSAwO1xuXHR3aW5kID0gMDtcb Line truncated
+193
View File
@@ -0,0 +1,193 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Attachment } from "./attachments/Attachment.js";
import { Bone } from "./Bone.js";
import { IkConstraint } from "./IkConstraint.js";
import { PathConstraint } from "./PathConstraint.js";
import { PhysicsConstraint } from "./PhysicsConstraint.js";
import { SkeletonClipping } from "./SkeletonClipping.js";
import { SkeletonData } from "./SkeletonData.js";
import { Skin } from "./Skin.js";
import { Slot } from "./Slot.js";
import { TransformConstraint } from "./TransformConstraint.js";
import { Updatable } from "./Updatable.js";
import { Color, Vector2 } from "./Utils.js";
/** Stores the current pose for a skeleton.
*
* See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */
export declare class Skeleton {
private static quadTriangles;
static yDown: boolean;
/** The skeleton's setup pose data. */
data: SkeletonData;
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
bones: Array<Bone>;
/** The skeleton's slots in the setup pose draw order. */
slots: Array<Slot>;
/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
drawOrder: Array<Slot>;
/** The skeleton's IK constraints. */
ikConstraints: Array<IkConstraint>;
/** The skeleton's transform constraints. */
transformConstraints: Array<TransformConstraint>;
/** The skeleton's path constraints. */
pathConstraints: Array<PathConstraint>;
/** The skeleton's physics constraints. */
physicsConstraints: Array<PhysicsConstraint>;
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
_updateCache: Updatable[];
/** The skeleton's current skin. May be null. */
skin: Skin | null;
/** The color to tint all the skeleton's attachments. */
color: Color;
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
* inheritance. */
scaleX: number;
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
* inheritance. */
private _scaleY;
get scaleY(): number;
set scaleY(scaleY: number);
/** Sets the skeleton X position, which is added to the root bone worldX position. */
x: number;
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
y: number;
/** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
* <p>
* See {@link #update(float)}. */
time: number;
constructor(data: SkeletonData);
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
* constraints, or weighted path attachments are added or removed. */
updateCache(): void;
sortIkConstraint(constraint: IkConstraint): void;
sortPathConstraint(constraint: PathConstraint): void;
sortTransformConstraint(constraint: TransformConstraint): void;
sortPathConstraintAttachment(skin: Skin, slotIndex: number, slotBone: Bone): void;
sortPathConstraintAttachmentWith(attachment: Attachment, slotBone: Bone): void;
sortPhysicsConstraint(constraint: PhysicsConstraint): void;
sortBone(bone: Bone): void;
sortReset(bones: Array<Bone>): void;
/** Updates the world transform for each bone and applies all constraints.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide. */
updateWorldTransform(physics: Physics): void;
updateWorldTransformWith(physics: Physics, parent: Bone): void;
/** Sets the bones, constraints, and slots to their setup pose values. */
setToSetupPose(): void;
/** Sets the bones and constraints to their setup pose values. */
setBonesToSetupPose(): void;
/** Sets the slots and draw order to their setup pose values. */
setSlotsToSetupPose(): void;
/** @returns May return null. */
getRootBone(): Bone | null;
/** @returns May be null. */
findBone(boneName: string): Bone | null;
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* repeatedly.
* @returns May be null. */
findSlot(slotName: string): Slot | null;
/** Sets a skin by name.
*
* See {@link #setSkin()}. */
setSkinByName(skinName: string): void;
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
* skin is changed, {@link #updateCache()} is called.
*
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
* old skin, each slot's setup mode attachment is attached from the new skin.
*
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
* @param newSkin May be null. */
setSkin(newSkin: Skin | null): void;
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
* name.
*
* See {@link #getAttachment()}.
* @returns May be null. */
getAttachmentByName(slotName: string, attachmentName: string): Attachment | null;
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
*
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
* @returns May be null. */
getAttachment(slotIndex: number, attachmentName: string): Attachment | null;
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
* @param attachmentName May be null to clear the slot's attachment. */
setAttachment(slotName: string, attachmentName: string): void;
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly.
* @return May be null. */
findIkConstraint(constraintName: string): IkConstraint | null;
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it repeatedly.
* @return May be null. */
findTransformConstraint(constraintName: string): TransformConstraint | null;
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly.
* @return May be null. */
findPathConstraint(constraintName: string): PathConstraint | null;
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
* method than to call it repeatedly. */
findPhysicsConstraint(constraintName: string): PhysicsConstraint | null;
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
getBoundsRect(clipper?: SkeletonClipping): {
x: number;
y: number;
width: number;
height: number;
};
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
* @param size An output value, the width and height of the AABB.
* @param temp Working memory to temporarily store attachments' computed world vertices.
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
getBounds(offset: Vector2, size: Vector2, temp?: Array<number>, clipper?: SkeletonClipping | null): void;
/** Increments the skeleton's {@link #time}. */
update(delta: number): void;
physicsTranslate(x: number, y: number): void;
/** Calls {@link PhysicsConstraint#rotate(float, float, float)} for each physics constraint. */
physicsRotate(x: number, y: number, degrees: number): void;
}
/** Determines how physics and other non-deterministic updates are applied. */
export declare enum Physics {
/** Physics are not updated or applied. */
none = 0,
/** Physics are reset to the current pose. */
reset = 1,
/** Physics are updated and the pose from physics is applied. */
update = 2,
/** Physics are not updated but the pose from physics is applied. */
pose = 3
}
+661
View File
@@ -0,0 +1,661 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ClippingAttachment } from "./attachments/ClippingAttachment.js";
import { MeshAttachment } from "./attachments/MeshAttachment.js";
import { PathAttachment } from "./attachments/PathAttachment.js";
import { RegionAttachment } from "./attachments/RegionAttachment.js";
import { Bone } from "./Bone.js";
import { IkConstraint } from "./IkConstraint.js";
import { PathConstraint } from "./PathConstraint.js";
import { PhysicsConstraint } from "./PhysicsConstraint.js";
import { Slot } from "./Slot.js";
import { TransformConstraint } from "./TransformConstraint.js";
import { Color, Utils, MathUtils, Vector2 } from "./Utils.js";
/** Stores the current pose for a skeleton.
*
* See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */
export class Skeleton {
static quadTriangles = [0, 1, 2, 2, 3, 0];
static yDown = false;
/** The skeleton's setup pose data. */
data;
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
bones;
/** The skeleton's slots in the setup pose draw order. */
slots;
/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
drawOrder;
/** The skeleton's IK constraints. */
ikConstraints;
/** The skeleton's transform constraints. */
transformConstraints;
/** The skeleton's path constraints. */
pathConstraints;
/** The skeleton's physics constraints. */
physicsConstraints;
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
_updateCache = new Array();
/** The skeleton's current skin. May be null. */
skin = null;
/** The color to tint all the skeleton's attachments. */
color;
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
* inheritance. */
scaleX = 1;
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
* inheritance. */
_scaleY = 1;
get scaleY() {
return Skeleton.yDown ? -this._scaleY : this._scaleY;
}
set scaleY(scaleY) {
this._scaleY = scaleY;
}
/** Sets the skeleton X position, which is added to the root bone worldX position. */
x = 0;
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
y = 0;
/** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
* <p>
* See {@link #update(float)}. */
time = 0;
constructor(data) {
if (!data)
throw new Error("data cannot be null.");
this.data = data;
this.bones = new Array();
for (let i = 0; i < data.bones.length; i++) {
let boneData = data.bones[i];
let bone;
if (!boneData.parent)
bone = new Bone(boneData, this, null);
else {
let parent = this.bones[boneData.parent.index];
bone = new Bone(boneData, this, parent);
parent.children.push(bone);
}
this.bones.push(bone);
}
this.slots = new Array();
this.drawOrder = new Array();
for (let i = 0; i < data.slots.length; i++) {
let slotData = data.slots[i];
let bone = this.bones[slotData.boneData.index];
let slot = new Slot(slotData, bone);
this.slots.push(slot);
this.drawOrder.push(slot);
}
this.ikConstraints = new Array();
for (let i = 0; i < data.ikConstraints.length; i++) {
let ikConstraintData = data.ikConstraints[i];
this.ikConstraints.push(new IkConstraint(ikConstraintData, this));
}
this.transformConstraints = new Array();
for (let i = 0; i < data.transformConstraints.length; i++) {
let transformConstraintData = data.transformConstraints[i];
this.transformConstraints.push(new TransformConstraint(transformConstraintData, this));
}
this.pathConstraints = new Array();
for (let i = 0; i < data.pathConstraints.length; i++) {
let pathConstraintData = data.pathConstraints[i];
this.pathConstraints.push(new PathConstraint(pathConstraintData, this));
}
this.physicsConstraints = new Array();
for (let i = 0; i < data.physicsConstraints.length; i++) {
let physicsConstraintData = data.physicsConstraints[i];
this.physicsConstraints.push(new PhysicsConstraint(physicsConstraintData, this));
}
this.color = new Color(1, 1, 1, 1);
this.updateCache();
}
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
* constraints, or weighted path attachments are added or removed. */
updateCache() {
let updateCache = this._updateCache;
updateCache.length = 0;
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
bone.sorted = bone.data.skinRequired;
bone.active = !bone.sorted;
}
if (this.skin) {
let skinBones = this.skin.bones;
for (let i = 0, n = this.skin.bones.length; i < n; i++) {
let bone = this.bones[skinBones[i].index];
do {
bone.sorted = false;
bone.active = true;
bone = bone.parent;
} while (bone);
}
}
// IK first, lowest hierarchy depth first.
let ikConstraints = this.ikConstraints;
let transformConstraints = this.transformConstraints;
let pathConstraints = this.pathConstraints;
let physicsConstraints = this.physicsConstraints;
let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length, physicsCount = this.physicsConstraints.length;
let constraintCount = ikCount + transformCount + pathCount + physicsCount;
outer: for (let i = 0; i < constraintCount; i++) {
for (let ii = 0; ii < ikCount; ii++) {
let constraint = ikConstraints[ii];
if (constraint.data.order == i) {
this.sortIkConstraint(constraint);
continue outer;
}
}
for (let ii = 0; ii < transformCount; ii++) {
let constraint = transformConstraints[ii];
if (constraint.data.order == i) {
this.sortTransformConstraint(constraint);
continue outer;
}
}
for (let ii = 0; ii < pathCount; ii++) {
let constraint = pathConstraints[ii];
if (constraint.data.order == i) {
this.sortPathConstraint(constraint);
continue outer;
}
}
for (let ii = 0; ii < physicsCount; ii++) {
const constraint = physicsConstraints[ii];
if (constraint.data.order == i) {
this.sortPhysicsConstraint(constraint);
continue outer;
}
}
}
for (let i = 0, n = bones.length; i < n; i++)
this.sortBone(bones[i]);
}
sortIkConstraint(constraint) {
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
if (!constraint.active)
return;
let target = constraint.target;
this.sortBone(target);
let constrained = constraint.bones;
let parent = constrained[0];
this.sortBone(parent);
if (constrained.length == 1) {
this._updateCache.push(constraint);
this.sortReset(parent.children);
}
else {
let child = constrained[constrained.length - 1];
this.sortBone(child);
this._updateCache.push(constraint);
this.sortReset(parent.children);
child.sorted = true;
}
}
sortPathConstraint(constraint) {
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
if (!constraint.active)
return;
let slot = constraint.target;
let slotIndex = slot.data.index;
let slotBone = slot.bone;
if (this.skin)
this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
for (let i = 0, n = this.data.skins.length; i < n; i++)
this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
let attachment = slot.getAttachment();
if (attachment instanceof PathAttachment)
this.sortPathConstraintAttachmentWith(attachment, slotBone);
let constrained = constraint.bones;
let boneCount = constrained.length;
for (let i = 0; i < boneCount; i++)
this.sortBone(constrained[i]);
this._updateCache.push(constraint);
for (let i = 0; i < boneCount; i++)
this.sortReset(constrained[i].children);
for (let i = 0; i < boneCount; i++)
constrained[i].sorted = true;
}
sortTransformConstraint(constraint) {
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin && Utils.contains(this.skin.constraints, constraint.data, true)));
if (!constraint.active)
return;
this.sortBone(constraint.target);
let constrained = constraint.bones;
let boneCount = constrained.length;
if (constraint.data.local) {
for (let i = 0; i < boneCount; i++) {
let child = constrained[i];
this.sortBone(child.parent);
this.sortBone(child);
}
}
else {
for (let i = 0; i < boneCount; i++) {
this.sortBone(constrained[i]);
}
}
this._updateCache.push(constraint);
for (let i = 0; i < boneCount; i++)
this.sortReset(constrained[i].children);
for (let i = 0; i < boneCount; i++)
constrained[i].sorted = true;
}
sortPathConstraintAttachment(skin, slotIndex, slotBone) {
let attachments = skin.attachments[slotIndex];
if (!attachments)
return;
for (let key in attachments) {
this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
}
}
sortPathConstraintAttachmentWith(attachment, slotBone) {
if (!(attachment instanceof PathAttachment))
return;
let pathBones = attachment.bones;
if (!pathBones)
this.sortBone(slotBone);
else {
let bones = this.bones;
for (let i = 0, n = pathBones.length; i < n;) {
let nn = pathBones[i++];
nn += i;
while (i < nn)
this.sortBone(bones[pathBones[i++]]);
}
}
}
sortPhysicsConstraint(constraint) {
const bone = constraint.bone;
constraint.active = bone.active && (!constraint.data.skinRequired || (this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true)));
if (!constraint.active)
return;
this.sortBone(bone);
this._updateCache.push(constraint);
this.sortReset(bone.children);
bone.sorted = true;
}
sortBone(bone) {
if (!bone)
return;
if (bone.sorted)
return;
let parent = bone.parent;
if (parent)
this.sortBone(parent);
bone.sorted = true;
this._updateCache.push(bone);
}
sortReset(bones) {
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (!bone.active)
continue;
if (bone.sorted)
this.sortReset(bone.children);
bone.sorted = false;
}
}
/** Updates the world transform for each bone and applies all constraints.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide. */
updateWorldTransform(physics) {
if (physics === undefined || physics === null)
throw new Error("physics is undefined");
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
bone.ax = bone.x;
bone.ay = bone.y;
bone.arotation = bone.rotation;
bone.ascaleX = bone.scaleX;
bone.ascaleY = bone.scaleY;
bone.ashearX = bone.shearX;
bone.ashearY = bone.shearY;
}
let updateCache = this._updateCache;
for (let i = 0, n = updateCache.length; i < n; i++)
updateCache[i].update(physics);
}
updateWorldTransformWith(physics, parent) {
if (!parent)
throw new Error("parent cannot be null.");
let bones = this.bones;
for (let i = 1, n = bones.length; i < n; i++) { // Skip root bone.
let bone = bones[i];
bone.ax = bone.x;
bone.ay = bone.y;
bone.arotation = bone.rotation;
bone.ascaleX = bone.scaleX;
bone.ascaleY = bone.scaleY;
bone.ashearX = bone.shearX;
bone.ashearY = bone.shearY;
}
// Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection.
let rootBone = this.getRootBone();
if (!rootBone)
throw new Error("Root bone must not be null.");
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
const rx = (rootBone.rotation + rootBone.shearX) * MathUtils.degRad;
const ry = (rootBone.rotation + 90 + rootBone.shearY) * MathUtils.degRad;
const la = Math.cos(rx) * rootBone.scaleX;
const lb = Math.cos(ry) * rootBone.scaleY;
const lc = Math.sin(rx) * rootBone.scaleX;
const ld = Math.sin(ry) * rootBone.scaleY;
rootBone.a = (pa * la + pb * lc) * this.scaleX;
rootBone.b = (pa * lb + pb * ld) * this.scaleX;
rootBone.c = (pc * la + pd * lc) * this.scaleY;
rootBone.d = (pc * lb + pd * ld) * this.scaleY;
// Update everything except root bone.
let updateCache = this._updateCache;
for (let i = 0, n = updateCache.length; i < n; i++) {
let updatable = updateCache[i];
if (updatable != rootBone)
updatable.update(physics);
}
}
/** Sets the bones, constraints, and slots to their setup pose values. */
setToSetupPose() {
this.setBonesToSetupPose();
this.setSlotsToSetupPose();
}
/** Sets the bones and constraints to their setup pose values. */
setBonesToSetupPose() {
for (const bone of this.bones)
bone.setToSetupPose();
for (const constraint of this.ikConstraints)
constraint.setToSetupPose();
for (const constraint of this.transformConstraints)
constraint.setToSetupPose();
for (const constraint of this.pathConstraints)
constraint.setToSetupPose();
for (const constraint of this.physicsConstraints)
constraint.setToSetupPose();
}
/** Sets the slots and draw order to their setup pose values. */
setSlotsToSetupPose() {
let slots = this.slots;
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
for (let i = 0, n = slots.length; i < n; i++)
slots[i].setToSetupPose();
}
/** @returns May return null. */
getRootBone() {
if (this.bones.length == 0)
return null;
return this.bones[0];
}
/** @returns May be null. */
findBone(boneName) {
if (!boneName)
throw new Error("boneName cannot be null.");
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (bone.data.name == boneName)
return bone;
}
return null;
}
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* repeatedly.
* @returns May be null. */
findSlot(slotName) {
if (!slotName)
throw new Error("slotName cannot be null.");
let slots = this.slots;
for (let i = 0, n = slots.length; i < n; i++) {
let slot = slots[i];
if (slot.data.name == slotName)
return slot;
}
return null;
}
/** Sets a skin by name.
*
* See {@link #setSkin()}. */
setSkinByName(skinName) {
let skin = this.data.findSkin(skinName);
if (!skin)
throw new Error("Skin not found: " + skinName);
this.setSkin(skin);
}
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
* skin is changed, {@link #updateCache()} is called.
*
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
* old skin, each slot's setup mode attachment is attached from the new skin.
*
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
* @param newSkin May be null. */
setSkin(newSkin) {
if (newSkin == this.skin)
return;
if (newSkin) {
if (this.skin)
newSkin.attachAll(this, this.skin);
else {
let slots = this.slots;
for (let i = 0, n = slots.length; i < n; i++) {
let slot = slots[i];
let name = slot.data.attachmentName;
if (name) {
let attachment = newSkin.getAttachment(i, name);
if (attachment)
slot.setAttachment(attachment);
}
}
}
}
this.skin = newSkin;
this.updateCache();
}
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
* name.
*
* See {@link #getAttachment()}.
* @returns May be null. */
getAttachmentByName(slotName, attachmentName) {
let slot = this.data.findSlot(slotName);
if (!slot)
throw new Error(`Can't find slot with name ${slotName}`);
return this.getAttachment(slot.index, attachmentName);
}
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
*
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
* @returns May be null. */
getAttachment(slotIndex, attachmentName) {
if (!attachmentName)
throw new Error("attachmentName cannot be null.");
if (this.skin) {
let attachment = this.skin.getAttachment(slotIndex, attachmentName);
if (attachment)
return attachment;
}
if (this.data.defaultSkin)
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
return null;
}
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
* @param attachmentName May be null to clear the slot's attachment. */
setAttachment(slotName, attachmentName) {
if (!slotName)
throw new Error("slotName cannot be null.");
let slots = this.slots;
for (let i = 0, n = slots.length; i < n; i++) {
let slot = slots[i];
if (slot.data.name == slotName) {
let attachment = null;
if (attachmentName) {
attachment = this.getAttachment(i, attachmentName);
if (!attachment)
throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
}
slot.setAttachment(attachment);
return;
}
}
throw new Error("Slot not found: " + slotName);
}
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly.
* @return May be null. */
findIkConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
}
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it repeatedly.
* @return May be null. */
findTransformConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
}
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly.
* @return May be null. */
findPathConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
}
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
* method than to call it repeatedly. */
findPhysicsConstraint(constraintName) {
if (constraintName == null)
throw new Error("constraintName cannot be null.");
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
}
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
getBoundsRect(clipper) {
let offset = new Vector2();
let size = new Vector2();
this.getBounds(offset, size, undefined, clipper);
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
}
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
* @param size An output value, the width and height of the AABB.
* @param temp Working memory to temporarily store attachments' computed world vertices.
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
getBounds(offset, size, temp = new Array(2), clipper = null) {
if (!offset)
throw new Error("offset cannot be null.");
if (!size)
throw new Error("size cannot be null.");
let drawOrder = this.drawOrder;
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
for (let i = 0, n = drawOrder.length; i < n; i++) {
let slot = drawOrder[i];
if (!slot.bone.active)
continue;
let verticesLength = 0;
let vertices = null;
let triangles = null;
let attachment = slot.getAttachment();
if (attachment instanceof RegionAttachment) {
verticesLength = 8;
vertices = Utils.setArraySize(temp, verticesLength, 0);
attachment.computeWorldVertices(slot, vertices, 0, 2);
triangles = Skeleton.quadTriangles;
}
else if (attachment instanceof MeshAttachment) {
let mesh = attachment;
verticesLength = mesh.worldVerticesLength;
vertices = Utils.setArraySize(temp, verticesLength, 0);
mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2);
triangles = mesh.triangles;
}
else if (attachment instanceof ClippingAttachment && clipper != null) {
clipper.clipStart(slot, attachment);
continue;
}
if (vertices && triangles) {
if (clipper != null && clipper.isClipping()) {
clipper.clipTriangles(vertices, triangles, triangles.length);
vertices = clipper.clippedVertices;
verticesLength = clipper.clippedVertices.length;
}
for (let ii = 0, nn = vertices.length; ii < nn; ii += 2) {
let x = vertices[ii], y = vertices[ii + 1];
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
}
if (clipper != null)
clipper.clipEndWithSlot(slot);
}
if (clipper != null)
clipper.clipEnd();
offset.set(minX, minY);
size.set(maxX - minX, maxY - minY);
}
/** Increments the skeleton's {@link #time}. */
update(delta) {
this.time += delta;
}
physicsTranslate(x, y) {
const physicsConstraints = this.physicsConstraints;
for (let i = 0, n = physicsConstraints.length; i < n; i++)
physicsConstraints[i].translate(x, y);
}
/** Calls {@link PhysicsConstraint#rotate(float, float, float)} for each physics constraint. */
physicsRotate(x, y, degrees) {
const physicsConstraints = this.physicsConstraints;
for (let i = 0, n = physicsConstraints.length; i < n; i++)
physicsConstraints[i].rotate(x, y, degrees);
}
}
/** Determines how physics and other non-deterministic updates are applied. */
export var Physics;
(function (Physics) {
/** Physics are not updated or applied. */
Physics[Physics["none"] = 0] = "none";
/** Physics are reset to the current pose. */
Physics[Physics["reset"] = 1] = "reset";
/** Physics are updated and the pose from physics is applied. */
Physics[Physics["update"] = 2] = "update";
/** Physics are not updated but the pose from physics is applied. */
Physics[Physics["pose"] = 3] = "pose";
})(Physics || (Physics = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2tlbGV0b24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvU2tlbGV0b24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRy9FLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQ3pFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDckUsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUNqQyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDakQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBSTNELE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSxXQUFXLEN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FrQixHQUFHLElBQUksS0FBSyxFQUFxQixDQUFDO1FBQ3pELEtBQ Line truncated
+68
View File
@@ -0,0 +1,68 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { AttachmentLoader } from "./attachments/AttachmentLoader.js";
import { SkeletonData } from "./SkeletonData.js";
/** Loads skeleton data in the Spine binary format.
*
* See [Spine binary format](http://esotericsoftware.com/spine-binary-format) and
* [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine
* Runtimes Guide. */
export declare class SkeletonBinary {
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
* runtime than were used in Spine.
*
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
scale: number;
attachmentLoader: AttachmentLoader;
private linkedMeshes;
constructor(attachmentLoader: AttachmentLoader);
readSkeletonData(binary: Uint8Array | ArrayBuffer): SkeletonData;
private readSkin;
private readAttachment;
private readSequence;
private readVertices;
private readFloatArray;
private readShortArray;
private readAnimation;
}
export declare class BinaryInput {
strings: string[];
private index;
private buffer;
constructor(data: Uint8Array | ArrayBuffer, strings?: string[], index?: number, buffer?: DataView);
readByte(): number;
readUnsignedByte(): number;
readShort(): number;
readInt32(): number;
readInt(optimizePositive: boolean): number;
readStringRef(): string | null;
readString(): string | null;
readFloat(): number;
readBoolean(): boolean;
}
File diff suppressed because it is too large. Load diff
+77
View File
@@ -0,0 +1,77 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoundingBoxAttachment } from "./attachments/BoundingBoxAttachment.js";
import { Skeleton } from "./Skeleton.js";
import { NumberArrayLike } from "./Utils.js";
/** Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are
* provided along with convenience methods for doing hit detection. */
export declare class SkeletonBounds {
/** The left edge of the axis aligned bounding box. */
minX: number;
/** The bottom edge of the axis aligned bounding box. */
minY: number;
/** The right edge of the axis aligned bounding box. */
maxX: number;
/** The top edge of the axis aligned bounding box. */
maxY: number;
/** The visible bounding boxes. */
boundingBoxes: BoundingBoxAttachment[];
/** The world vertices for the bounding box polygons. */
polygons: NumberArrayLike[];
private polygonPool;
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
* box's polygon.
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
* SkeletonBounds AABB methods will always return true. */
update(skeleton: Skeleton, updateAabb: boolean): void;
aabbCompute(): void;
/** Returns true if the axis aligned bounding box contains the point. */
aabbContainsPoint(x: number, y: number): boolean;
/** Returns true if the axis aligned bounding box intersects the line segment. */
aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number): boolean;
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
aabbIntersectsSkeleton(bounds: SkeletonBounds): boolean;
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
containsPoint(x: number, y: number): BoundingBoxAttachment | null;
/** Returns true if the polygon contains the point. */
containsPointPolygon(polygon: NumberArrayLike, x: number, y: number): boolean;
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
* true. */
intersectsSegment(x1: number, y1: number, x2: number, y2: number): BoundingBoxAttachment | null;
/** Returns true if the polygon contains any part of the line segment. */
intersectsSegmentPolygon(polygon: NumberArrayLike, x1: number, y1: number, x2: number, y2: number): boolean;
/** Returns the polygon for the specified bounding box, or null. */
getPolygon(boundingBox: BoundingBoxAttachment): NumberArrayLike | null;
/** The width of the axis aligned bounding box. */
getWidth(): number;
/** The height of the axis aligned bounding box. */
getHeight(): number;
}
+217
View File
@@ -0,0 +1,217 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoundingBoxAttachment } from "./attachments/BoundingBoxAttachment.js";
import { Pool, Utils } from "./Utils.js";
/** Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are
* provided along with convenience methods for doing hit detection. */
export class SkeletonBounds {
/** The left edge of the axis aligned bounding box. */
minX = 0;
/** The bottom edge of the axis aligned bounding box. */
minY = 0;
/** The right edge of the axis aligned bounding box. */
maxX = 0;
/** The top edge of the axis aligned bounding box. */
maxY = 0;
/** The visible bounding boxes. */
boundingBoxes = new Array();
/** The world vertices for the bounding box polygons. */
polygons = new Array();
polygonPool = new Pool(() => {
return Utils.newFloatArray(16);
});
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
* box's polygon.
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
* SkeletonBounds AABB methods will always return true. */
update(skeleton, updateAabb) {
if (!skeleton)
throw new Error("skeleton cannot be null.");
let boundingBoxes = this.boundingBoxes;
let polygons = this.polygons;
let polygonPool = this.polygonPool;
let slots = skeleton.slots;
let slotCount = slots.length;
boundingBoxes.length = 0;
polygonPool.freeAll(polygons);
polygons.length = 0;
for (let i = 0; i < slotCount; i++) {
let slot = slots[i];
if (!slot.bone.active)
continue;
let attachment = slot.getAttachment();
if (attachment instanceof BoundingBoxAttachment) {
let boundingBox = attachment;
boundingBoxes.push(boundingBox);
let polygon = polygonPool.obtain();
if (polygon.length != boundingBox.worldVerticesLength) {
polygon = Utils.newFloatArray(boundingBox.worldVerticesLength);
}
polygons.push(polygon);
boundingBox.computeWorldVertices(slot, 0, boundingBox.worldVerticesLength, polygon, 0, 2);
}
}
if (updateAabb) {
this.aabbCompute();
}
else {
this.minX = Number.POSITIVE_INFINITY;
this.minY = Number.POSITIVE_INFINITY;
this.maxX = Number.NEGATIVE_INFINITY;
this.maxY = Number.NEGATIVE_INFINITY;
}
}
aabbCompute() {
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
let polygons = this.polygons;
for (let i = 0, n = polygons.length; i < n; i++) {
let polygon = polygons[i];
let vertices = polygon;
for (let ii = 0, nn = polygon.length; ii < nn; ii += 2) {
let x = vertices[ii];
let y = vertices[ii + 1];
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
}
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
}
/** Returns true if the axis aligned bounding box contains the point. */
aabbContainsPoint(x, y) {
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
}
/** Returns true if the axis aligned bounding box intersects the line segment. */
aabbIntersectsSegment(x1, y1, x2, y2) {
let minX = this.minX;
let minY = this.minY;
let maxX = this.maxX;
let maxY = this.maxY;
if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY))
return false;
let m = (y2 - y1) / (x2 - x1);
let y = m * (minX - x1) + y1;
if (y > minY && y < maxY)
return true;
y = m * (maxX - x1) + y1;
if (y > minY && y < maxY)
return true;
let x = (minY - y1) / m + x1;
if (x > minX && x < maxX)
return true;
x = (maxY - y1) / m + x1;
if (x > minX && x < maxX)
return true;
return false;
}
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
aabbIntersectsSkeleton(bounds) {
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
}
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
containsPoint(x, y) {
let polygons = this.polygons;
for (let i = 0, n = polygons.length; i < n; i++)
if (this.containsPointPolygon(polygons[i], x, y))
return this.boundingBoxes[i];
return null;
}
/** Returns true if the polygon contains the point. */
containsPointPolygon(polygon, x, y) {
let vertices = polygon;
let nn = polygon.length;
let prevIndex = nn - 2;
let inside = false;
for (let ii = 0; ii < nn; ii += 2) {
let vertexY = vertices[ii + 1];
let prevY = vertices[prevIndex + 1];
if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) {
let vertexX = vertices[ii];
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
inside = !inside;
}
prevIndex = ii;
}
return inside;
}
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
* true. */
intersectsSegment(x1, y1, x2, y2) {
let polygons = this.polygons;
for (let i = 0, n = polygons.length; i < n; i++)
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
return this.boundingBoxes[i];
return null;
}
/** Returns true if the polygon contains any part of the line segment. */
intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
let vertices = polygon;
let nn = polygon.length;
let width12 = x1 - x2, height12 = y1 - y2;
let det1 = x1 * y2 - y1 * x2;
let x3 = vertices[nn - 2], y3 = vertices[nn - 1];
for (let ii = 0; ii < nn; ii += 2) {
let x4 = vertices[ii], y4 = vertices[ii + 1];
let det2 = x3 * y4 - y3 * x4;
let width34 = x3 - x4, height34 = y3 - y4;
let det3 = width12 * height34 - height12 * width34;
let x = (det1 * width34 - width12 * det2) / det3;
if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
let y = (det1 * height34 - height12 * det2) / det3;
if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)))
return true;
}
x3 = x4;
y3 = y4;
}
return false;
}
/** Returns the polygon for the specified bounding box, or null. */
getPolygon(boundingBox) {
if (!boundingBox)
throw new Error("boundingBox cannot be null.");
let index = this.boundingBoxes.indexOf(boundingBox);
return index == -1 ? null : this.polygons[index];
}
/** The width of the axis aligned bounding box. */
getWidth() {
return this.maxX - this.minX;
}
/** The height of the axis aligned bounding box. */
getHeight() {
return this.maxY - this.minY;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2tlbGV0b25Cb3VuZHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvU2tlbGV0b25Cb3VuZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRS9FLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdDQUF3QyxDQUFDO0FBRS9FLE9BQU8sRUFBbUIsSUFBSSxFQUFFLEtBQUssRUFBRSxNQUFNLFlBQVksQ0FBQztBQUUxRDtzRUFDc0U7QUFDdEUsTUFBTSxPQUFPLGNBQWM7SUFFMUIsc0RBQXNEO0lBQ3RELElBQUksR0FBRyxDQUFDLENBQUM7SUFFVCx3REFBd0Q7SUFDeEQsSUFBSSxHQUFHLENBQUMsQ0FBQztJQUVULHVEQUF1RDtJQUN2RCxJQUFJLEdBQUcsQ0FBQyxDQUFDO0lBRVQscURBQXFEO0lBQ3JELElBQUksR0FBRyxDQUFDLENBQUM7SUFFVCxrQ0FBa0M7SUFDbEMsYUFBYSxHQUFHLElBQUksS0FBSyxFQUF5QixDQUFDO0lBRW5ELHdEQUF3RDtJQUN4RCxRQUFRLEdBQUcsSUFBSSxLQUFLLEVBQW1CLENBQUM7SUFFaEMsV0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View File
@@ -0,0 +1,63 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ClippingAttachment } from "./attachments/ClippingAttachment.js";
import { Slot } from "./Slot.js";
import { Color, NumberArrayLike } from "./Utils.js";
export declare class SkeletonClipping {
private triangulator;
private clippingPolygon;
private clipOutput;
clippedVertices: number[];
clippedUVs: number[];
clippedTriangles: number[];
private scratch;
private clipAttachment;
private clippingPolygons;
clipStart(slot: Slot, clip: ClippingAttachment): number;
clipEndWithSlot(slot: Slot): void;
clipEnd(): void;
isClipping(): boolean;
/**
* @deprecated Use clipTriangles without verticesLength parameter. Mark for removal in 4.3.
*/
clipTriangles(vertices: NumberArrayLike, verticesLength: number, triangles: NumberArrayLike, trianglesLength: number): void;
/**
* @deprecated Use clipTriangles without verticesLength parameter. Mark for removal in 4.3.
*/
clipTriangles(vertices: NumberArrayLike, verticesLength: number, triangles: NumberArrayLike, trianglesLength: number, uvs: NumberArrayLike, light: Color, dark: Color, twoColor: boolean): void;
clipTriangles(vertices: NumberArrayLike, triangles: NumberArrayLike, trianglesLength: number): void;
clipTriangles(vertices: NumberArrayLike, triangles: NumberArrayLike, trianglesLength: number, uvs: NumberArrayLike, light: Color, dark: Color, twoColor: boolean): void;
private clipTrianglesNoRender;
private clipTrianglesRender;
clipTrianglesUnpacked(vertices: NumberArrayLike, triangles: NumberArrayLike, trianglesLength: number, uvs: NumberArrayLike): void;
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
clip(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, clippingArea: Array<number>, output: Array<number>): boolean;
static makeClockwise(polygon: NumberArrayLike): void;
}
+487
View File
@@ -0,0 +1,487 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Triangulator } from "./Triangulator.js";
import { Utils } from "./Utils.js";
export class SkeletonClipping {
triangulator = new Triangulator();
clippingPolygon = new Array();
clipOutput = new Array();
clippedVertices = new Array();
clippedUVs = new Array();
clippedTriangles = new Array();
scratch = new Array();
clipAttachment = null;
clippingPolygons = null;
clipStart(slot, clip) {
if (this.clipAttachment)
return 0;
this.clipAttachment = clip;
let n = clip.worldVerticesLength;
let vertices = Utils.setArraySize(this.clippingPolygon, n);
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
let clippingPolygon = this.clippingPolygon;
SkeletonClipping.makeClockwise(clippingPolygon);
let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
for (let i = 0, n = clippingPolygons.length; i < n; i++) {
let polygon = clippingPolygons[i];
SkeletonClipping.makeClockwise(polygon);
polygon.push(polygon[0]);
polygon.push(polygon[1]);
}
return clippingPolygons.length;
}
clipEndWithSlot(slot) {
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
this.clipEnd();
}
clipEnd() {
if (!this.clipAttachment)
return;
this.clipAttachment = null;
this.clippingPolygons = null;
this.clippedVertices.length = 0;
this.clippedTriangles.length = 0;
this.clippingPolygon.length = 0;
}
isClipping() {
return this.clipAttachment != null;
}
clipTriangles(vertices, verticesLengthOrTriangles, trianglesOrTrianglesLength, trianglesLengthOrUvs, uvsOrLight, lightOrDark, darkOrTwoColor, twoColorParam) {
// Determine which overload is being used
let triangles;
let trianglesLength;
let uvs;
let light;
let dark;
let twoColor;
if (typeof verticesLengthOrTriangles === 'number') {
triangles = trianglesOrTrianglesLength;
trianglesLength = trianglesLengthOrUvs;
uvs = uvsOrLight;
light = lightOrDark;
dark = darkOrTwoColor;
twoColor = twoColorParam;
}
else {
triangles = verticesLengthOrTriangles;
trianglesLength = trianglesOrTrianglesLength;
uvs = trianglesLengthOrUvs;
light = uvsOrLight;
dark = lightOrDark;
twoColor = darkOrTwoColor;
}
if (uvs && light && dark && typeof twoColor === 'boolean')
this.clipTrianglesRender(vertices, triangles, trianglesLength, uvs, light, dark, twoColor);
else
this.clipTrianglesNoRender(vertices, triangles, trianglesLength);
}
clipTrianglesNoRender(vertices, triangles, trianglesLength) {
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
let clippedTriangles = this.clippedTriangles;
let polygons = this.clippingPolygons;
let polygonsCount = polygons.length;
let index = 0;
clippedVertices.length = 0;
clippedTriangles.length = 0;
for (let i = 0; i < trianglesLength; i += 3) {
let vertexOffset = triangles[i] << 1;
let x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
vertexOffset = triangles[i + 1] << 1;
let x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
vertexOffset = triangles[i + 2] << 1;
let x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
for (let p = 0; p < polygonsCount; p++) {
let s = clippedVertices.length;
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
let clipOutputLength = clipOutput.length;
if (clipOutputLength == 0)
continue;
let clipOutputCount = clipOutputLength >> 1;
let clipOutputItems = this.clipOutput;
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
for (let ii = 0; ii < clipOutputLength; ii += 2, s += 2) {
let x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
clippedVerticesItems[s] = x;
clippedVerticesItems[s + 1] = y;
}
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));
clipOutputCount--;
for (let ii = 1; ii < clipOutputCount; ii++, s += 3) {
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + ii);
clippedTrianglesItems[s + 2] = (index + ii + 1);
}
index += clipOutputCount + 1;
}
else {
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * 2);
clippedVerticesItems[s] = x1;
clippedVerticesItems[s + 1] = y1;
clippedVerticesItems[s + 2] = x2;
clippedVerticesItems[s + 3] = y2;
clippedVerticesItems[s + 4] = x3;
clippedVerticesItems[s + 5] = y3;
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + 1);
clippedTrianglesItems[s + 2] = (index + 2);
index += 3;
break;
}
}
}
}
clipTrianglesRender(vertices, triangles, trianglesLength, uvs, light, dark, twoColor) {
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
let clippedTriangles = this.clippedTriangles;
let polygons = this.clippingPolygons;
let polygonsCount = polygons.length;
let vertexSize = twoColor ? 12 : 8;
let index = 0;
clippedVertices.length = 0;
clippedTriangles.length = 0;
for (let i = 0; i < trianglesLength; i += 3) {
let vertexOffset = triangles[i] << 1;
let x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
let u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 1] << 1;
let x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
let u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 2] << 1;
let x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
let u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
for (let p = 0; p < polygonsCount; p++) {
let s = clippedVertices.length;
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
let clipOutputLength = clipOutput.length;
if (clipOutputLength == 0)
continue;
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
let clipOutputCount = clipOutputLength >> 1;
let clipOutputItems = this.clipOutput;
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize);
for (let ii = 0; ii < clipOutputLength; ii += 2, s += vertexSize) {
let x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
clippedVerticesItems[s] = x;
clippedVerticesItems[s + 1] = y;
clippedVerticesItems[s + 2] = light.r;
clippedVerticesItems[s + 3] = light.g;
clippedVerticesItems[s + 4] = light.b;
clippedVerticesItems[s + 5] = light.a;
let c0 = x - x3, c1 = y - y3;
let a = (d0 * c0 + d1 * c1) * d;
let b = (d4 * c0 + d2 * c1) * d;
let c = 1 - a - b;
clippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c;
clippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c;
if (twoColor) {
clippedVerticesItems[s + 8] = dark.r;
clippedVerticesItems[s + 9] = dark.g;
clippedVerticesItems[s + 10] = dark.b;
clippedVerticesItems[s + 11] = dark.a;
}
}
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));
clipOutputCount--;
for (let ii = 1; ii < clipOutputCount; ii++, s += 3) {
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + ii);
clippedTrianglesItems[s + 2] = (index + ii + 1);
}
index += clipOutputCount + 1;
}
else {
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * vertexSize);
clippedVerticesItems[s] = x1;
clippedVerticesItems[s + 1] = y1;
clippedVerticesItems[s + 2] = light.r;
clippedVerticesItems[s + 3] = light.g;
clippedVerticesItems[s + 4] = light.b;
clippedVerticesItems[s + 5] = light.a;
if (!twoColor) {
clippedVerticesItems[s + 6] = u1;
clippedVerticesItems[s + 7] = v1;
clippedVerticesItems[s + 8] = x2;
clippedVerticesItems[s + 9] = y2;
clippedVerticesItems[s + 10] = light.r;
clippedVerticesItems[s + 11] = light.g;
clippedVerticesItems[s + 12] = light.b;
clippedVerticesItems[s + 13] = light.a;
clippedVerticesItems[s + 14] = u2;
clippedVerticesItems[s + 15] = v2;
clippedVerticesItems[s + 16] = x3;
clippedVerticesItems[s + 17] = y3;
clippedVerticesItems[s + 18] = light.r;
clippedVerticesItems[s + 19] = light.g;
clippedVerticesItems[s + 20] = light.b;
clippedVerticesItems[s + 21] = light.a;
clippedVerticesItems[s + 22] = u3;
clippedVerticesItems[s + 23] = v3;
}
else {
clippedVerticesItems[s + 6] = u1;
clippedVerticesItems[s + 7] = v1;
clippedVerticesItems[s + 8] = dark.r;
clippedVerticesItems[s + 9] = dark.g;
clippedVerticesItems[s + 10] = dark.b;
clippedVerticesItems[s + 11] = dark.a;
clippedVerticesItems[s + 12] = x2;
clippedVerticesItems[s + 13] = y2;
clippedVerticesItems[s + 14] = light.r;
clippedVerticesItems[s + 15] = light.g;
clippedVerticesItems[s + 16] = light.b;
clippedVerticesItems[s + 17] = light.a;
clippedVerticesItems[s + 18] = u2;
clippedVerticesItems[s + 19] = v2;
clippedVerticesItems[s + 20] = dark.r;
clippedVerticesItems[s + 21] = dark.g;
clippedVerticesItems[s + 22] = dark.b;
clippedVerticesItems[s + 23] = dark.a;
clippedVerticesItems[s + 24] = x3;
clippedVerticesItems[s + 25] = y3;
clippedVerticesItems[s + 26] = light.r;
clippedVerticesItems[s + 27] = light.g;
clippedVerticesItems[s + 28] = light.b;
clippedVerticesItems[s + 29] = light.a;
clippedVerticesItems[s + 30] = u3;
clippedVerticesItems[s + 31] = v3;
clippedVerticesItems[s + 32] = dark.r;
clippedVerticesItems[s + 33] = dark.g;
clippedVerticesItems[s + 34] = dark.b;
clippedVerticesItems[s + 35] = dark.a;
}
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + 1);
clippedTrianglesItems[s + 2] = (index + 2);
index += 3;
break;
}
}
}
}
clipTrianglesUnpacked(vertices, triangles, trianglesLength, uvs) {
let clipOutput = this.clipOutput, clippedVertices = this.clippedVertices, clippedUVs = this.clippedUVs;
let clippedTriangles = this.clippedTriangles;
let polygons = this.clippingPolygons;
let polygonsCount = polygons.length;
let index = 0;
clippedVertices.length = 0;
clippedUVs.length = 0;
clippedTriangles.length = 0;
for (let i = 0; i < trianglesLength; i += 3) {
let vertexOffset = triangles[i] << 1;
let x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
let u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 1] << 1;
let x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
let u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 2] << 1;
let x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
let u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
for (let p = 0; p < polygonsCount; p++) {
let s = clippedVertices.length;
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
let clipOutputLength = clipOutput.length;
if (clipOutputLength == 0)
continue;
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
let clipOutputCount = clipOutputLength >> 1;
let clipOutputItems = this.clipOutput;
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
let clippedUVsItems = Utils.setArraySize(clippedUVs, s + clipOutputCount * 2);
for (let ii = 0; ii < clipOutputLength; ii += 2, s += 2) {
let x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
clippedVerticesItems[s] = x;
clippedVerticesItems[s + 1] = y;
let c0 = x - x3, c1 = y - y3;
let a = (d0 * c0 + d1 * c1) * d;
let b = (d4 * c0 + d2 * c1) * d;
let c = 1 - a - b;
clippedUVsItems[s] = u1 * a + u2 * b + u3 * c;
clippedUVsItems[s + 1] = v1 * a + v2 * b + v3 * c;
}
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2));
clipOutputCount--;
for (let ii = 1; ii < clipOutputCount; ii++, s += 3) {
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + ii);
clippedTrianglesItems[s + 2] = (index + ii + 1);
}
index += clipOutputCount + 1;
}
else {
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * 2);
clippedVerticesItems[s] = x1;
clippedVerticesItems[s + 1] = y1;
clippedVerticesItems[s + 2] = x2;
clippedVerticesItems[s + 3] = y2;
clippedVerticesItems[s + 4] = x3;
clippedVerticesItems[s + 5] = y3;
let clippedUVSItems = Utils.setArraySize(clippedUVs, s + 3 * 2);
clippedUVSItems[s] = u1;
clippedUVSItems[s + 1] = v1;
clippedUVSItems[s + 2] = u2;
clippedUVSItems[s + 3] = v2;
clippedUVSItems[s + 4] = u3;
clippedUVSItems[s + 5] = v3;
s = clippedTriangles.length;
let clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3);
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (index + 1);
clippedTrianglesItems[s + 2] = (index + 2);
index += 3;
break;
}
}
}
}
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
let originalOutput = output;
let clipped = false;
// Avoid copy at the end.
let input;
if (clippingArea.length % 4 >= 2) {
input = output;
output = this.scratch;
}
else
input = this.scratch;
input.length = 0;
input.push(x1);
input.push(y1);
input.push(x2);
input.push(y2);
input.push(x3);
input.push(y3);
input.push(x1);
input.push(y1);
output.length = 0;
let clippingVerticesLast = clippingArea.length - 4;
let clippingVertices = clippingArea;
for (let i = 0;; i += 2) {
let edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
let ex = edgeX - clippingVertices[i + 2], ey = edgeY - clippingVertices[i + 3];
let outputStart = output.length;
let inputVertices = input;
for (let ii = 0, nn = input.length - 2; ii < nn;) {
let inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
ii += 2;
let inputX2 = inputVertices[ii], inputY2 = inputVertices[ii + 1];
let s2 = ey * (edgeX - inputX2) > ex * (edgeY - inputY2);
let s1 = ey * (edgeX - inputX) - ex * (edgeY - inputY);
if (s1 > 0) {
if (s2) { // v1 inside, v2 inside
output.push(inputX2);
output.push(inputY2);
continue;
}
// v1 inside, v2 outside
let ix = inputX2 - inputX, iy = inputY2 - inputY, t = s1 / (ix * ey - iy * ex);
if (t >= 0 && t <= 1) {
output.push(inputX + ix * t);
output.push(inputY + iy * t);
}
else {
output.push(inputX2);
output.push(inputY2);
continue;
}
}
else if (s2) { // v1 outside, v2 inside
let ix = inputX2 - inputX, iy = inputY2 - inputY, t = s1 / (ix * ey - iy * ex);
if (t >= 0 && t <= 1) {
output.push(inputX + ix * t);
output.push(inputY + iy * t);
output.push(inputX2);
output.push(inputY2);
}
else {
output.push(inputX2);
output.push(inputY2);
continue;
}
}
clipped = true;
}
if (outputStart == output.length) { // All edges outside.
originalOutput.length = 0;
return true;
}
output.push(output[0]);
output.push(output[1]);
if (i == clippingVerticesLast)
break;
let temp = output;
output = input;
output.length = 0;
input = temp;
}
if (originalOutput != output) {
originalOutput.length = 0;
for (let i = 0, n = output.length - 2; i < n; i++)
originalOutput[i] = output[i];
}
else
originalOutput.length = originalOutput.length - 2;
return clipped;
}
static makeClockwise(polygon) {
let vertices = polygon;
let verticeslength = polygon.length;
let area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x = 0, p1y = 0, p2x = 0, p2y = 0;
for (let i = 0, n = verticeslength - 3; i < n; i += 2) {
p1x = vertices[i];
p1y = vertices[i + 1];
p2x = vertices[i + 2];
p2y = vertices[i + 3];
area += p1x * p2y - p2x * p1y;
}
if (area < 0)
return;
for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
let x = vertices[i], y = vertices[i + 1];
let other = lastX - i;
vertices[i] = vertices[other];
vertices[i + 1] = vertices[other + 1];
vertices[other] = x;
vertices[other + 1] = y;
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2tlbGV0b25DbGlwcGluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Ta2VsZXRvbkNsaXBwaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUkvRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDakQsT0FBTyxFQUFFLEtBQUssRUFBMEIsTUFBTSxZQUFZLENBQUM7QUFFM0QsTUFBTSxPQUFPLGdCQUFnQjtJQUNwQixZQUFZLEdBQUcsSUFBSSxZQUFZLEVBQUUsQ0FBQztJQUNsQyxlQUFlLEdBQUcsSUFBSSxLQUFLLEVBQVUsQ0FBQztJQUN0QyxVQUFVLEdBQUcsSUFBSSxLQUFLLEVBQVUsQ0FBQztJQUN6QyxlQUFlLEdBQUcsSUFBSSxLQUFLLEVBQVUsQ0FBQztJQUN0QyxVQUFVLEdBQUcsSUFBSSxLQUFLLEVBQVUsQ0FBQztJQUNqQyxnQkFBZ0IsR0FBRyxJQUFJLEtBQUssRUFBVSx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BQUMsSUFBSSxDQUFDLENBQUM7WUFDckMsSUFBSSxFQUFFLEdBQUcsUUFBUSxDQUFDLFlBQVksQ0FBQyxFQUFFLEVBQUUsR0FBRyxRQUFRLENBQUMsW Line truncated
+124
View File
@@ -0,0 +1,124 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Animation } from "./Animation.js";
import { BoneData } from "./BoneData.js";
import { EventData } from "./EventData.js";
import { IkConstraintData } from "./IkConstraintData.js";
import { PathConstraintData } from "./PathConstraintData.js";
import { PhysicsConstraintData } from "./PhysicsConstraintData.js";
import { Skin } from "./Skin.js";
import { SlotData } from "./SlotData.js";
import { TransformConstraintData } from "./TransformConstraintData.js";
/** Stores the setup pose and all of the stateless data for a skeleton.
*
* See [Data objects](http://esotericsoftware.com/spine-runtime-architecture#Data-objects) in the Spine Runtimes
* Guide. */
export declare class SkeletonData {
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
name: string | null;
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
bones: BoneData[];
/** The skeleton's slots in the setup pose draw order. */
slots: SlotData[];
skins: Skin[];
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
*
* See {@link Skeleton#getAttachmentByName()}.
* May be null. */
defaultSkin: Skin | null;
/** The skeleton's events. */
events: EventData[];
/** The skeleton's animations. */
animations: Animation[];
/** The skeleton's IK constraints. */
ikConstraints: IkConstraintData[];
/** The skeleton's transform constraints. */
transformConstraints: TransformConstraintData[];
/** The skeleton's path constraints. */
pathConstraints: PathConstraintData[];
/** The skeleton's physics constraints. */
physicsConstraints: PhysicsConstraintData[];
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
x: number;
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
y: number;
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
width: number;
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
height: number;
/** Baseline scale factor for applying distance-dependent effects on non-scalable properties, such as angle or scale. Default
* is 100. */
referenceScale: number;
/** The Spine version used to export the skeleton data, or null. */
version: string | null;
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
hash: string | null;
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
fps: number;
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
imagesPath: string | null;
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
audioPath: string | null;
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findBone(boneName: string): BoneData | null;
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findSlot(slotName: string): SlotData | null;
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findSkin(skinName: string): Skin | null;
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findEvent(eventDataName: string): EventData | null;
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
* call it multiple times.
* @returns May be null. */
findAnimation(animationName: string): Animation | null;
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findIkConstraint(constraintName: string): IkConstraintData | null;
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it multiple times.
* @return May be null. */
findTransformConstraint(constraintName: string): TransformConstraintData | null;
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findPathConstraint(constraintName: string): PathConstraintData | null;
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findPhysicsConstraint(constraintName: string): PhysicsConstraintData | null;
}
+207
View File
@@ -0,0 +1,207 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/** Stores the setup pose and all of the stateless data for a skeleton.
*
* See [Data objects](http://esotericsoftware.com/spine-runtime-architecture#Data-objects) in the Spine Runtimes
* Guide. */
export class SkeletonData {
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
name = null;
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
bones = new Array(); // Ordered parents first.
/** The skeleton's slots in the setup pose draw order. */
slots = new Array(); // Setup pose draw order.
skins = new Array();
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
*
* See {@link Skeleton#getAttachmentByName()}.
* May be null. */
defaultSkin = null;
/** The skeleton's events. */
events = new Array();
/** The skeleton's animations. */
animations = new Array();
/** The skeleton's IK constraints. */
ikConstraints = new Array();
/** The skeleton's transform constraints. */
transformConstraints = new Array();
/** The skeleton's path constraints. */
pathConstraints = new Array();
/** The skeleton's physics constraints. */
physicsConstraints = new Array();
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
x = 0;
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
y = 0;
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
width = 0;
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
height = 0;
/** Baseline scale factor for applying distance-dependent effects on non-scalable properties, such as angle or scale. Default
* is 100. */
referenceScale = 100;
/** The Spine version used to export the skeleton data, or null. */
version = null;
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
hash = null;
// Nonessential
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
fps = 0;
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
imagesPath = null;
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
audioPath = null;
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findBone(boneName) {
if (!boneName)
throw new Error("boneName cannot be null.");
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (bone.name == boneName)
return bone;
}
return null;
}
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findSlot(slotName) {
if (!slotName)
throw new Error("slotName cannot be null.");
let slots = this.slots;
for (let i = 0, n = slots.length; i < n; i++) {
let slot = slots[i];
if (slot.name == slotName)
return slot;
}
return null;
}
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findSkin(skinName) {
if (!skinName)
throw new Error("skinName cannot be null.");
let skins = this.skins;
for (let i = 0, n = skins.length; i < n; i++) {
let skin = skins[i];
if (skin.name == skinName)
return skin;
}
return null;
}
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
* multiple times.
* @returns May be null. */
findEvent(eventDataName) {
if (!eventDataName)
throw new Error("eventDataName cannot be null.");
let events = this.events;
for (let i = 0, n = events.length; i < n; i++) {
let event = events[i];
if (event.name == eventDataName)
return event;
}
return null;
}
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
* call it multiple times.
* @returns May be null. */
findAnimation(animationName) {
if (!animationName)
throw new Error("animationName cannot be null.");
let animations = this.animations;
for (let i = 0, n = animations.length; i < n; i++) {
let animation = animations[i];
if (animation.name == animationName)
return animation;
}
return null;
}
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findIkConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
const ikConstraints = this.ikConstraints;
for (let i = 0, n = ikConstraints.length; i < n; i++) {
const constraint = ikConstraints[i];
if (constraint.name == constraintName)
return constraint;
}
return null;
}
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it multiple times.
* @return May be null. */
findTransformConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
const transformConstraints = this.transformConstraints;
for (let i = 0, n = transformConstraints.length; i < n; i++) {
const constraint = transformConstraints[i];
if (constraint.name == constraintName)
return constraint;
}
return null;
}
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findPathConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
const pathConstraints = this.pathConstraints;
for (let i = 0, n = pathConstraints.length; i < n; i++) {
const constraint = pathConstraints[i];
if (constraint.name == constraintName)
return constraint;
}
return null;
}
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times.
* @return May be null. */
findPhysicsConstraint(constraintName) {
if (!constraintName)
throw new Error("constraintName cannot be null.");
const physicsConstraints = this.physicsConstraints;
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
const constraint = physicsConstraints[i];
if (constraint.name == constraintName)
return constraint;
}
return null;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2tlbGV0b25EYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1NrZW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Q3pDLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxhQUFhLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQztZQUN0RCxNQUFNLFVBQVUsR0FBRyxhQUFhLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDcEMsSUFBSSxVQUFVLENBQUMsSUFBSSxJQUFJLGNBQWM7Z0JBQUUsT0FBTyxVQUFVLENBQUM7UUFDMUQsQ0FBQztRQUNELE9BQU8sSUFBSSxDQUFDO0lBQ2IsQ0FBQztJQUVEOzs4QkFFMEI7SUFDMUIsdUJBQXVCLENBQUUsY0FBc0I7UUFDOUMsSUFBSSxDQUFDLGNBQWM7WUFBRSxNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQUM7UUFDdkUsTUFBTSxvQkFBb0IsR0FBRyxJQUFJLENBQUMsb0JBQW9CLENBQUM7UUFDdkQsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLG9CQUFvQixDQUFDLE1BQU0sRUFBRSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFL Line truncated
+53
View File
@@ -0,0 +1,53 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { VertexAttachment, Attachment } from "./attachments/Attachment.js";
import { AttachmentLoader } from "./attachments/AttachmentLoader.js";
import { SkeletonData } from "./SkeletonData.js";
import { Skin } from "./Skin.js";
import { Sequence } from "./attachments/Sequence.js";
/** Loads skeleton data in the Spine JSON format.
*
* See [Spine JSON format](http://esotericsoftware.com/spine-json-format) and
* [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine
* Runtimes Guide. */
export declare class SkeletonJson {
attachmentLoader: AttachmentLoader;
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
* runtime than were used in Spine.
*
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
scale: number;
private linkedMeshes;
constructor(attachmentLoader: AttachmentLoader);
readSkeletonData(json: string | any): SkeletonData;
readAttachment(map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment | null;
readSequence(map: any): Sequence | null;
readVertices(map: any, attachment: VertexAttachment, verticesLength: number): void;
readAnimation(map: any, name: string, skeletonData: SkeletonData): void;
}
File diff suppressed because it is too large. Load diff
+73
View File
@@ -0,0 +1,73 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Attachment } from "./attachments/Attachment.js";
import { BoneData } from "./BoneData.js";
import { ConstraintData } from "./ConstraintData.js";
import { Skeleton } from "./Skeleton.js";
import { Color, StringMap } from "./Utils.js";
/** Stores an entry in the skin consisting of the slot index, name, and attachment **/
export declare class SkinEntry {
slotIndex: number;
name: string;
attachment: Attachment;
constructor(slotIndex: number | undefined, name: string, attachment: Attachment);
}
/** Stores attachments by slot index and attachment name.
*
* See SkeletonData {@link SkeletonData#defaultSkin}, Skeleton {@link Skeleton#skin}, and
* [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */
export declare class Skin {
/** The skin's name, which is unique across all skins in the skeleton. */
name: string;
attachments: StringMap<Attachment>[];
bones: BoneData[];
constraints: ConstraintData[];
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
color: Color;
constructor(name: string);
/** Adds an attachment to the skin for the specified slot index and name. */
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
addSkin(skin: Skin): void;
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
copySkin(skin: Skin): void;
/** Returns the attachment for the specified slot index and name, or null. */
getAttachment(slotIndex: number, name: string): Attachment | null;
/** Removes the attachment in the skin for the specified slot index and name, if any. */
removeAttachment(slotIndex: number, name: string): void;
/** Returns all attachments in this skin. */
getAttachments(): Array<SkinEntry>;
/** Returns all attachments in this skin for the specified slot index. */
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
/** Clears all attachments, bones, and constraints. */
clear(): void;
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
}
+209
View File
@@ -0,0 +1,209 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { MeshAttachment } from "./attachments/MeshAttachment.js";
import { Color } from "./Utils.js";
/** Stores an entry in the skin consisting of the slot index, name, and attachment **/
export class SkinEntry {
slotIndex;
name;
attachment;
constructor(slotIndex = 0, name, attachment) {
this.slotIndex = slotIndex;
this.name = name;
this.attachment = attachment;
}
}
/** Stores attachments by slot index and attachment name.
*
* See SkeletonData {@link SkeletonData#defaultSkin}, Skeleton {@link Skeleton#skin}, and
* [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */
export class Skin {
/** The skin's name, which is unique across all skins in the skeleton. */
name;
attachments = new Array();
bones = Array();
constraints = new Array();
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
color = new Color(0.99607843, 0.61960787, 0.30980393, 1); // fe9e4fff
constructor(name) {
if (!name)
throw new Error("name cannot be null.");
this.name = name;
}
/** Adds an attachment to the skin for the specified slot index and name. */
setAttachment(slotIndex, name, attachment) {
if (!attachment)
throw new Error("attachment cannot be null.");
let attachments = this.attachments;
if (slotIndex >= attachments.length)
attachments.length = slotIndex + 1;
if (!attachments[slotIndex])
attachments[slotIndex] = {};
attachments[slotIndex][name] = attachment;
}
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
addSkin(skin) {
for (let i = 0; i < skin.bones.length; i++) {
let bone = skin.bones[i];
let contained = false;
for (let ii = 0; ii < this.bones.length; ii++) {
if (this.bones[ii] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (let i = 0; i < skin.constraints.length; i++) {
let constraint = skin.constraints[i];
let contained = false;
for (let ii = 0; ii < this.constraints.length; ii++) {
if (this.constraints[ii] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
let attachments = skin.getAttachments();
for (let i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
}
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
copySkin(skin) {
for (let i = 0; i < skin.bones.length; i++) {
let bone = skin.bones[i];
let contained = false;
for (let ii = 0; ii < this.bones.length; ii++) {
if (this.bones[ii] == bone) {
contained = true;
break;
}
}
if (!contained)
this.bones.push(bone);
}
for (let i = 0; i < skin.constraints.length; i++) {
let constraint = skin.constraints[i];
let contained = false;
for (let ii = 0; ii < this.constraints.length; ii++) {
if (this.constraints[ii] == constraint) {
contained = true;
break;
}
}
if (!contained)
this.constraints.push(constraint);
}
let attachments = skin.getAttachments();
for (let i = 0; i < attachments.length; i++) {
var attachment = attachments[i];
if (!attachment.attachment)
continue;
if (attachment.attachment instanceof MeshAttachment) {
attachment.attachment = attachment.attachment.newLinkedMesh();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
else {
attachment.attachment = attachment.attachment.copy();
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
}
}
}
/** Returns the attachment for the specified slot index and name, or null. */
getAttachment(slotIndex, name) {
let dictionary = this.attachments[slotIndex];
return dictionary ? dictionary[name] : null;
}
/** Removes the attachment in the skin for the specified slot index and name, if any. */
removeAttachment(slotIndex, name) {
let dictionary = this.attachments[slotIndex];
if (dictionary)
delete dictionary[name];
}
/** Returns all attachments in this skin. */
getAttachments() {
let entries = new Array();
for (var i = 0; i < this.attachments.length; i++) {
let slotAttachments = this.attachments[i];
if (slotAttachments) {
for (let name in slotAttachments) {
let attachment = slotAttachments[name];
if (attachment)
entries.push(new SkinEntry(i, name, attachment));
}
}
}
return entries;
}
/** Returns all attachments in this skin for the specified slot index. */
getAttachmentsForSlot(slotIndex, attachments) {
let slotAttachments = this.attachments[slotIndex];
if (slotAttachments) {
for (let name in slotAttachments) {
let attachment = slotAttachments[name];
if (attachment)
attachments.push(new SkinEntry(slotIndex, name, attachment));
}
}
}
/** Clears all attachments, bones, and constraints. */
clear() {
this.attachments.length = 0;
this.bones.length = 0;
this.constraints.length = 0;
}
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
attachAll(skeleton, oldSkin) {
let slotIndex = 0;
for (let i = 0; i < skeleton.slots.length; i++) {
let slot = skeleton.slots[i];
let slotAttachment = slot.getAttachment();
if (slotAttachment && slotIndex < oldSkin.attachments.length) {
let dictionary = oldSkin.attachments[slotIndex];
for (let key in dictionary) {
let skinAttachment = dictionary[key];
if (slotAttachment == skinAttachment) {
let attachment = this.getAttachment(slotIndex, key);
if (attachment)
slot.setAttachment(attachment);
break;
}
}
}
slotIndex++;
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2tpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Ta2luLnRzIl0sIm5hbWVzIjpbXSwibWFwc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DLE1BQU0sRUFBRSxFQUFFLEVBQUUsRUFBRSxDQUFDO2dCQUNyRCxJQUFJLElBQUksQ0FBQyxXQUFXLENBQUMsRUFBRSxDQUFDLElBQUksVUFBVSxFQUFFLENBQUM7b0JBQ3hDLFNBQVMsR0FBRyxJQUFJLENBQUM7b0JBQ2pCLE1BQU07Z0JBQ1AsQ0FBQztZQUNGLENBQUM7WUFDRCxJQUFJLENBQUMsU0FBUztnQkFBRSxJQUFJLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUNuRCxDQUFDO1FBRUQsSUFBSSxXQUFXLEdBQUcsSUFBSSxDQUFDLGNBQWMsRUFBRSxDQUFDO1FBQ3hDLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxXQUFXLENBQUMsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDN0MsSUFBSSxVQUFVLEdBQUcsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ2hDLElBQUksQ0FBQyxVQUFVLENBQUMsVUFBVTtnQkFBRSxTQUFTO1lBQ3JDLElBQUksVUFBVSxDQUFDLFVBQ Line truncated
+69
View File
@@ -0,0 +1,69 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Attachment } from "./attachments/Attachment.js";
import { Bone } from "./Bone.js";
import { Skeleton } from "./Skeleton.js";
import { SlotData } from "./SlotData.js";
import { Color } from "./Utils.js";
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store
* state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared
* across multiple skeletons. */
export declare class Slot {
/** The slot's setup pose data. */
data: SlotData;
/** The bone this slot belongs to. */
bone: Bone;
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
* color tinting. */
color: Color;
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
darkColor: Color | null;
attachment: Attachment | null;
attachmentState: number;
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
* {@link Sequence#getSetupIndex()}. */
sequenceIndex: number;
/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
* weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
*
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
deform: number[];
constructor(data: SlotData, bone: Bone);
/** The skeleton this slot belongs to. */
getSkeleton(): Skeleton;
/** The current attachment for the slot, or null if the slot has no attachment. */
getAttachment(): Attachment | null;
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
* specified attachment. */
setAttachment(attachment: Attachment | null): void;
/** Sets this slot to the setup pose. */
setToSetupPose(): void;
}
+100
View File
@@ -0,0 +1,100 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { VertexAttachment } from "./attachments/Attachment.js";
import { Color } from "./Utils.js";
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store
* state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared
* across multiple skeletons. */
export class Slot {
/** The slot's setup pose data. */
data;
/** The bone this slot belongs to. */
bone;
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
* color tinting. */
color;
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
darkColor = null;
attachment = null;
attachmentState = 0;
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
* {@link Sequence#getSetupIndex()}. */
sequenceIndex = -1;
/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
* weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
*
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
deform = new Array();
constructor(data, bone) {
if (!data)
throw new Error("data cannot be null.");
if (!bone)
throw new Error("bone cannot be null.");
this.data = data;
this.bone = bone;
this.color = new Color();
this.darkColor = !data.darkColor ? null : new Color();
this.setToSetupPose();
}
/** The skeleton this slot belongs to. */
getSkeleton() {
return this.bone.skeleton;
}
/** The current attachment for the slot, or null if the slot has no attachment. */
getAttachment() {
return this.attachment;
}
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
* specified attachment. */
setAttachment(attachment) {
if (this.attachment == attachment)
return;
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment)
|| attachment.timelineAttachment != this.attachment.timelineAttachment) {
this.deform.length = 0;
}
this.attachment = attachment;
this.sequenceIndex = -1;
}
/** Sets this slot to the setup pose. */
setToSetupPose() {
this.color.setFromColor(this.data.color);
if (this.darkColor)
this.darkColor.setFromColor(this.data.darkColor);
if (!this.data.attachmentName)
this.attachment = null;
else {
this.attachment = null;
this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName));
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2xvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9TbG90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUUvRSxPQUFPLEVBQWMsZ0JBQWdCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUkzRSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRW5DOztnQ0FFZ0M7QUFDaEMsTUFBTSxPQUFPLElBQUk7SUFDaEIsa0NBQWtDO0lBQ2xDLElBQUksQ0FBVztJQUVmLHFDQUFxQztJQUNyQyxJQUFJLENBQU87SUFFWDt3QkFDb0I7SUFDcEIsS0FBSyxDQUFRO0lBRWI7b0NBQ2dDO0lBQ2hDLFNBQVMsR0FBaUIsSUFBSSxDQUFDO0lBRS9CLFVBQVUsR0FBc0IsSUFBSSxDQUFDO0lBRXJDLGVBQWUsR0FBVyxDQUFDLENBQUM7SUFFNUI7MkNBQ3VDO0lBQ3ZDLGFBQWEsR0FBVyxDQUFDLENBQUMsQ0FBQztJQUUzQjs7O3lGQUdxRjtJQUNyRixNQUFNLEdBQUcsSUFBSSxLQUFLLEVBQVUsQ0FBQztJQUU3QixZQUFhLElBQWMsRUFBRSxJQUFVO1FBQ3RDLElBQUksQ0FBQyxJQUFJO1lBQUUsTUFBTSxJQUFJLEtBQUssQ0FBQyxzQkFBc0IsQ0FBQyxDQUFDO1FBQ25ELElBQUksQ0FBQy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SVRZIEFORCBGSVRORVNTIEZPUiBBIFBBUlRJQ1VMQVIgUFVSUE9TRSBBUkVcbiAqIERJU0NMQUlNRUQuIElOIE5PIEVWRU5UIFNIQUxMIEVTT1RFUklDIFNPRlRXQVJFIExMQyBCRSBMSUFCTEUgRk9SIEFOWVxuICogRElSRUNULCBJTkRJUkVDVCwgSU5DSURFTlRBTCwgU1BFQ0lBTCwgRVhFTVBMQVJZLCBPUiBDT05TRVFVRU5USUFMIERBTUFHRVNcbiAqIChJTkNMVURJTkcsIEJVVCBOT1QgTElNSVRFRCBUTywgUFJPQ1VSRU1FTlQgT0YgU1VCU1RJVFVURSBHT09EUyBPUiBTRVJWSUNFUyxcbiAqIEJVU0lORVNTIElOVEVSUlVQVElPTiwgT1IgTE9TUyBPRiBVU0UsIERBVEEsIE9SIFBST0ZJVFMpIEhPV0VWRVIgQ0FVU0VEIEFORFxuICogT04gQU5ZIFRIRU9SWSBPRiBMSUFCSUxJVFksIFdIRVRIRVIgSU4gQ09OVFJBQ1QsIFNUUklDVCBMSUFCSUxJVFksIE9SIFRPUlRcbiAqIChJTkNMVURJTkcgTkVHTElHRU5DRSBPUiBPVEhFUldJU0UpIEFSSVNJTkcgSU4gQU5ZIFdBWSBPVVQgT0YgVEhFIFVTRSBPRlxuICogVEhFIFNQSU5FIFJVTlRJTUVTLCBFVkVOIElGIEFEVklTRUQgT0YgVEhFIFBPU1NJQklMSVRZIE9GIFNVQ0ggREFNQUdFLlxuICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuXG5pbXBvcnQgeyBBdHRhY2htZW50L Line truncated
+59
View File
@@ -0,0 +1,59 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { BoneData } from "./BoneData.js";
import { Color } from "./Utils.js";
/** Stores the setup pose for a {@link Slot}. */
export declare class SlotData {
/** The index of the slot in {@link Skeleton#getSlots()}. */
index: number;
/** The name of the slot, which is unique across all slots in the skeleton. */
name: string;
/** The bone this slot belongs to. */
boneData: BoneData;
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
* color tinting. */
color: Color;
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
darkColor: Color | null;
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
attachmentName: string | null;
/** The blend mode for drawing the slot's attachment. */
blendMode: BlendMode;
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
visible: boolean;
constructor(index: number, name: string, boneData: BoneData);
}
/** Determines how images are blended with existing pixels when drawn. */
export declare enum BlendMode {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3
}
+70
View File
@@ -0,0 +1,70 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "./Utils.js";
/** Stores the setup pose for a {@link Slot}. */
export class SlotData {
/** The index of the slot in {@link Skeleton#getSlots()}. */
index = 0;
/** The name of the slot, which is unique across all slots in the skeleton. */
name;
/** The bone this slot belongs to. */
boneData;
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
* color tinting. */
color = new Color(1, 1, 1, 1);
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */
darkColor = null;
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
attachmentName = null;
/** The blend mode for drawing the slot's attachment. */
blendMode = BlendMode.Normal;
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
visible = true;
constructor(index, name, boneData) {
if (index < 0)
throw new Error("index must be >= 0.");
if (!name)
throw new Error("name cannot be null.");
if (!boneData)
throw new Error("boneData cannot be null.");
this.index = index;
this.name = name;
this.boneData = boneData;
}
}
/** Determines how images are blended with existing pixels when drawn. */
export var BlendMode;
(function (BlendMode) {
BlendMode[BlendMode["Normal"] = 0] = "Normal";
BlendMode[BlendMode["Additive"] = 1] = "Additive";
BlendMode[BlendMode["Multiply"] = 2] = "Multiply";
BlendMode[BlendMode["Screen"] = 3] = "Screen";
})(BlendMode || (BlendMode = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2xvdERhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvU2xvdERhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRy9FLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFbkMsZ0RBQWdEO0FBQ2hELE1BQU0sT0FBTyxRQUFRO0lBQ3BCLDREQUE0RDtJQUM1RCxLQUFLLEdBQVcsQ0FBQyxDQUFDO0l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d28gY29sb3IgdGludGluZywgb3IgbnVsbCBpZiB0d28gY29sb3IgdGludGluZyBpcyBub3QgdXNlZC4gVGhlIGRhcmtcblx0ICogY29sb3IncyBhbHBoYSBpcyBub3QgdXNlZC4gKi9cblx0ZGFya0NvbG9yOiBDb2xvciB8IG51bGwgPSBudWxsO1xuXG5cdC8qKiBUaGUgbmFtZSBvZiB0aGUgYXR0YWNobWVudCB0aGF0IGlzIHZpc2libGUgZm9yIHRoaXMgc2xvdCBpb Line truncated
+69
View File
@@ -0,0 +1,69 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export declare abstract class Texture {
protected _image: HTMLImageElement | ImageBitmap | any;
constructor(image: HTMLImageElement | ImageBitmap | any);
getImage(): HTMLImageElement | ImageBitmap | any;
abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
abstract dispose(): void;
}
export declare enum TextureFilter {
Nearest = 9728,// WebGLRenderingContext.NEAREST
Linear = 9729,// WebGLRenderingContext.LINEAR
MipMap = 9987,// WebGLRenderingContext.LINEAR_MIPMAP_LINEAR
MipMapNearestNearest = 9984,// WebGLRenderingContext.NEAREST_MIPMAP_NEAREST
MipMapLinearNearest = 9985,// WebGLRenderingContext.LINEAR_MIPMAP_NEAREST
MipMapNearestLinear = 9986,// WebGLRenderingContext.NEAREST_MIPMAP_LINEAR
MipMapLinearLinear = 9987
}
export declare enum TextureWrap {
MirroredRepeat = 33648,// WebGLRenderingContext.MIRRORED_REPEAT
ClampToEdge = 33071,// WebGLRenderingContext.CLAMP_TO_EDGE
Repeat = 10497
}
export declare class TextureRegion {
texture: any;
u: number;
v: number;
u2: number;
v2: number;
width: number;
height: number;
degrees: number;
offsetX: number;
offsetY: number;
originalWidth: number;
originalHeight: number;
}
export declare class FakeTexture extends Texture {
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
dispose(): void;
}
+73
View File
@@ -0,0 +1,73 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export class Texture {
_image;
constructor(image) {
this._image = image;
}
getImage() {
return this._image;
}
}
export var TextureFilter;
(function (TextureFilter) {
TextureFilter[TextureFilter["Nearest"] = 9728] = "Nearest";
TextureFilter[TextureFilter["Linear"] = 9729] = "Linear";
TextureFilter[TextureFilter["MipMap"] = 9987] = "MipMap";
TextureFilter[TextureFilter["MipMapNearestNearest"] = 9984] = "MipMapNearestNearest";
TextureFilter[TextureFilter["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
TextureFilter[TextureFilter["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
TextureFilter[TextureFilter["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear"; // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR
})(TextureFilter || (TextureFilter = {}));
export var TextureWrap;
(function (TextureWrap) {
TextureWrap[TextureWrap["MirroredRepeat"] = 33648] = "MirroredRepeat";
TextureWrap[TextureWrap["ClampToEdge"] = 33071] = "ClampToEdge";
TextureWrap[TextureWrap["Repeat"] = 10497] = "Repeat"; // WebGLRenderingContext.REPEAT
})(TextureWrap || (TextureWrap = {}));
export class TextureRegion {
texture;
u = 0;
v = 0;
u2 = 0;
v2 = 0;
width = 0;
height = 0;
degrees = 0;
offsetX = 0;
offsetY = 0;
originalWidth = 0;
originalHeight = 0;
}
export class FakeTexture extends Texture {
setFilters(minFilter, magFilter) { }
setWraps(uWrap, vWrap) { }
dispose() { }
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVGV4dHVyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9UZXh0dXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUUvRSxNQUFNLE9BQWdCLE9BQU87SUFDbEIsTUFBTSxDQUF1QztJQUV2RCxZQUFhLEtBQTJDO1FBQ3ZELElBQUksQ0FBQyxNQUFNLEdBQUcsS0FBSyxDQUFDO0lBQ3JCLENBQUM7SUFFRCxRQUFRO1FBQ1AsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDO0lBQ3BCLENBQUM7Q0FLRDtBQUVELE1BQU0sQ0FBTixJQUFZLGFBUVg7QUFSRCxXQUFZLGFBQWE7SUFDeEIsMERBQWMsQ0FBQTtJQUNkLHdEQUFhLENBQUE7SUFDYix3REFBYSxDQUFBO0lBQ2Isb0ZBQTJCLENBQUE7SUFDM0Isa0ZBQTBCLENBQUE7SUFDMUIsa0ZBQTBCLENBQUE7SUFDMUIsZ0ZBQXlCLENBQUEsQ0FBQyw2Q0FBNkM7QUFDeEUsQ0FBQyxFQVJXLGFBQWEsS0FBYixhQ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gO Line truncated
+68
View File
@@ -0,0 +1,68 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { AssetManagerBase } from "./AssetManagerBase.js";
import { TextureFilter, TextureWrap, Texture, TextureRegion } from "./Texture.js";
import { Disposable } from "./Utils.js";
export declare class TextureAtlas implements Disposable {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string);
findRegion(name: string): TextureAtlasRegion | null;
setTextures(assetManager: AssetManagerBase, pathPrefix?: string): void;
dispose(): void;
}
export declare class TextureAtlasPage {
name: string;
minFilter: TextureFilter;
magFilter: TextureFilter;
uWrap: TextureWrap;
vWrap: TextureWrap;
texture: Texture | null;
width: number;
height: number;
pma: boolean;
regions: TextureAtlasRegion[];
constructor(name: string);
setTexture(texture: Texture): void;
}
export declare class TextureAtlasRegion extends TextureRegion {
page: TextureAtlasPage;
name: string;
x: number;
y: number;
offsetX: number;
offsetY: number;
originalWidth: number;
originalHeight: number;
index: number;
degrees: number;
names: string[] | null;
values: number[][] | null;
constructor(page: TextureAtlasPage, name: string);
}
+270
View File
@@ -0,0 +1,270 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureFilter, TextureWrap, TextureRegion } from "./Texture.js";
import { Utils } from "./Utils.js";
export class TextureAtlas {
pages = new Array();
regions = new Array();
constructor(atlasText) {
let reader = new TextureAtlasReader(atlasText);
let entry = new Array(4);
let pageFields = {};
pageFields["size"] = (page) => {
page.width = parseInt(entry[1]);
page.height = parseInt(entry[2]);
};
pageFields["format"] = () => {
// page.format = Format[tuple[0]]; we don't need format in WebGL
};
pageFields["filter"] = (page) => {
page.minFilter = Utils.enumValue(TextureFilter, entry[1]);
page.magFilter = Utils.enumValue(TextureFilter, entry[2]);
};
pageFields["repeat"] = (page) => {
if (entry[1].indexOf('x') != -1)
page.uWrap = TextureWrap.Repeat;
if (entry[1].indexOf('y') != -1)
page.vWrap = TextureWrap.Repeat;
};
pageFields["pma"] = (page) => {
page.pma = entry[1] == "true";
};
var regionFields = {};
regionFields["xy"] = (region) => {
region.x = parseInt(entry[1]);
region.y = parseInt(entry[2]);
};
regionFields["size"] = (region) => {
region.width = parseInt(entry[1]);
region.height = parseInt(entry[2]);
};
regionFields["bounds"] = (region) => {
region.x = parseInt(entry[1]);
region.y = parseInt(entry[2]);
region.width = parseInt(entry[3]);
region.height = parseInt(entry[4]);
};
regionFields["offset"] = (region) => {
region.offsetX = parseInt(entry[1]);
region.offsetY = parseInt(entry[2]);
};
regionFields["orig"] = (region) => {
region.originalWidth = parseInt(entry[1]);
region.originalHeight = parseInt(entry[2]);
};
regionFields["offsets"] = (region) => {
region.offsetX = parseInt(entry[1]);
region.offsetY = parseInt(entry[2]);
region.originalWidth = parseInt(entry[3]);
region.originalHeight = parseInt(entry[4]);
};
regionFields["rotate"] = (region) => {
let value = entry[1];
if (value == "true")
region.degrees = 90;
else if (value != "false")
region.degrees = parseInt(value);
};
regionFields["index"] = (region) => {
region.index = parseInt(entry[1]);
};
let line = reader.readLine();
// Ignore empty lines before first entry.
while (line && line.trim().length == 0)
line = reader.readLine();
// Header entries.
while (true) {
if (!line || line.trim().length == 0)
break;
if (reader.readEntry(entry, line) == 0)
break; // Silently ignore all header fields.
line = reader.readLine();
}
// Page and region entries.
let page = null;
let names = null;
let values = null;
while (true) {
if (line === null)
break;
if (line.trim().length == 0) {
page = null;
line = reader.readLine();
}
else if (!page) {
page = new TextureAtlasPage(line.trim());
while (true) {
if (reader.readEntry(entry, line = reader.readLine()) == 0)
break;
let field = pageFields[entry[0]];
if (field)
field(page);
}
this.pages.push(page);
}
else {
let region = new TextureAtlasRegion(page, line);
while (true) {
let count = reader.readEntry(entry, line = reader.readLine());
if (count == 0)
break;
let field = regionFields[entry[0]];
if (field)
field(region);
else {
if (!names)
names = [];
if (!values)
values = [];
names.push(entry[0]);
let entryValues = [];
for (let i = 0; i < count; i++)
entryValues.push(parseInt(entry[i + 1]));
values.push(entryValues);
}
}
if (region.originalWidth == 0 && region.originalHeight == 0) {
region.originalWidth = region.width;
region.originalHeight = region.height;
}
if (names && names.length > 0 && values && values.length > 0) {
region.names = names;
region.values = values;
names = null;
values = null;
}
region.u = region.x / page.width;
region.v = region.y / page.height;
if (region.degrees == 90) {
region.u2 = (region.x + region.height) / page.width;
region.v2 = (region.y + region.width) / page.height;
}
else {
region.u2 = (region.x + region.width) / page.width;
region.v2 = (region.y + region.height) / page.height;
}
this.regions.push(region);
}
}
}
findRegion(name) {
for (let i = 0; i < this.regions.length; i++) {
if (this.regions[i].name == name) {
return this.regions[i];
}
}
return null;
}
setTextures(assetManager, pathPrefix = "") {
for (let page of this.pages)
page.setTexture(assetManager.get(pathPrefix + page.name));
}
dispose() {
for (let i = 0; i < this.pages.length; i++) {
this.pages[i].texture?.dispose();
}
}
}
class TextureAtlasReader {
lines;
index = 0;
constructor(text) {
this.lines = text.split(/\r\n|\r|\n/);
}
readLine() {
if (this.index >= this.lines.length)
return null;
return this.lines[this.index++];
}
readEntry(entry, line) {
if (!line)
return 0;
line = line.trim();
if (line.length == 0)
return 0;
let colon = line.indexOf(':');
if (colon == -1)
return 0;
entry[0] = line.substr(0, colon).trim();
for (let i = 1, lastMatch = colon + 1;; i++) {
let comma = line.indexOf(',', lastMatch);
if (comma == -1) {
entry[i] = line.substr(lastMatch).trim();
return i;
}
entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
lastMatch = comma + 1;
if (i == 4)
return 4;
}
}
}
export class TextureAtlasPage {
name;
minFilter = TextureFilter.Nearest;
magFilter = TextureFilter.Nearest;
uWrap = TextureWrap.ClampToEdge;
vWrap = TextureWrap.ClampToEdge;
texture = null;
width = 0;
height = 0;
pma = false;
regions = new Array();
constructor(name) {
this.name = name;
}
setTexture(texture) {
this.texture = texture;
texture.setFilters(this.minFilter, this.magFilter);
texture.setWraps(this.uWrap, this.vWrap);
for (let region of this.regions)
region.texture = texture;
}
}
export class TextureAtlasRegion extends TextureRegion {
page;
name;
x = 0;
y = 0;
offsetX = 0;
offsetY = 0;
originalWidth = 0;
originalHeight = 0;
index = 0;
degrees = 0;
names = null;
values = null;
constructor(page, name) {
super();
this.page = page;
this.name = name;
page.regions.push(this);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVGV4dHVyZUF0bGFzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1RleHR1cmVBdGxhcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFHL0UsT0FBTyxFQUFFLGFBQWEsRUFBRSxXQUFXLEVBQVcsYUFBYSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ2xGLE9BQU8sRUFBYyxLQUFLLEVBQWEsTUFBTSxZQUFZLENBQUM7QUFFMUQsT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QXlDO1FBQ3pDLE9BQU8sSUFBSSxJQUFJLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQyxNQUFNLElBQUksQ0FBQztZQUNyQyxJQUFJLEdBQUcsTUFBTSxDQUFDLFFBQVEsRUFBRSxDQUFDO1FBQzFCLGtCQUFrQjtRQUNsQixPQUFPLElBQUksRUFBRSxDQUFDO1lBQ2IsSUFBSSxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUMsTUFBTSxJQUFJLENBQUM7Z0JBQUUsTUFBTTtZQUM1QyxJQUFJLE1BQU0sQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLElBQUksQ0FBQyxJQUFJLENBQUM7Z0JBQUUsTUFBTSxDQUFDLHFDQUFxQztZQUNwRixJQUFJLEdBQUcsTUFBTSxDQUFDLFFBQVEsRUFBR Line truncated
@@ -0,0 +1,61 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Bone } from "./Bone.js";
import { Physics, Skeleton } from "./Skeleton.js";
import { TransformConstraintData } from "./TransformConstraintData.js";
import { Updatable } from "./Updatable.js";
import { Vector2 } from "./Utils.js";
/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained
* bones to match that of the target bone.
*
* See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */
export declare class TransformConstraint implements Updatable {
/** The transform constraint's setup pose data. */
data: TransformConstraintData;
/** The bones that will be modified by this transform constraint. */
bones: Array<Bone>;
/** The target bone whose world transform will be copied to the constrained bones. */
target: Bone;
mixRotate: number;
mixX: number;
mixY: number;
mixScaleX: number;
mixScaleY: number;
mixShearY: number;
temp: Vector2;
active: boolean;
constructor(data: TransformConstraintData, skeleton: Skeleton);
isActive(): boolean;
setToSetupPose(): void;
update(physics: Physics): void;
applyAbsoluteWorld(): void;
applyRelativeWorld(): void;
applyAbsoluteLocal(): void;
applyRelativeLocal(): void;
}
+256
View File
@@ -0,0 +1,256 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Vector2, MathUtils } from "./Utils.js";
/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained
* bones to match that of the target bone.
*
* See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */
export class TransformConstraint {
/** The transform constraint's setup pose data. */
data;
/** The bones that will be modified by this transform constraint. */
bones;
/** The target bone whose world transform will be copied to the constrained bones. */
target;
mixRotate = 0;
mixX = 0;
mixY = 0;
mixScaleX = 0;
mixScaleY = 0;
mixShearY = 0;
temp = new Vector2();
active = false;
constructor(data, skeleton) {
if (!data)
throw new Error("data cannot be null.");
if (!skeleton)
throw new Error("skeleton cannot be null.");
this.data = data;
this.bones = new Array();
for (let i = 0; i < data.bones.length; i++) {
let bone = skeleton.findBone(data.bones[i].name);
if (!bone)
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
this.bones.push(bone);
}
let target = skeleton.findBone(data.target.name);
if (!target)
throw new Error(`Couldn't find target bone ${data.target.name}.`);
this.target = target;
this.mixRotate = data.mixRotate;
this.mixX = data.mixX;
this.mixY = data.mixY;
this.mixScaleX = data.mixScaleX;
this.mixScaleY = data.mixScaleY;
this.mixShearY = data.mixShearY;
}
isActive() {
return this.active;
}
setToSetupPose() {
const data = this.data;
this.mixRotate = data.mixRotate;
this.mixX = data.mixX;
this.mixY = data.mixY;
this.mixScaleX = data.mixScaleX;
this.mixScaleY = data.mixScaleY;
this.mixShearY = data.mixShearY;
}
update(physics) {
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
return;
if (this.data.local) {
if (this.data.relative)
this.applyRelativeLocal();
else
this.applyAbsoluteLocal();
}
else {
if (this.data.relative)
this.applyRelativeWorld();
else
this.applyAbsoluteWorld();
}
}
applyAbsoluteWorld() {
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY, mixScaleX = this.mixScaleX, mixScaleY = this.mixScaleY, mixShearY = this.mixShearY;
let translate = mixX != 0 || mixY != 0;
let target = this.target;
let ta = target.a, tb = target.b, tc = target.c, td = target.d;
let degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;
let offsetRotation = this.data.offsetRotation * degRadReflect;
let offsetShearY = this.data.offsetShearY * degRadReflect;
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (mixRotate != 0) {
let a = bone.a, b = bone.b, c = bone.c, d = bone.d;
let r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation;
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
r += MathUtils.PI2;
r *= mixRotate;
let cos = Math.cos(r), sin = Math.sin(r);
bone.a = cos * a - sin * c;
bone.b = cos * b - sin * d;
bone.c = sin * a + cos * c;
bone.d = sin * b + cos * d;
}
if (translate) {
let temp = this.temp;
target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));
bone.worldX += (temp.x - bone.worldX) * mixX;
bone.worldY += (temp.y - bone.worldY) * mixY;
}
if (mixScaleX != 0) {
let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
if (s != 0)
s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
bone.a *= s;
bone.c *= s;
}
if (mixScaleY != 0) {
let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
if (s != 0)
s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
bone.b *= s;
bone.d *= s;
}
if (mixShearY > 0) {
let b = bone.b, d = bone.d;
let by = Math.atan2(d, b);
let r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a));
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
r += MathUtils.PI2;
r = by + (r + offsetShearY) * mixShearY;
let s = Math.sqrt(b * b + d * d);
bone.b = Math.cos(r) * s;
bone.d = Math.sin(r) * s;
}
bone.updateAppliedTransform();
}
}
applyRelativeWorld() {
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY, mixScaleX = this.mixScaleX, mixScaleY = this.mixScaleY, mixShearY = this.mixShearY;
let translate = mixX != 0 || mixY != 0;
let target = this.target;
let ta = target.a, tb = target.b, tc = target.c, td = target.d;
let degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad;
let offsetRotation = this.data.offsetRotation * degRadReflect, offsetShearY = this.data.offsetShearY * degRadReflect;
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
if (mixRotate != 0) {
let a = bone.a, b = bone.b, c = bone.c, d = bone.d;
let r = Math.atan2(tc, ta) + offsetRotation;
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
r += MathUtils.PI2;
r *= mixRotate;
let cos = Math.cos(r), sin = Math.sin(r);
bone.a = cos * a - sin * c;
bone.b = cos * b - sin * d;
bone.c = sin * a + cos * c;
bone.d = sin * b + cos * d;
}
if (translate) {
let temp = this.temp;
target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY));
bone.worldX += temp.x * mixX;
bone.worldY += temp.y * mixY;
}
if (mixScaleX != 0) {
let s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * mixScaleX + 1;
bone.a *= s;
bone.c *= s;
}
if (mixScaleY != 0) {
let s = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * mixScaleY + 1;
bone.b *= s;
bone.d *= s;
}
if (mixShearY > 0) {
let r = Math.atan2(td, tb) - Math.atan2(tc, ta);
if (r > MathUtils.PI)
r -= MathUtils.PI2;
else if (r < -MathUtils.PI) //
r += MathUtils.PI2;
let b = bone.b, d = bone.d;
r = Math.atan2(d, b) + (r - MathUtils.PI / 2 + offsetShearY) * mixShearY;
let s = Math.sqrt(b * b + d * d);
bone.b = Math.cos(r) * s;
bone.d = Math.sin(r) * s;
}
bone.updateAppliedTransform();
}
}
applyAbsoluteLocal() {
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY, mixScaleX = this.mixScaleX, mixScaleY = this.mixScaleY, mixShearY = this.mixShearY;
let target = this.target;
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
let rotation = bone.arotation;
if (mixRotate != 0)
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
let x = bone.ax, y = bone.ay;
x += (target.ax - x + this.data.offsetX) * mixX;
y += (target.ay - y + this.data.offsetY) * mixY;
let scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (mixScaleX != 0 && scaleX != 0)
scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * mixScaleX) / scaleX;
if (mixScaleY != 0 && scaleY != 0)
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
let shearY = bone.ashearY;
if (mixShearY != 0)
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}
}
applyRelativeLocal() {
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY, mixScaleX = this.mixScaleX, mixScaleY = this.mixScaleY, mixShearY = this.mixShearY;
let target = this.target;
let bones = this.bones;
for (let i = 0, n = bones.length; i < n; i++) {
let bone = bones[i];
let rotation = bone.arotation + (target.arotation + this.data.offsetRotation) * mixRotate;
let x = bone.ax + (target.ax + this.data.offsetX) * mixX;
let y = bone.ay + (target.ay + this.data.offsetY) * mixY;
let scaleX = bone.ascaleX * (((target.ascaleX - 1 + this.data.offsetScaleX) * mixScaleX) + 1);
let scaleY = bone.ascaleY * (((target.ascaleY - 1 + this.data.offsetScaleY) * mixScaleY) + 1);
let shearY = bone.ashearY + (target.ashearY + this.data.offsetShearY) * mixShearY;
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
}
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNmb3JtQ29uc3RyYWludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9UcmFuc2Zvcm1Db25zdHJhaW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQU0vRSxPQUFPLEVBQUUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUdoRDs7O21IQUdtSDtBQUNuSCxNQUFNLE9BQU8sbUJBQW1CO0lBRS9CLGtEQUFrRDtJQUNsRCxJQUFJLENBQTBCO0lBRTlCLG9FQUFvRTtJQUNwRSxLQUFLLENBQWM7SUFFbkIscUZ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xJQUFJLENBQUMsQ0FBQyxFQUFFLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQyxFQUFFLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQyxFQUFFLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQyxDQUFDO2dCQUNuRCxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsR0FBRyxjQ Line truncated
@@ -0,0 +1,62 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ConstraintData } from "./ConstraintData.js";
import { BoneData } from "./BoneData.js";
/** Stores the setup pose for a {@link TransformConstraint}.
*
* See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */
export declare class TransformConstraintData extends ConstraintData {
/** The bones that will be modified by this transform constraint. */
bones: BoneData[];
/** The target bone whose world transform will be copied to the constrained bones. */
private _target;
set target(boneData: BoneData);
get target(): BoneData;
mixRotate: number;
mixX: number;
mixY: number;
mixScaleX: number;
mixScaleY: number;
mixShearY: number;
/** An offset added to the constrained bone rotation. */
offsetRotation: number;
/** An offset added to the constrained bone X translation. */
offsetX: number;
/** An offset added to the constrained bone Y translation. */
offsetY: number;
/** An offset added to the constrained bone scaleX. */
offsetScaleX: number;
/** An offset added to the constrained bone scaleY. */
offsetScaleY: number;
/** An offset added to the constrained bone shearY. */
offsetShearY: number;
relative: boolean;
local: boolean;
constructor(name: string);
}
@@ -0,0 +1,69 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { ConstraintData } from "./ConstraintData.js";
/** Stores the setup pose for a {@link TransformConstraint}.
*
* See [Transform constraints](http://esotericsoftware.com/spine-transform-constraints) in the Spine User Guide. */
export class TransformConstraintData extends ConstraintData {
/** The bones that will be modified by this transform constraint. */
bones = new Array();
/** The target bone whose world transform will be copied to the constrained bones. */
_target = null;
set target(boneData) { this._target = boneData; }
get target() {
if (!this._target)
throw new Error("BoneData not set.");
else
return this._target;
}
mixRotate = 0;
mixX = 0;
mixY = 0;
mixScaleX = 0;
mixScaleY = 0;
mixShearY = 0;
/** An offset added to the constrained bone rotation. */
offsetRotation = 0;
/** An offset added to the constrained bone X translation. */
offsetX = 0;
/** An offset added to the constrained bone Y translation. */
offsetY = 0;
/** An offset added to the constrained bone scaleX. */
offsetScaleX = 0;
/** An offset added to the constrained bone scaleY. */
offsetScaleY = 0;
/** An offset added to the constrained bone shearY. */
offsetShearY = 0;
relative = false;
local = false;
constructor(name) {
super(name, 0, false);
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNmb3JtQ29uc3RyYWludERhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcm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XJnZXQgYm9uZSB3aG9zZSB3b3JsZCB0cmFuc2Zvcm0gd2lsbCBiZSBjb3BpZWQgdG8gdGhlIGNvbnN0cmFpbmVkIGJvbmVzLiAqL1xuXHRwcml2YXRlIF90YXJnZXQ6IEJvbmVEYXRhIHwgbnVsbCA9IG51bGw7XG5cdHB1YmxpYyBzZXQgdGFyZ2V0IChib25lRGF0YTogQm9uZURhdGEpIHsgdGhpcy5fdGFyZ2V0ID0gYm9uZURhdGE7IH1cblx0cHVibGljIGdldCB0YXJnZXQgKCkge1xuXHRcdGlmICghdGhpcy5fdGFyZ2V0KSB0aHJvdyBuZXcgRXJyb3IoXCJCb25lRGF0YSBub3Qgc2V0LlwiKVxuXHRcdGVsc2UgcmV0dXJuIHRoaXMuX3RhcmdldDtcblx0fVxuXG5cdG1peFJvdGF0ZSA9IDA7XG5cdG1peFggPSAwO1xuXHRtaXhZID0gMDtcblx0bWl4U2NhbGVYID0gMDtcblx0bWl4U2NhbGVZID0gMDtcblx0bWl4U2hlYXJZI Line truncated
+43
View File
@@ -0,0 +1,43 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { NumberArrayLike } from "./Utils.js";
export declare class Triangulator {
private convexPolygons;
private convexPolygonsIndices;
private indicesArray;
private isConcaveArray;
private triangles;
private polygonPool;
private polygonIndicesPool;
triangulate(verticesArray: NumberArrayLike): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave;
private static positiveArea;
private static winding;
}
+242
View File
@@ -0,0 +1,242 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Pool } from "./Utils.js";
export class Triangulator {
convexPolygons = new Array();
convexPolygonsIndices = new Array();
indicesArray = new Array();
isConcaveArray = new Array();
triangles = new Array();
polygonPool = new Pool(() => {
return new Array();
});
polygonIndicesPool = new Pool(() => {
return new Array();
});
triangulate(verticesArray) {
let vertices = verticesArray;
let vertexCount = verticesArray.length >> 1;
let indices = this.indicesArray;
indices.length = 0;
for (let i = 0; i < vertexCount; i++)
indices[i] = i;
let isConcave = this.isConcaveArray;
isConcave.length = 0;
for (let i = 0, n = vertexCount; i < n; ++i)
isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices);
let triangles = this.triangles;
triangles.length = 0;
while (vertexCount > 3) {
// Find ear tip.
let previous = vertexCount - 1, i = 0, next = 1;
while (true) {
outer: if (!isConcave[i]) {
let p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1;
let p1x = vertices[p1], p1y = vertices[p1 + 1];
let p2x = vertices[p2], p2y = vertices[p2 + 1];
let p3x = vertices[p3], p3y = vertices[p3 + 1];
for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
if (!isConcave[ii])
continue;
let v = indices[ii] << 1;
let vx = vertices[v], vy = vertices[v + 1];
if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy))
break outer;
}
}
}
break;
}
if (next == 0) {
do {
if (!isConcave[i])
break;
i--;
} while (i > 0);
break;
}
previous = i;
i = next;
next = (next + 1) % vertexCount;
}
// Cut ear tip.
triangles.push(indices[(vertexCount + i - 1) % vertexCount]);
triangles.push(indices[i]);
triangles.push(indices[(i + 1) % vertexCount]);
indices.splice(i, 1);
isConcave.splice(i, 1);
vertexCount--;
let previousIndex = (vertexCount + i - 1) % vertexCount;
let nextIndex = i == vertexCount ? 0 : i;
isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
}
if (vertexCount == 3) {
triangles.push(indices[2]);
triangles.push(indices[0]);
triangles.push(indices[1]);
}
return triangles;
}
decompose(verticesArray, triangles) {
let vertices = verticesArray;
let convexPolygons = this.convexPolygons;
this.polygonPool.freeAll(convexPolygons);
convexPolygons.length = 0;
let convexPolygonsIndices = this.convexPolygonsIndices;
this.polygonIndicesPool.freeAll(convexPolygonsIndices);
convexPolygonsIndices.length = 0;
let polygonIndices = this.polygonIndicesPool.obtain();
polygonIndices.length = 0;
let polygon = this.polygonPool.obtain();
polygon.length = 0;
// Merge subsequent triangles if they form a triangle fan.
let fanBaseIndex = -1, lastWinding = 0;
for (let i = 0, n = triangles.length; i < n; i += 3) {
let t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1;
let x1 = vertices[t1], y1 = vertices[t1 + 1];
let x2 = vertices[t2], y2 = vertices[t2 + 1];
let x3 = vertices[t3], y3 = vertices[t3 + 1];
// If the base of the last triangle is the same as this triangle, check if they form a convex polygon (triangle fan).
let merged = false;
if (fanBaseIndex == t1) {
let o = polygon.length - 4;
let winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
let winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
if (winding1 == lastWinding && winding2 == lastWinding) {
polygon.push(x3);
polygon.push(y3);
polygonIndices.push(t3);
merged = true;
}
}
// Otherwise make this triangle the new base.
if (!merged) {
if (polygon.length > 0) {
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
polygon.push(y1);
polygon.push(x2);
polygon.push(y2);
polygon.push(x3);
polygon.push(y3);
polygonIndices = this.polygonIndicesPool.obtain();
polygonIndices.length = 0;
polygonIndices.push(t1);
polygonIndices.push(t2);
polygonIndices.push(t3);
lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3);
fanBaseIndex = t1;
}
}
if (polygon.length > 0) {
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
// Go through the list of polygons and try to merge the remaining triangles with the found triangle fans.
for (let i = 0, n = convexPolygons.length; i < n; i++) {
polygonIndices = convexPolygonsIndices[i];
if (polygonIndices.length == 0)
continue;
let firstIndex = polygonIndices[0];
let lastIndex = polygonIndices[polygonIndices.length - 1];
polygon = convexPolygons[i];
let o = polygon.length - 4;
let prevPrevX = polygon[o], prevPrevY = polygon[o + 1];
let prevX = polygon[o + 2], prevY = polygon[o + 3];
let firstX = polygon[0], firstY = polygon[1];
let secondX = polygon[2], secondY = polygon[3];
let winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
for (let ii = 0; ii < n; ii++) {
if (ii == i)
continue;
let otherIndices = convexPolygonsIndices[ii];
if (otherIndices.length != 3)
continue;
let otherFirstIndex = otherIndices[0];
let otherSecondIndex = otherIndices[1];
let otherLastIndex = otherIndices[2];
let otherPoly = convexPolygons[ii];
let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
continue;
let winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
if (winding1 == winding && winding2 == winding) {
otherPoly.length = 0;
otherIndices.length = 0;
polygon.push(x3);
polygon.push(y3);
polygonIndices.push(otherLastIndex);
prevPrevX = prevX;
prevPrevY = prevY;
prevX = x3;
prevY = y3;
ii = 0;
}
}
}
// Remove empty polygons that resulted from the merge step above.
for (let i = convexPolygons.length - 1; i >= 0; i--) {
polygon = convexPolygons[i];
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;
}
static isConcave(index, vertexCount, vertices, indices) {
let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
let current = indices[index] << 1;
let next = indices[(index + 1) % vertexCount] << 1;
return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]);
}
static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
}
static winding(p1x, p1y, p2x, p2y, p3x, p3y) {
let px = p2x - p1x, py = p2y - p1y;
return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJpYW5ndWxhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1RyaWFuZ3VsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFFL0UsT0FBTyxFQUFtQixJQUFJLEV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3hELElBQUksU0FBUyxHQUFHLENBQUMsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3pDLFNBQVMsQ0FBQyxhQUFhLENBQUMsR0FBRyxZQUFZLENBQUMsU0FBUyxDQUFDLGFBQWEsRUFBRSxXQUFXLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2pHLFNBQVMsQ0FBQyxTQUFTLENBQUMsR0FBRyxZQUFZLENBQUMsU0FBUyxDQUFDLFNBQVMsRUFBRSxXQUFXLEVBQUUsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQzFGLENBQUM7UUFFRCxJQUFJLFdBQVcsSUFBSSxDQUFDLEVBQUUsQ0FBQztZQUN0QixTQUFTLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzNCLFNBQVMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQ Line truncated
+42
View File
@@ -0,0 +1,42 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Physics } from "./Skeleton.js";
/** The interface for items updated by {@link Skeleton#updateWorldTransform()}. */
export interface Updatable {
/** @param physics Determines how physics and other non-deterministic updates are applied. */
update(physics: Physics): void;
/** Returns false when this item won't be updated by
* {@link Skeleton#updateWorldTransform()} because a skin is required and the
* {@link Skeleton#getSkin() active skin} does not contain this item.
* @see Skin#getBones()
* @see Skin#getConstraints()
* @see BoneData#getSkinRequired()
* @see ConstraintData#getSkinRequired() */
isActive(): boolean;
}
+30
View File
@@ -0,0 +1,30 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXBkYXRhYmxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1VwZGF0YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0UiLCJzb3VyY2VzQ29udGVudCI6WyIvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4gKiBTcGluZSBSdW50aW1lcyBMaWNlbnNlIEFncmVlbWVudFxuICogTGFzdCB1cGRhdGVkIEFwcmlsIDUsIDIwMjUuIFJlcGxhY2VzIGFsbCBwcmlvciB2ZXJzaW9ucy5cbiAqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTMtMjAyNSwgRXNvdGVyaWMgU29mdHdhcmUgTExDXG4gKlxuICogSW50ZWdyYXRpb24gb2YgdGhlIFNwaW5lIFJ1bnRpbWVzIGludG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iBAcGFyYW0gcGh5c2ljcyBEZXRlcm1pbmVzIGhvdyBwaHlzaWNzIGFuZCBvdGhlciBub24tZGV0ZXJtaW5pc3RpYyB1cGRhdGVzIGFyZSBhcHBsaWVkLiAqL1xuXHR1cGRhdGUgKHBoeXNpY3M6IFBoeXNpY3MpOiB2b2lkO1xuXG5cdC8qKiBSZXR1cm5zIGZhbHNlIHdoZW4gdGhpcyBpdGVtIHdvbid0IGJlIHVwZGF0ZWQgYnlcblx0ICoge0BsaW5rIFNrZWxldG9uI3VwZGF0ZVdvcmxkVHJhbnNmb3JtKCl9IGJlY2F1c2UgYSBza2luIGlzIHJlcXVpcmVkIGFuZCB0aGVcblx0ICoge0BsaW5rIFNrZWxldG9uI2dldFNraW4oKSBhY3RpdmUgc2tpbn0gZG9lcyBub3QgY29udGFpbiB0aGlzIGl0ZW0uXG5cdCAqIEBzZWUgU2tpbiNnZXRCb25lcygpXG5cdCAqIEBzZWUgU2tpbiNnZXRDb25zdHJhaW50cygpXG5cdCAqIEBzZWUgQm9uZURhdGEjZ2V0U2tpblJlcXVpcmVkKClcblx0ICogQHNlZSBDb25zdHJhaW50RGF0YSNnZXRTa2luUmVxdWlyZWQoKSAqL1xuXHRpc0FjdGl2ZSAoKTogYm9vbGVhbjtcbn1cbiJdfQ==
+169
View File
@@ -0,0 +1,169 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Skeleton } from "./Skeleton.js";
import { MixBlend } from "./Animation.js";
export interface StringMap<T> {
[key: string]: T;
}
export declare class IntSet {
array: (number | undefined)[];
add(value: number): boolean;
contains(value: number): boolean;
remove(value: number): void;
clear(): void;
}
export declare class StringSet {
entries: StringMap<boolean>;
size: number;
add(value: string): boolean;
addAll(values: string[]): boolean;
contains(value: string): boolean;
clear(): void;
}
export type NumberArrayLike = Array<number> | Float32Array;
export type IntArrayLike = Array<number> | Int16Array;
export interface Disposable {
dispose(): void;
}
export interface Restorable {
restore(): void;
}
export declare class Color {
r: number;
g: number;
b: number;
a: number;
static WHITE: Color;
static RED: Color;
static GREEN: Color;
static BLUE: Color;
static MAGENTA: Color;
constructor(r?: number, g?: number, b?: number, a?: number);
set(r: number, g: number, b: number, a: number): this;
setFromColor(c: Color): this;
setFromString(hex: string): this;
add(r: number, g: number, b: number, a: number): this;
clamp(): this;
static rgba8888ToColor(color: Color, value: number): void;
static rgb888ToColor(color: Color, value: number): void;
toRgb888(): number;
static fromString(hex: string, color?: Color): Color;
}
export declare class MathUtils {
static PI: number;
static PI2: number;
static invPI2: number;
static radiansToDegrees: number;
static radDeg: number;
static degreesToRadians: number;
static degRad: number;
static clamp(value: number, min: number, max: number): number;
static cosDeg(degrees: number): number;
static sinDeg(degrees: number): number;
static atan2Deg(y: number, x: number): number;
static signum(value: number): number;
static toInt(x: number): number;
static cbrt(x: number): number;
static randomTriangular(min: number, max: number): number;
static randomTriangularWith(min: number, max: number, mode: number): number;
static isPowerOfTwo(value: number): boolean | 0;
}
export declare abstract class Interpolation {
protected abstract applyInternal(a: number): number;
apply(start: number, end: number, a: number): number;
}
export declare class Pow extends Interpolation {
protected power: number;
constructor(power: number);
applyInternal(a: number): number;
}
export declare class PowOut extends Pow {
constructor(power: number);
applyInternal(a: number): number;
}
export declare class Utils {
static SUPPORTS_TYPED_ARRAYS: boolean;
static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number): void;
static arrayFill<T>(array: ArrayLike<T>, fromIndex: number, toIndex: number, value: T): void;
static setArraySize<T>(array: Array<T>, size: number, value?: any): Array<T>;
static ensureArrayCapacity<T>(array: Array<T>, size: number, value?: any): Array<T>;
static newArray<T>(size: number, defaultValue: T): Array<T>;
static newFloatArray(size: number): NumberArrayLike;
static newShortArray(size: number): IntArrayLike;
static toFloatArray(array: Array<number>): number[] | Float32Array;
static toSinglePrecision(value: number): number;
static webkit602BugfixHelper(alpha: number, blend: MixBlend): void;
static contains<T>(array: Array<T>, element: T, identity?: boolean): boolean;
static enumValue(type: any, name: string): any;
}
export declare class DebugUtils {
static logBones(skeleton: Skeleton): void;
}
export declare class Pool<T> {
private items;
private instantiator;
constructor(instantiator: () => T);
obtain(): T;
free(item: T): void;
freeAll(items: ArrayLike<T>): void;
clear(): void;
}
export declare class Vector2 {
x: number;
y: number;
constructor(x?: number, y?: number);
set(x: number, y: number): Vector2;
length(): number;
normalize(): this;
}
export declare class TimeKeeper {
maxDelta: number;
framesPerSecond: number;
delta: number;
totalTime: number;
private lastTime;
private frameCount;
private frameTime;
update(): void;
}
export interface ArrayLike<T> {
length: number;
[n: number]: T;
}
export declare class WindowedMean {
values: Array<number>;
addedValues: number;
lastValue: number;
mean: number;
dirty: boolean;
constructor(windowSize?: number);
hasEnoughData(): boolean;
addValue(value: number): void;
getMean(): number;
}
+414
View File
@@ -0,0 +1,414 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export class IntSet {
array = new Array();
add(value) {
let contains = this.contains(value);
this.array[value | 0] = value | 0;
return !contains;
}
contains(value) {
return this.array[value | 0] != undefined;
}
remove(value) {
this.array[value | 0] = undefined;
}
clear() {
this.array.length = 0;
}
}
export class StringSet {
entries = {};
size = 0;
add(value) {
let contains = this.entries[value];
this.entries[value] = true;
if (!contains) {
this.size++;
return true;
}
return false;
}
addAll(values) {
let oldSize = this.size;
for (var i = 0, n = values.length; i < n; i++)
this.add(values[i]);
return oldSize != this.size;
}
contains(value) {
return this.entries[value];
}
clear() {
this.entries = {};
this.size = 0;
}
}
export class Color {
r;
g;
b;
a;
static WHITE = new Color(1, 1, 1, 1);
static RED = new Color(1, 0, 0, 1);
static GREEN = new Color(0, 1, 0, 1);
static BLUE = new Color(0, 0, 1, 1);
static MAGENTA = new Color(1, 0, 1, 1);
constructor(r = 0, g = 0, b = 0, a = 0) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
set(r, g, b, a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
return this.clamp();
}
setFromColor(c) {
this.r = c.r;
this.g = c.g;
this.b = c.b;
this.a = c.a;
return this;
}
setFromString(hex) {
hex = hex.charAt(0) == '#' ? hex.substr(1) : hex;
this.r = parseInt(hex.substr(0, 2), 16) / 255;
this.g = parseInt(hex.substr(2, 2), 16) / 255;
this.b = parseInt(hex.substr(4, 2), 16) / 255;
this.a = hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255;
return this;
}
add(r, g, b, a) {
this.r += r;
this.g += g;
this.b += b;
this.a += a;
return this.clamp();
}
clamp() {
if (this.r < 0)
this.r = 0;
else if (this.r > 1)
this.r = 1;
if (this.g < 0)
this.g = 0;
else if (this.g > 1)
this.g = 1;
if (this.b < 0)
this.b = 0;
else if (this.b > 1)
this.b = 1;
if (this.a < 0)
this.a = 0;
else if (this.a > 1)
this.a = 1;
return this;
}
static rgba8888ToColor(color, value) {
color.r = ((value & 0xff000000) >>> 24) / 255;
color.g = ((value & 0x00ff0000) >>> 16) / 255;
color.b = ((value & 0x0000ff00) >>> 8) / 255;
color.a = ((value & 0x000000ff)) / 255;
}
static rgb888ToColor(color, value) {
color.r = ((value & 0x00ff0000) >>> 16) / 255;
color.g = ((value & 0x0000ff00) >>> 8) / 255;
color.b = ((value & 0x000000ff)) / 255;
}
toRgb888() {
const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
}
static fromString(hex, color = new Color()) {
return color.setFromString(hex);
}
}
export class MathUtils {
static PI = 3.1415927;
static PI2 = MathUtils.PI * 2;
static invPI2 = 1 / MathUtils.PI2;
static radiansToDegrees = 180 / MathUtils.PI;
static radDeg = MathUtils.radiansToDegrees;
static degreesToRadians = MathUtils.PI / 180;
static degRad = MathUtils.degreesToRadians;
static clamp(value, min, max) {
if (value < min)
return min;
if (value > max)
return max;
return value;
}
static cosDeg(degrees) {
return Math.cos(degrees * MathUtils.degRad);
}
static sinDeg(degrees) {
return Math.sin(degrees * MathUtils.degRad);
}
static atan2Deg(y, x) {
return Math.atan2(y, x) * MathUtils.degRad;
}
static signum(value) {
return value > 0 ? 1 : value < 0 ? -1 : 0;
}
static toInt(x) {
return x > 0 ? Math.floor(x) : Math.ceil(x);
}
static cbrt(x) {
let y = Math.pow(Math.abs(x), 1 / 3);
return x < 0 ? -y : y;
}
static randomTriangular(min, max) {
return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);
}
static randomTriangularWith(min, max, mode) {
let u = Math.random();
let d = max - min;
if (u <= (mode - min) / d)
return min + Math.sqrt(u * d * (mode - min));
return max - Math.sqrt((1 - u) * d * (max - mode));
}
static isPowerOfTwo(value) {
return value && (value & (value - 1)) === 0;
}
}
export class Interpolation {
apply(start, end, a) {
return start + (end - start) * this.applyInternal(a);
}
}
export class Pow extends Interpolation {
power = 2;
constructor(power) {
super();
this.power = power;
}
applyInternal(a) {
if (a <= 0.5)
return Math.pow(a * 2, this.power) / 2;
return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
}
}
export class PowOut extends Pow {
constructor(power) {
super(power);
}
applyInternal(a) {
return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
}
}
export class Utils {
static SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined";
static arrayCopy(source, sourceStart, dest, destStart, numElements) {
for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
dest[j] = source[i];
}
}
static arrayFill(array, fromIndex, toIndex, value) {
for (let i = fromIndex; i < toIndex; i++)
array[i] = value;
}
static setArraySize(array, size, value = 0) {
let oldSize = array.length;
if (oldSize == size)
return array;
array.length = size;
if (oldSize < size) {
for (let i = oldSize; i < size; i++)
array[i] = value;
}
return array;
}
static ensureArrayCapacity(array, size, value = 0) {
if (array.length >= size)
return array;
return Utils.setArraySize(array, size, value);
}
static newArray(size, defaultValue) {
let array = new Array(size);
for (let i = 0; i < size; i++)
array[i] = defaultValue;
return array;
}
static newFloatArray(size) {
if (Utils.SUPPORTS_TYPED_ARRAYS)
return new Float32Array(size);
else {
let array = new Array(size);
for (let i = 0; i < array.length; i++)
array[i] = 0;
return array;
}
}
static newShortArray(size) {
if (Utils.SUPPORTS_TYPED_ARRAYS)
return new Int16Array(size);
else {
let array = new Array(size);
for (let i = 0; i < array.length; i++)
array[i] = 0;
return array;
}
}
static toFloatArray(array) {
return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;
}
static toSinglePrecision(value) {
return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
}
// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
static webkit602BugfixHelper(alpha, blend) {
}
static contains(array, element, identity = true) {
for (var i = 0; i < array.length; i++)
if (array[i] == element)
return true;
return false;
}
static enumValue(type, name) {
return type[name[0].toUpperCase() + name.slice(1)];
}
}
export class DebugUtils {
static logBones(skeleton) {
for (let i = 0; i < skeleton.bones.length; i++) {
let bone = skeleton.bones[i];
console.log(bone.data.name + ", " + bone.a + ", " + bone.b + ", " + bone.c + ", " + bone.d + ", " + bone.worldX + ", " + bone.worldY);
}
}
}
export class Pool {
items = new Array();
instantiator;
constructor(instantiator) {
this.instantiator = instantiator;
}
obtain() {
return this.items.length > 0 ? this.items.pop() : this.instantiator();
}
free(item) {
if (item.reset)
item.reset();
this.items.push(item);
}
freeAll(items) {
for (let i = 0; i < items.length; i++)
this.free(items[i]);
}
clear() {
this.items.length = 0;
}
}
export class Vector2 {
x;
y;
constructor(x = 0, y = 0) {
this.x = x;
this.y = y;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
length() {
let x = this.x;
let y = this.y;
return Math.sqrt(x * x + y * y);
}
normalize() {
let len = this.length();
if (len != 0) {
this.x /= len;
this.y /= len;
}
return this;
}
}
export class TimeKeeper {
maxDelta = 0.064;
framesPerSecond = 0;
delta = 0;
totalTime = 0;
lastTime = Date.now() / 1000;
frameCount = 0;
frameTime = 0;
update() {
let now = Date.now() / 1000;
this.delta = now - this.lastTime;
this.frameTime += this.delta;
this.totalTime += this.delta;
if (this.delta > this.maxDelta)
this.delta = this.maxDelta;
this.lastTime = now;
this.frameCount++;
if (this.frameTime > 1) {
this.framesPerSecond = this.frameCount / this.frameTime;
this.frameTime = 0;
this.frameCount = 0;
}
}
}
export class WindowedMean {
values;
addedValues = 0;
lastValue = 0;
mean = 0;
dirty = true;
constructor(windowSize = 32) {
this.values = new Array(windowSize);
}
hasEnoughData() {
return this.addedValues >= this.values.length;
}
addValue(value) {
if (this.addedValues < this.values.length)
this.addedValues++;
this.values[this.lastValue++] = value;
if (this.lastValue > this.values.length - 1)
this.lastValue = 0;
this.dirty = true;
}
getMean() {
if (this.hasEnoughData()) {
if (this.dirty) {
let mean = 0;
for (let i = 0; i < this.values.length; i++)
mean += this.values[i];
this.mean = mean / this.values.length;
this.dirty = false;
}
return this.mean;
}
return 0;
}
}
//# sourceMappingURL=data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LENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxHQUFHLEdBQUcsQ0FBQztRQUNwRSxPQUFPLElBQUksQ0FBQztJQUNiLENBQUM7SUFFRCxHQUFHLENBQUUsQ0FBUyxFQUFFLENBQVMsRUFBRSxDQUFTLEVBQUUsQ0FBUztRQUM5QyxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNaLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ1osSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDWixJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNaLE9BQU8sSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3JCLENBQUM7SUFFRCxLQUFLO1FBQ0osSUFBSSxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUM7WUFBRSxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQzthQUN0QixJQUFJLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQztZQUFFLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBRWhDLElBQUksSUFBSSxDQUFDLENBQUMsR0FBRyxDQUFDO1lBQUUsSUFBSSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUM7YUFDdEIsSUFBSSxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUM7WUFBRSxJQUFJLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQ Line truncated
@@ -0,0 +1,72 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Slot } from "../Slot.js";
import { NumberArrayLike } from "../Utils.js";
/** The base class for all attachments. */
export declare abstract class Attachment {
name: string;
constructor(name: string);
abstract copy(): Attachment;
}
/** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's
* {@link Slot#deform}. */
export declare abstract class VertexAttachment extends Attachment {
private static nextID;
/** The unique ID for this attachment. */
id: number;
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
* if this attachment has no weights. */
bones: Array<number> | null;
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
* entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
* each vertex. */
vertices: NumberArrayLike;
/** The maximum number of world vertex values that can be output by
* {@link #computeWorldVertices()} using the `count` parameter. */
worldVerticesLength: number;
/** Timelines for the timeline attachment are also applied to this attachment.
* May be null if no attachment-specific timelines should be applied. */
timelineAttachment: Attachment;
constructor(name: string);
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
* not empty, it is used to deform the vertices.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide.
* @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
* @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
* @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
* `stride` / 2.
* @param offset The `worldVertices` index to begin writing values.
* @param stride The number of `worldVertices` entries between the value pairs written. */
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: NumberArrayLike, offset: number, stride: number): void;
/** Does not copy id (generated) or name (set on construction). **/
copyTo(attachment: VertexAttachment): void;
}
@@ -0,0 +1,148 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Utils } from "../Utils.js";
/** The base class for all attachments. */
export class Attachment {
name;
constructor(name) {
if (!name)
throw new Error("name cannot be null.");
this.name = name;
}
}
/** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's
* {@link Slot#deform}. */
export class VertexAttachment extends Attachment {
static nextID = 0;
/** The unique ID for this attachment. */
id = VertexAttachment.nextID++;
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
* if this attachment has no weights. */
bones = null;
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
* entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
* each vertex. */
vertices = [];
/** The maximum number of world vertex values that can be output by
* {@link #computeWorldVertices()} using the `count` parameter. */
worldVerticesLength = 0;
/** Timelines for the timeline attachment are also applied to this attachment.
* May be null if no attachment-specific timelines should be applied. */
timelineAttachment = this;
constructor(name) {
super(name);
}
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
* not empty, it is used to deform the vertices.
*
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
* Runtimes Guide.
* @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
* @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
* @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
* `stride` / 2.
* @param offset The `worldVertices` index to begin writing values.
* @param stride The number of `worldVertices` entries between the value pairs written. */
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
count = offset + (count >> 1) * stride;
let skeleton = slot.bone.skeleton;
let deformArray = slot.deform;
let vertices = this.vertices;
let bones = this.bones;
if (!bones) {
if (deformArray.length > 0)
vertices = deformArray;
let bone = slot.bone;
let x = bone.worldX;
let y = bone.worldY;
let a = bone.a, b = bone.b, c = bone.c, d = bone.d;
for (let v = start, w = offset; w < count; v += 2, w += stride) {
let vx = vertices[v], vy = vertices[v + 1];
worldVertices[w] = vx * a + vy * b + x;
worldVertices[w + 1] = vx * c + vy * d + y;
}
return;
}
let v = 0, skip = 0;
for (let i = 0; i < start; i += 2) {
let n = bones[v];
v += n + 1;
skip += n;
}
let skeletonBones = skeleton.bones;
if (deformArray.length == 0) {
for (let w = offset, b = skip * 3; w < count; w += stride) {
let wx = 0, wy = 0;
let n = bones[v++];
n += v;
for (; v < n; v++, b += 3) {
let bone = skeletonBones[bones[v]];
let vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2];
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
}
worldVertices[w] = wx;
worldVertices[w + 1] = wy;
}
}
else {
let deform = deformArray;
for (let w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {
let wx = 0, wy = 0;
let n = bones[v++];
n += v;
for (; v < n; v++, b += 3, f += 2) {
let bone = skeletonBones[bones[v]];
let vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2];
wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight;
wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight;
}
worldVertices[w] = wx;
worldVertices[w + 1] = wy;
}
}
}
/** Does not copy id (generated) or name (set on construction). **/
copyTo(attachment) {
if (this.bones) {
attachment.bones = new Array(this.bones.length);
Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
}
else
attachment.bones = null;
if (this.vertices) {
attachment.vertices = Utils.newFloatArray(this.vertices.length);
Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
}
attachment.worldVerticesLength = this.worldVerticesLength;
attachment.timelineAttachment = this.timelineAttachment;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXR0YWNobWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdHRhY2htZW50cy9BdHRhY2htZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUcvRSxPQUFPLEVBQW1CLEtBQUssRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVyRCwwQ0FBMEM7QUFDMUMsTUFBTSxPQUFnQixVQUFVO0lBQy9CLElBQUksQ0FBUztJQUViLFlBQWEsSUFBWTtRQUN4QixJQUFJLENBQUMsSUFBSTtZQUFFLE1BQU0sSUFBSSxLQUFLLENBQUMsc0JBQXNCLENBQUMsQ0FBQztRQUNuRCxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztJQUNsQixDQUFDO0NBR0Q7QUFFRDswQkFDMEI7QUFDMUIsTUFBTSxPQUFnQixnQkFBaUIsU0FBUSxVQUFVO0lBQ2hELE1BQU0sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDO0lBRTFCLHlDQUF5QztJQUN6QyxFQUFFLEdBQUcsZ0JBQWdCLENBQUMsTUFBTSxFQUFFLENBQUM7SUFFL0I7OzRDQUV3QztJQUN4QyxLQUFLLEdBQXlCLElBQUksQ0FBQztJQUVuQzs7c0JBRWtCO0lBQ2xCLFFBQVEsR0FBb0IsRUFBRSxDQUFDO0lBRS9CO3NFQUNrRTtJQUNs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EVBQUUsQ0FBQztnQkFDdEIsYUFBYSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUM7WUFDM0IsQ0FBQztRQUNGLENBQUM7YUFBTSxDQUFDO1lBQ1AsSUFBSSxNQUFNLEdBQUcsV0FBVyxDQUFDO1lBQ3pCLEtBQUssSUFBSSxDQUFDLEdBQUcsTUFBTSxFQUFFLENBQUMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxJQUFJLElBQUksQ0FBQyxFQUFFLENBQUMsR0FBRyxLQUFLLEVBQUUsQ0FBQyxJQUFJLE1BQU0sRUFBRSxDQUFDO2dCQUMxRSxJQUFJLEVBQUUsR0FBRyxDQUFDLEVBQUUsRUFBRSxHQUFHLENBQUMsQ0FBQztnQkFDbkIsSUFBSSxDQUFDLEdBQUcsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUM7Z0JBQ25CLENBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ1AsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDO29CQUNuQyxJQUFJLElBQUksR0FBRyxhQUFhLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7b0JBQ25DLElBQUksRUFBRSxHQUFHLFFBQVEsQ0FBQyxDQUFDLENBQUMsR0FBRyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxHQUFHLFFBQVEsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQUcsTUFBTSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsRUFBRSxNQUFNLEdBQUcsUUFBUSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQ Line truncated
@@ -0,0 +1,54 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Skin } from "../Skin.js";
import { BoundingBoxAttachment } from "./BoundingBoxAttachment.js";
import { ClippingAttachment } from "./ClippingAttachment.js";
import { MeshAttachment } from "./MeshAttachment.js";
import { PathAttachment } from "./PathAttachment.js";
import { PointAttachment } from "./PointAttachment.js";
import { RegionAttachment } from "./RegionAttachment.js";
import { Sequence } from "./Sequence.js";
/** The interface which can be implemented to customize creating and populating attachments.
*
* See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#AttachmentLoader) in the Spine
* Runtimes Guide. */
export interface AttachmentLoader {
/** @return May be null to not load an attachment. */
newRegionAttachment(skin: Skin, name: string, path: string, sequence: Sequence | null): RegionAttachment;
/** @return May be null to not load an attachment. */
newMeshAttachment(skin: Skin, name: string, path: string, sequence: Sequence | null): MeshAttachment;
/** @return May be null to not load an attachment. */
newBoundingBoxAttachment(skin: Skin, name: string): BoundingBoxAttachment;
/** @return May be null to not load an attachment */
newPathAttachment(skin: Skin, name: string): PathAttachment;
/** @return May be null to not load an attachment */
newPointAttachment(skin: Skin, name: string): PointAttachment;
/** @return May be null to not load an attachment */
newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
}
@@ -0,0 +1,30 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXR0YWNobWVudExvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdHRhY2htZW50cy9BdHRhY2htZW50TG9hZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRSIsInNvdXJjZXNDb250ZW50IjpbIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcbiAqIFNwaW5lIFJ1bnRpbWVzIExpY2Vuc2UgQWdyZWVtZW50XG4gKiBMYXN0IHVwZGF0ZWQgQXByaWwgNSwgMjAyNS4gUmVwbGFjZXMgYWxsIHByaW9yIHZlcnNpb25zLlxuICpcbiAqIENvcHlyaWdodCAoYykgMjAxMy0yMDI1LCBFc290ZXJpYyBTb2Z0d2FyZSBMTENcbiAqXG4gKiBJbnRlZ3JhdGlvbiBvZiB0aGUgU3BpbmUgUnVudGltZXMgaW50byBzb2Z0d2FyZSBvciBvdGhlcndpc2UgY3JlYXRpbmdcbiAqIGRlcml2YXRpdmUgd29ya3Mgb2YgdGhlIFNwaW5lIFJ1bnRpbWVzIGlzIHBlcm1pdHRlZCB1bmRlciB0aGUgdGVybXMgYW5kXG4gKiBjb25kaXRpb25zIG9mIFNlY3Rpb24gMiBvZiB0aGUgU3BpbmUgRWRpdG9yIExpY2Vuc2UgQ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2htZW50IChza2luOiBTa2luLCBuYW1lOiBzdHJpbmcpOiBCb3VuZGluZ0JveEF0dGFjaG1lbnQ7XG5cblx0LyoqIEByZXR1cm4gTWF5IGJlIG51bGwgdG8gbm90IGxvYWQgYW4gYXR0YWNobWVudCAqL1xuXHRuZXdQYXRoQXR0YWNobWVudCAoc2tpbjogU2tpbiwgbmFtZTogc3RyaW5nKTogUGF0aEF0dGFjaG1lbnQ7XG5cblx0LyoqIEByZXR1cm4gTWF5IGJlIG51bGwgdG8gbm90IGxvYWQgYW4gYXR0YWNobWVudCAqL1xuXHRuZXdQb2ludEF0dGFjaG1lbnQgKHNraW46IFNraW4sIG5hbWU6IHN0cmluZyk6IFBvaW50QXR0YWNobWVudDtcblxuXHQvKiogQHJldHVybiBNYXkgYmUgbnVsbCB0byBub3QgbG9hZCBhbiBhdHRhY2htZW50ICovXG5cdG5ld0NsaXBwaW5nQXR0YWNobWVudCAoc2tpbjogU2tpbiwgbmFtZTogc3RyaW5nKTogQ2xpcHBpbmdBdHRhY2htZW50O1xufVxuIl19
@@ -0,0 +1,40 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "../Utils.js";
import { VertexAttachment, Attachment } from "./Attachment.js";
/** An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle
* effects, and more.
*
* See {@link SkeletonBounds} and [Bounding Boxes](http://esotericsoftware.com/spine-bounding-boxes) in the Spine User
* Guide. */
export declare class BoundingBoxAttachment extends VertexAttachment {
color: Color;
constructor(name: string);
copy(): Attachment;
}
@@ -0,0 +1,48 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "../Utils.js";
import { VertexAttachment } from "./Attachment.js";
/** An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle
* effects, and more.
*
* See {@link SkeletonBounds} and [Bounding Boxes](http://esotericsoftware.com/spine-bounding-boxes) in the Spine User
* Guide. */
export class BoundingBoxAttachment extends VertexAttachment {
color = new Color(1, 1, 1, 1);
constructor(name) {
super(name);
}
copy() {
let copy = new BoundingBoxAttachment(this.name);
this.copyTo(copy);
copy.color.setFromColor(this.color);
return copy;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQm91bmRpbmdCb3hBdHRhY2htZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F0dGFjaG1lbnRzL0JvdW5kaW5nQm94QXR0YWNobWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFFL0UsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNwQyxPQUFPLEVBQUUsZ0JBQWdCLEVBQWMsTUFBTSxpQ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xpbmsgU2tlbGV0b25Cb3VuZHN9IGFuZCBbQm91bmRpbmcgQm94ZXNdKGh0dHA6Ly9lc290ZXJpY3NvZnR3YXJlLmNvbS9zcGluZS1ib3VuZGluZy1ib3hlcykgaW4gdGhlIFNwaW5lIFVzZXJcbiAqIEd1aWRlLiAqL1xuZXhwb3J0IGNsYXNzIEJvdW5kaW5nQm94QXR0YWNobWVudCBleHRlbmRzIFZlcnRleEF0dGFjaG1lbnQge1xuXHRjb2xvciA9IG5ldyBDb2xvcigxLCAxLCAxLCAxKTtcblxuXHRjb25zdHJ1Y3RvciAobmFtZTogc3RyaW5nKSB7XG5cdFx0c3VwZXIobmFtZSk7XG5cdH1cblxuXHRjb3B5ICgpOiBBdHRhY2htZW50IHtcblx0XHRsZXQgY29weSA9IG5ldyBCb3VuZGluZ0JveEF0dGFjaG1lbnQodGhpcy5uYW1lKTtcblx0XHR0aGlzLmNvcHlUbyhjb3B5KTtcblx0XHRjb3B5LmNvbG9yLnNldEZyb21Db2xvcih0aGlzLmNvbG9yKTtcblx0XHRyZXR1cm4gY29weTtcblx0fVxufVxuIl19
@@ -0,0 +1,42 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { SlotData } from "../SlotData.js";
import { Color } from "../Utils.js";
import { VertexAttachment, Attachment } from "./Attachment.js";
/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */
export declare class ClippingAttachment extends VertexAttachment {
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
* the skeleton's rendering. */
endSlot: SlotData | null;
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
* are not usually rendered at runtime. */
color: Color;
constructor(name: string);
copy(): Attachment;
}
@@ -0,0 +1,51 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "../Utils.js";
import { VertexAttachment } from "./Attachment.js";
/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */
export class ClippingAttachment extends VertexAttachment {
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
* the skeleton's rendering. */
endSlot = null;
// Nonessential.
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
* are not usually rendered at runtime. */
color = new Color(0.2275, 0.2275, 0.8078, 1); // ce3a3aff
constructor(name) {
super(name);
}
copy() {
let copy = new ClippingAttachment(this.name);
this.copyTo(copy);
copy.endSlot = this.endSlot;
copy.color.setFromColor(this.color);
return copy;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2xpcHBpbmdBdHRhY2htZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F0dGFjaG1lbnRzL0NsaXBwaW5nQXR0YWNobWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs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lcihuYW1lKTtcblx0fVxuXG5cdGNvcHkgKCk6IEF0dGFjaG1lbnQge1xuXHRcdGxldCBjb3B5ID0gbmV3IENsaXBwaW5nQXR0YWNobWVudCh0aGlzLm5hbWUpO1xuXHRcdHRoaXMuY29weVRvKGNvcHkpO1xuXHRcdGNvcHkuZW5kU2xvdCA9IHRoaXMuZW5kU2xvdDtcblx0XHRjb3B5LmNvbG9yLnNldEZyb21Db2xvcih0aGlzLmNvbG9yKTtcblx0XHRyZXR1cm4gY29weTtcblx0fVxufVxuIl19
@@ -0,0 +1,44 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureRegion } from "../Texture.js";
import { Color } from "../Utils.js";
import { Sequence } from "./Sequence.js";
export interface HasTextureRegion {
/** The name used to find the {@link #region()}. */
path: string;
/** The region used to draw the attachment. After setting the region or if the region's properties are changed,
* {@link #updateRegion()} must be called. */
region: TextureRegion | null;
/** Updates any values the attachment calculates using the {@link #getRegion()}. Must be called after setting the
* {@link #getRegion()} or if the region's properties are changed. */
updateRegion(): void;
/** The color to tint the attachment. */
color: Color;
sequence: Sequence | null;
}
@@ -0,0 +1,30 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSGFzVGV4dHVyZVJlZ2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdHRhY2htZW50cy9IYXNUZXh0dXJlUmVnaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRSIsInNvdXJjZXNDb250ZW50IjpbIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcbiAqIFNwaW5lIFJ1bnRpbWVzIExpY2Vuc2UgQWdyZWVtZW50XG4gKiBMYXN0IHVwZGF0ZWQgQXByaWwgNSwgMjAyNS4gUmVwbGFjZXMgYWxsIHByaW9yIHZlcnNpb25zLlxuICpcbiAqIENvcHlyaWdodCAoYykgMjAxMy0yMDI1LCBFc290ZXJpYyBTb2Z0d2FyZSBMTENcbiAqXG4gKiBJbnRlZ3JhdGlvbiBvZiB0aGUgU3BpbmUgUnVudGltZXMgaW50byBzb2Z0d2FyZSBvciBvdGhlcndpc2UgY3JlYXRpbmdcbiAqIGRlcml2YXRpdmUgd29ya3Mgb2YgdGhlIFNwaW5lIFJ1bnRpbWVzIGlzIHBlcm1pdHRlZCB1bmRlciB0aGUgdGVybXMgYW5kXG4gKiBjb25kaXRpb25zIG9mIFNlY3Rpb24gMiBvZiB0aGUgU3BpbmUgRWRpdG9yIExpY2Vuc2UgQWdyZWVtZW50OlxuICogaH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XJ0aWVzIGFyZSBjaGFuZ2VkLFxuXHQgKiB7QGxpbmsgI3VwZGF0ZVJlZ2lvbigpfSBtdXN0IGJlIGNhbGxlZC4gKi9cblx0cmVnaW9uOiBUZXh0dXJlUmVnaW9uIHwgbnVsbDtcblxuXHQvKiogVXBkYXRlcyBhbnkgdmFsdWVzIHRoZSBhdHRhY2htZW50IGNhbGN1bGF0ZXMgdXNpbmcgdGhlIHtAbGluayAjZ2V0UmVnaW9uKCl9LiBNdXN0IGJlIGNhbGxlZCBhZnRlciBzZXR0aW5nIHRoZVxuXHQgKiB7QGxpbmsgI2dldFJlZ2lvbigpfSBvciBpZiB0aGUgcmVnaW9uJ3MgcHJvcGVydGllcyBhcmUgY2hhbmdlZC4gKi9cblx0dXBkYXRlUmVnaW9uICgpOiB2b2lkO1xuXG5cdC8qKiBUaGUgY29sb3IgdG8gdGludCB0aGUgYXR0YWNobWVudC4gKi9cblx0Y29sb3I6IENvbG9yO1xuXG5cdHNlcXVlbmNlOiBTZXF1ZW5jZSB8IG51bGw7XG59XG4iXX0=
@@ -0,0 +1,79 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureRegion } from "../Texture.js";
import { Color, NumberArrayLike } from "../Utils.js";
import { VertexAttachment, Attachment } from "./Attachment.js";
import { HasTextureRegion } from "./HasTextureRegion.js";
import { Sequence } from "./Sequence.js";
import { Slot } from "../Slot.js";
/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not
* supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
*
* See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */
export declare class MeshAttachment extends VertexAttachment implements HasTextureRegion {
region: TextureRegion | null;
/** The name of the texture region for this attachment. */
path: string;
/** The UV pair for each vertex, normalized within the texture region. */
regionUVs: NumberArrayLike;
/** The UV pair for each vertex, normalized within the entire texture.
*
* See {@link #updateUVs}. */
uvs: NumberArrayLike;
/** Triplets of vertex indices which describe the mesh's triangulation. */
triangles: Array<number>;
/** The color to tint the mesh. */
color: Color;
/** The width of the mesh's image. Available only when nonessential data was exported. */
width: number;
/** The height of the mesh's image. Available only when nonessential data was exported. */
height: number;
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
hullLength: number;
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
* nonessential data was exported. Triangulation is not performed at runtime. */
edges: Array<number>;
private parentMesh;
sequence: Sequence | null;
tempColor: Color;
constructor(name: string, path: string);
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
* the {@link #regionUVs} are changed. */
updateRegion(): void;
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
getParentMesh(): MeshAttachment | null;
/** @param parentMesh May be null. */
setParentMesh(parentMesh: MeshAttachment): void;
copy(): Attachment;
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: NumberArrayLike, offset: number, stride: number): void;
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
newLinkedMesh(): MeshAttachment;
}
@@ -0,0 +1,190 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureAtlasRegion } from "../TextureAtlas.js";
import { Color, Utils } from "../Utils.js";
import { VertexAttachment } from "./Attachment.js";
/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not
* supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
*
* See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */
export class MeshAttachment extends VertexAttachment {
region = null;
/** The name of the texture region for this attachment. */
path;
/** The UV pair for each vertex, normalized within the texture region. */
regionUVs = [];
/** The UV pair for each vertex, normalized within the entire texture.
*
* See {@link #updateUVs}. */
uvs = [];
/** Triplets of vertex indices which describe the mesh's triangulation. */
triangles = [];
/** The color to tint the mesh. */
color = new Color(1, 1, 1, 1);
/** The width of the mesh's image. Available only when nonessential data was exported. */
width = 0;
/** The height of the mesh's image. Available only when nonessential data was exported. */
height = 0;
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
hullLength = 0;
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
* nonessential data was exported. Triangulation is not performed at runtime. */
edges = [];
parentMesh = null;
sequence = null;
tempColor = new Color(0, 0, 0, 0);
constructor(name, path) {
super(name);
this.path = path;
}
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
* the {@link #regionUVs} are changed. */
updateRegion() {
if (!this.region)
throw new Error("Region not set.");
let regionUVs = this.regionUVs;
if (!this.uvs || this.uvs.length != regionUVs.length)
this.uvs = Utils.newFloatArray(regionUVs.length);
let uvs = this.uvs;
let n = this.uvs.length;
let u = this.region.u, v = this.region.v, width = 0, height = 0;
if (this.region instanceof TextureAtlasRegion) {
let region = this.region, page = region.page;
let textureWidth = page.width, textureHeight = page.height;
switch (region.degrees) {
case 90:
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
v -= (region.originalWidth - region.offsetX - region.width) / textureHeight;
width = region.originalHeight / textureWidth;
height = region.originalWidth / textureHeight;
for (let i = 0; i < n; i += 2) {
uvs[i] = u + regionUVs[i + 1] * width;
uvs[i + 1] = v + (1 - regionUVs[i]) * height;
}
return;
case 180:
u -= (region.originalWidth - region.offsetX - region.width) / textureWidth;
v -= region.offsetY / textureHeight;
width = region.originalWidth / textureWidth;
height = region.originalHeight / textureHeight;
for (let i = 0; i < n; i += 2) {
uvs[i] = u + (1 - regionUVs[i]) * width;
uvs[i + 1] = v + (1 - regionUVs[i + 1]) * height;
}
return;
case 270:
u -= region.offsetY / textureWidth;
v -= region.offsetX / textureHeight;
width = region.originalHeight / textureWidth;
height = region.originalWidth / textureHeight;
for (let i = 0; i < n; i += 2) {
uvs[i] = u + (1 - regionUVs[i + 1]) * width;
uvs[i + 1] = v + regionUVs[i] * height;
}
return;
}
u -= region.offsetX / textureWidth;
v -= (region.originalHeight - region.offsetY - region.height) / textureHeight;
width = region.originalWidth / textureWidth;
height = region.originalHeight / textureHeight;
}
else if (!this.region) {
u = v = 0;
width = height = 1;
}
else {
width = this.region.u2 - u;
height = this.region.v2 - v;
}
for (let i = 0; i < n; i += 2) {
uvs[i] = u + regionUVs[i] * width;
uvs[i + 1] = v + regionUVs[i + 1] * height;
}
}
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
getParentMesh() {
return this.parentMesh;
}
/** @param parentMesh May be null. */
setParentMesh(parentMesh) {
this.parentMesh = parentMesh;
if (parentMesh) {
this.bones = parentMesh.bones;
this.vertices = parentMesh.vertices;
this.worldVerticesLength = parentMesh.worldVerticesLength;
this.regionUVs = parentMesh.regionUVs;
this.triangles = parentMesh.triangles;
this.hullLength = parentMesh.hullLength;
this.worldVerticesLength = parentMesh.worldVerticesLength;
}
}
copy() {
if (this.parentMesh)
return this.newLinkedMesh();
let copy = new MeshAttachment(this.name, this.path);
copy.region = this.region;
copy.color.setFromColor(this.color);
this.copyTo(copy);
copy.regionUVs = new Array(this.regionUVs.length);
Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = this.uvs instanceof Float32Array ? Utils.newFloatArray(this.uvs.length) : new Array(this.uvs.length);
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array(this.triangles.length);
Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.hullLength = this.hullLength;
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
// Nonessential.
if (this.edges) {
copy.edges = new Array(this.edges.length);
Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
copy.height = this.height;
return copy;
}
computeWorldVertices(slot, start, count, worldVertices, offset, stride) {
if (this.sequence != null)
this.sequence.apply(slot, this);
super.computeWorldVertices(slot, start, count, worldVertices, offset, stride);
}
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
newLinkedMesh() {
let copy = new MeshAttachment(this.name, this.path);
copy.region = this.region;
copy.color.setFromColor(this.color);
copy.timelineAttachment = this.timelineAttachment;
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
if (copy.region != null)
copy.updateRegion();
return copy;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWVzaEF0dGFjaG1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291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sRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7d0JBQy9CLEdBQUcsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBQzt3QkFDNUMsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxHQUFHLE1BQU0sQ0FBQztvQkFDeEMsQ0FBQztvQkFDRCxPQUFPO1lBQ1QsQ0FBQztZQUNELENBQUMsSUFBSSxNQUFNLENBQUMsT0FBTyxHQUFHLFlBQVksQ0FBQztZQUNuQyxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsY0FBYyxHQUFHLE1BQU0sQ0FBQyxPQUFPLEdBQUcsTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLGFBQWEsQ0FBQztZQUM5RSxLQUFLLEdBQUcsTUFBTSxDQUFDLGFBQWEsR0FBRyxZQUFZLENBQUM7WUFDNUMsTUFBTSxHQUFHLE1BQU0sQ0FBQyxjQUFjLEdBQUcsYUFBYSxDQUFDO1FBQ2hELENBQUM7YUFBTSxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQ Line truncated
@@ -0,0 +1,47 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color } from "../Utils.js";
import { VertexAttachment, Attachment } from "./Attachment.js";
/** An attachment whose vertices make up a composite Bezier curve.
*
* See {@link PathConstraint} and [Paths](http://esotericsoftware.com/spine-paths) in the Spine User Guide. */
export declare class PathAttachment extends VertexAttachment {
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
lengths: Array<number>;
/** If true, the start and end knots are connected. */
closed: boolean;
/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
* calculations are performed but calculating positions along the path is less accurate. */
constantSpeed: boolean;
/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
* rendered at runtime. */
color: Color;
constructor(name: string);
copy(): Attachment;
}
@@ -0,0 +1,59 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color, Utils } from "../Utils.js";
import { VertexAttachment } from "./Attachment.js";
/** An attachment whose vertices make up a composite Bezier curve.
*
* See {@link PathConstraint} and [Paths](http://esotericsoftware.com/spine-paths) in the Spine User Guide. */
export class PathAttachment extends VertexAttachment {
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
lengths = [];
/** If true, the start and end knots are connected. */
closed = false;
/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
* calculations are performed but calculating positions along the path is less accurate. */
constantSpeed = false;
/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
* rendered at runtime. */
color = new Color(1, 1, 1, 1);
constructor(name) {
super(name);
}
copy() {
let copy = new PathAttachment(this.name);
this.copyTo(copy);
copy.lengths = new Array(this.lengths.length);
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
copy.color.setFromColor(this.color);
return copy;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGF0aEF0dGFjaG1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXR0YWNobWVudHMvUGF0aEF0dGFjaG1lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsrRUEyQitFO0FBRS9FLE9BQU8sRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQzNDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBYyxNQUFNLGlCQUFpQixDQUFDO0FBRS9EOzs4R0FFOEc7QUFDOUcsTUFBTSxPQUFPLGNBQWUsU0FBUSxnQkFBZ0I7SUFFbkQsK0dBQStHO0lBQy9HLE9BQU8sR0FBa0IsRUFBRSxDQUFDO0lBRTVCLHNEQUFzRDtJQUN0RCxNQUFNLEdBQUcsS0FBSyxDQUFDO0lBRWY7K0ZBQzJGO0lBQzNGLGFBQWEsR0FBRyxLQUFLLENBQUM7SUFFdEI7OEJBQzBCO0lBQzFCLEtBQUssR0FBRyxJQUFJLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQztJQUU5QixZQUFhLElBQVk7UUFDeEIsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ2IsQ0FBQztJQUVELElBQUk7UUFDSCxJQUFJLElBQUksR0FBRyxJQUFJLGNBQWMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQ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LXBhdGhzKSBpbiB0aGUgU3BpbmUgVXNlciBHdWlkZS4gKi9cbmV4cG9ydCBjbGFzcyBQYXRoQXR0YWNobWVudCBleHRlbmRzIFZlcnRleEF0dGFjaG1lbnQge1xuXG5cdC8qKiBUaGUgbGVuZ3RocyBhbG9uZyB0aGUgcGF0aCBpbiB0aGUgc2V0dXAgcG9zZSBmcm9tIHRoZSBzdGFydCBvZiB0aGUgcGF0aCB0byB0aGUgZW5kIG9mIGVhY2ggQmV6aWVyIGN1cnZlLiAqL1xuXHRsZW5ndGhzOiBBcnJheTxudW1iZXI+ID0gW107XG5cblx0LyoqIElmIHRydWUsIHRoZSBzdGFydCBhbmQgZW5kIGtub3RzIGFyZSBjb25uZWN0ZWQuICovXG5cdGNsb3NlZCA9IGZhbHNlO1xuXG5cdC8qKiBJZiB0cnVlLCBhZGRpdGlvbmFsIGNhbGN1bGF0aW9ucyBhcmUgcGVyZm9ybWVkIHRvIG1ha2UgY2FsY3VsYXRpbmcgcG9zaXRpb25zIGFsb25nIHRoZSBwYXRoIG1vcmUgYWNjdXJhdGUuIElmIGZhbHNlLCBmZXdlclxuXHQgKiBjYWxjdWxhdGlvbnMgYXJlIHBlcmZvcm1lZCBidXQgY2FsY3VsYXRpbmcgcG9zaXRpb25zIGFsb25nIHRoZSBwYXRoIGlzIGxlc3MgYWNjdXJhdGUuICovXG5cdGNvbnN0YW50U3BlZWQgPSBmYWxzZTtcblxuXHQvKiogVGhlIGNvbG9yIG9mIHRoZSBwYXRoIGFzIGl0IHdhcyBpbiBTcGluZS4gQXZha Line truncated
@@ -0,0 +1,48 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Bone } from "../Bone.js";
import { Color, Vector2 } from "../Utils.js";
import { VertexAttachment, Attachment } from "./Attachment.js";
/** An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be
* used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a
* skin.
*
* See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */
export declare class PointAttachment extends VertexAttachment {
x: number;
y: number;
rotation: number;
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
* are not usually rendered at runtime. */
color: Color;
constructor(name: string);
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
computeWorldRotation(bone: Bone): number;
copy(): Attachment;
}
@@ -0,0 +1,66 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color, MathUtils } from "../Utils.js";
import { VertexAttachment } from "./Attachment.js";
/** An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be
* used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a
* skin.
*
* See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */
export class PointAttachment extends VertexAttachment {
x = 0;
y = 0;
rotation = 0;
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
* are not usually rendered at runtime. */
color = new Color(0.38, 0.94, 0, 1);
constructor(name) {
super(name);
}
computeWorldPosition(bone, point) {
point.x = this.x * bone.a + this.y * bone.b + bone.worldX;
point.y = this.x * bone.c + this.y * bone.d + bone.worldY;
return point;
}
computeWorldRotation(bone) {
const r = this.rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
const x = cos * bone.a + sin * bone.b;
const y = cos * bone.c + sin * bone.d;
return MathUtils.atan2Deg(y, x);
}
copy() {
let copy = new PointAttachment(this.name);
copy.x = this.x;
copy.y = this.y;
copy.rotation = this.rotation;
copy.color.setFromColor(this.color);
return copy;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUG9pbnRBdHRhY2htZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F0dGFjaG1lbnRzL1BvaW50QXR0YWNobWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFHL0UsT0FBTyxFQUFFLEtBQUssRUFBVyxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEQsT0FBTyxFQUFFLGdCQUFnQixFQUFjLE1BQU0saUJBQWlCLENBQUM7QUFFL0Q7Ozs7MkdBSTJHO0FBQzNHLE1BQU0sT0FBTyxlQUFnQixTQUFRLGdCQUFnQjtJQUNwRCxDQUFDLEdBQVcsQ0FBQyxDQUFDO0lBQ2QsQ0FBQyxHQUFXLENBQUMsQ0FBQztJQUNkLFFBQVEsR0FBVyxDQUFDLENBQUM7SUFFckI7OENBQzBDO0lBQzFDLEtBQUssR0FBRyxJQUFJLEtBQUssQ0FBQyxJQUFJLEVBQUUsSUFBSSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FB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byBjb21wdXRlIGFuZCBjYW4gYmUga Line truncated
@@ -0,0 +1,110 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureRegion } from "../Texture.js";
import { Color, NumberArrayLike } from "../Utils.js";
import { Attachment } from "./Attachment.js";
import { HasTextureRegion } from "./HasTextureRegion.js";
import { Sequence } from "./Sequence.js";
import { Slot } from "../Slot.js";
/** An attachment that displays a textured quadrilateral.
*
* See [Region attachments](http://esotericsoftware.com/spine-regions) in the Spine User Guide. */
export declare class RegionAttachment extends Attachment implements HasTextureRegion {
/** The local x translation. */
x: number;
/** The local y translation. */
y: number;
/** The local scaleX. */
scaleX: number;
/** The local scaleY. */
scaleY: number;
/** The local rotation. */
rotation: number;
/** The width of the region attachment in Spine. */
width: number;
/** The height of the region attachment in Spine. */
height: number;
/** The color to tint the region attachment. */
color: Color;
/** The name of the texture region for this attachment. */
path: string;
region: TextureRegion | null;
sequence: Sequence | null;
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
*
* See {@link #updateOffset()}. */
offset: NumberArrayLike;
uvs: NumberArrayLike;
tempColor: Color;
constructor(name: string, path: string);
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
updateRegion(): void;
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
* be changed.
* <p>
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
* Runtimes Guide.
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
* @param offset The <code>worldVertices</code> index to begin writing values.
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
computeWorldVertices(slot: Slot, worldVertices: NumberArrayLike, offset: number, stride: number): void;
copy(): Attachment;
static X1: number;
static Y1: number;
static C1R: number;
static C1G: number;
static C1B: number;
static C1A: number;
static U1: number;
static V1: number;
static X2: number;
static Y2: number;
static C2R: number;
static C2G: number;
static C2B: number;
static C2A: number;
static U2: number;
static V2: number;
static X3: number;
static Y3: number;
static C3R: number;
static C3G: number;
static C3B: number;
static C3A: number;
static U3: number;
static V3: number;
static X4: number;
static Y4: number;
static C4R: number;
static C4G: number;
static C4B: number;
static C4A: number;
static U4: number;
static V4: number;
}
@@ -0,0 +1,215 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Color, MathUtils, Utils } from "../Utils.js";
import { Attachment } from "./Attachment.js";
/** An attachment that displays a textured quadrilateral.
*
* See [Region attachments](http://esotericsoftware.com/spine-regions) in the Spine User Guide. */
export class RegionAttachment extends Attachment {
/** The local x translation. */
x = 0;
/** The local y translation. */
y = 0;
/** The local scaleX. */
scaleX = 1;
/** The local scaleY. */
scaleY = 1;
/** The local rotation. */
rotation = 0;
/** The width of the region attachment in Spine. */
width = 0;
/** The height of the region attachment in Spine. */
height = 0;
/** The color to tint the region attachment. */
color = new Color(1, 1, 1, 1);
/** The name of the texture region for this attachment. */
path;
region = null;
sequence = null;
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
*
* See {@link #updateOffset()}. */
offset = Utils.newFloatArray(8);
uvs = Utils.newFloatArray(8);
tempColor = new Color(1, 1, 1, 1);
constructor(name, path) {
super(name);
this.path = path;
}
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
updateRegion() {
if (!this.region)
throw new Error("Region not set.");
let region = this.region;
let uvs = this.uvs;
if (region == null) {
uvs[0] = 0;
uvs[1] = 0;
uvs[2] = 0;
uvs[3] = 1;
uvs[4] = 1;
uvs[5] = 1;
uvs[6] = 1;
uvs[7] = 0;
return;
}
let regionScaleX = this.width / this.region.originalWidth * this.scaleX;
let regionScaleY = this.height / this.region.originalHeight * this.scaleY;
let localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX;
let localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
let localX2 = localX + this.region.width * regionScaleX;
let localY2 = localY + this.region.height * regionScaleY;
let radians = this.rotation * MathUtils.degRad;
let cos = Math.cos(radians);
let sin = Math.sin(radians);
let x = this.x, y = this.y;
let localXCos = localX * cos + x;
let localXSin = localX * sin;
let localYCos = localY * cos + y;
let localYSin = localY * sin;
let localX2Cos = localX2 * cos + x;
let localX2Sin = localX2 * sin;
let localY2Cos = localY2 * cos + y;
let localY2Sin = localY2 * sin;
let offset = this.offset;
offset[0] = localXCos - localYSin;
offset[1] = localYCos + localXSin;
offset[2] = localXCos - localY2Sin;
offset[3] = localY2Cos + localXSin;
offset[4] = localX2Cos - localY2Sin;
offset[5] = localY2Cos + localX2Sin;
offset[6] = localX2Cos - localYSin;
offset[7] = localYCos + localX2Sin;
if (region.degrees == 90) {
uvs[0] = region.u2;
uvs[1] = region.v2;
uvs[2] = region.u;
uvs[3] = region.v2;
uvs[4] = region.u;
uvs[5] = region.v;
uvs[6] = region.u2;
uvs[7] = region.v;
}
else {
uvs[0] = region.u;
uvs[1] = region.v2;
uvs[2] = region.u;
uvs[3] = region.v;
uvs[4] = region.u2;
uvs[5] = region.v;
uvs[6] = region.u2;
uvs[7] = region.v2;
}
}
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
* be changed.
* <p>
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
* Runtimes Guide.
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
* @param offset The <code>worldVertices</code> index to begin writing values.
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
computeWorldVertices(slot, worldVertices, offset, stride) {
if (this.sequence != null)
this.sequence.apply(slot, this);
let bone = slot.bone;
let vertexOffset = this.offset;
let x = bone.worldX, y = bone.worldY;
let a = bone.a, b = bone.b, c = bone.c, d = bone.d;
let offsetX = 0, offsetY = 0;
offsetX = vertexOffset[0];
offsetY = vertexOffset[1];
worldVertices[offset] = offsetX * a + offsetY * b + x; // br
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
offset += stride;
offsetX = vertexOffset[2];
offsetY = vertexOffset[3];
worldVertices[offset] = offsetX * a + offsetY * b + x; // bl
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
offset += stride;
offsetX = vertexOffset[4];
offsetY = vertexOffset[5];
worldVertices[offset] = offsetX * a + offsetY * b + x; // ul
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
offset += stride;
offsetX = vertexOffset[6];
offsetY = vertexOffset[7];
worldVertices[offset] = offsetX * a + offsetY * b + x; // ur
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}
copy() {
let copy = new RegionAttachment(this.name, this.path);
copy.region = this.region;
copy.x = this.x;
copy.y = this.y;
copy.scaleX = this.scaleX;
copy.scaleY = this.scaleY;
copy.rotation = this.rotation;
copy.width = this.width;
copy.height = this.height;
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
copy.color.setFromColor(this.color);
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
return copy;
}
static X1 = 0;
static Y1 = 1;
static C1R = 2;
static C1G = 3;
static C1B = 4;
static C1A = 5;
static U1 = 6;
static V1 = 7;
static X2 = 8;
static Y2 = 9;
static C2R = 10;
static C2G = 11;
static C2B = 12;
static C2A = 13;
static U2 = 14;
static V2 = 15;
static X3 = 16;
static Y3 = 17;
static C3R = 18;
static C3G = 19;
static C3B = 20;
static C3A = 21;
static U3 = 22;
static V3 = 23;
static X4 = 24;
static Y4 = 25;
static C4R = 26;
static C4G = 27;
static C4B = 28;
static C4A = 29;
static U4 = 30;
static V4 = 31;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaW9uQXR0YWNobWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hdHRhY2htZW50cy9SZWdpb25BdHRhY2htZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7K0VBMkIrRTtBQUkvRSxPQUFPLEVBQUUsS0FBSyxFQUFFLFNBQVMsRUFBbUIsS0FBSyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ3ZFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUs3Qzs7a0dBRWtHO0FBQ2xHLE1BQU0sT0FBTyxnQkFBaUIsU0FBUSxVQUFVO0lBQy9DLCtCQUErQjtJQUMvQixDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRU4sK0JBQStCO0lBQy9CLENBQUMsR0FBRyxDQUFDLENBQUM7SUFFTix3QkFBd0I7SUFDeEIsTUFBTSxHQUFHLENBQUMsQ0FBQztJQUVYLHdCQUF3QjtJQUN4QixNQUFNLEdBQUcsQ0FBQyxDQUFDO0lBRVgsMEJBQTBCO0lBQzFCLFFBQVEsR0FBRyxDQUFDL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FDLENBQUMsQ0FBQyxHQUFHLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDbkIsQ0FBQzthQUFNLENBQUM7WUFDUCxHQ Line truncated
@@ -0,0 +1,55 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { TextureRegion } from "../Texture.js";
import { Slot } from "../Slot.js";
import { HasTextureRegion } from "./HasTextureRegion.js";
export declare class Sequence {
private static _nextID;
id: number;
regions: TextureRegion[];
start: number;
digits: number;
/** The index of the region to show for the setup pose. */
setupIndex: number;
constructor(count: number);
copy(): Sequence;
apply(slot: Slot, attachment: HasTextureRegion): void;
getPath(basePath: string, index: number): string;
private static nextID;
}
export declare enum SequenceMode {
hold = 0,
once = 1,
loop = 2,
pingpong = 3,
onceReverse = 4,
loopReverse = 5,
pingpongReverse = 6
}
export declare const SequenceModeValues: SequenceMode[];
+92
View File
@@ -0,0 +1,92 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
import { Utils } from "../Utils.js";
export class Sequence {
static _nextID = 0;
id = Sequence.nextID();
regions;
start = 0;
digits = 0;
/** The index of the region to show for the setup pose. */
setupIndex = 0;
constructor(count) {
this.regions = new Array(count);
}
copy() {
let copy = new Sequence(this.regions.length);
Utils.arrayCopy(this.regions, 0, copy.regions, 0, this.regions.length);
copy.start = this.start;
copy.digits = this.digits;
copy.setupIndex = this.setupIndex;
return copy;
}
apply(slot, attachment) {
let index = slot.sequenceIndex;
if (index == -1)
index = this.setupIndex;
if (index >= this.regions.length)
index = this.regions.length - 1;
let region = this.regions[index];
if (attachment.region != region) {
attachment.region = region;
attachment.updateRegion();
}
}
getPath(basePath, index) {
let result = basePath;
let frame = (this.start + index).toString();
for (let i = this.digits - frame.length; i > 0; i--)
result += "0";
result += frame;
return result;
}
static nextID() {
return Sequence._nextID++;
}
}
export var SequenceMode;
(function (SequenceMode) {
SequenceMode[SequenceMode["hold"] = 0] = "hold";
SequenceMode[SequenceMode["once"] = 1] = "once";
SequenceMode[SequenceMode["loop"] = 2] = "loop";
SequenceMode[SequenceMode["pingpong"] = 3] = "pingpong";
SequenceMode[SequenceMode["onceReverse"] = 4] = "onceReverse";
SequenceMode[SequenceMode["loopReverse"] = 5] = "loopReverse";
SequenceMode[SequenceMode["pingpongReverse"] = 6] = "pingpongReverse";
})(SequenceMode || (SequenceMode = {}));
export const SequenceModeValues = [
SequenceMode.hold,
SequenceMode.once,
SequenceMode.loop,
SequenceMode.pingpong,
SequenceMode.onceReverse,
SequenceMode.loopReverse,
SequenceMode.pingpongReverse
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2VxdWVuY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXR0YWNobWVudHMvU2VxdWVuY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7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1IgQ09OU0VRVUVOVElBTCBEQU1BR0VTXG4gKiAoSU5DTFVESU5HLCBCVVQgTk9UIExJTUlURUQgVE8sIFBST0NVUkVNRU5UIE9GIFNVQlNUSVRVVEUgR09PRFMgT1IgU0VSVklDRVMsXG4gKiBCVVNJTkVTUyBJTlRFUlJVUFRJT04sIE9SIExPU1MgT0YgVVNFLCBEQVRBLCBPUiBQUk9GSVRTKSBIT1dFVkVSIENBVVNFRCBBTkRcbiAqIE9OIEFOWSBUSEVPUlkgT0YgTElBQklMSVRZLCBXSEVUSEVSIElOIENPTlRSQUNULCBTVFJJQ1QgTElBQklMSVRZLCBPUiBUT1JUXG4gKiAoSU5DTFVESU5HIE5FR0xJR0VOQ0UgT1IgT1RIRVJXSVNFKSBBUklTSU5HIElOIEFOWSBXQVkgT1VUIE9GIFRIRSBVU0UgT0ZcbiAqIFRIRSBTUElORSBSVU5USU1FUywgRVZFTiBJRiBBRFZJU0VEIE9GIFRIRSBQT1NTSUJJTElUWSBPRiBTV Line truncated
@@ -0,0 +1,8 @@
export * from './Attachment.js';
export * from './AttachmentLoader.js';
export * from './BoundingBoxAttachment.js';
export * from './ClippingAttachment.js';
export * from './MeshAttachment.js';
export * from './PathAttachment.js';
export * from './PointAttachment.js';
export * from './RegionAttachment.js';
+9
View File
@@ -0,0 +1,9 @@
export * from './Attachment.js';
export * from './AttachmentLoader.js';
export * from './BoundingBoxAttachment.js';
export * from './ClippingAttachment.js';
export * from './MeshAttachment.js';
export * from './PathAttachment.js';
export * from './PointAttachment.js';
export * from './RegionAttachment.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXR0YWNobWVudHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsNEJBQTRCLENBQUM7QUFDM0MsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLHVCQUF1QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9BdHRhY2htZW50LmpzJztcbmV4cG9ydCAqIGZyb20gJy4vQXR0YWNobWVudExvYWRlci5qcyc7XG5leHBvcnQgKiBmcm9tICcuL0JvdW5kaW5nQm94QXR0YWNobWVudC5qcyc7XG5leHBvcnQgKiBmcm9tICcuL0NsaXBwaW5nQXR0YWNobWVudC5qcyc7XG5leHBvcnQgKiBmcm9tICcuL01lc2hBdHRhY2htZW50LmpzJztcbmV4cG9ydCAqIGZyb20gJy4vUGF0aEF0dGFjaG1lbnQuanMnO1xuZXhwb3J0ICogZnJvbSAnLi9Qb2ludEF0dGFjaG1lbnQuanMnO1xuZXhwb3J0ICogZnJvbSAnLi9SZWdpb25BdHRhY2htZW50LmpzJztcbiJdfQ==
@@ -0,0 +1,2 @@
"use strict";var Bs=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},zt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},q=class mt{constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}static WHITE=new mt(1,1,1,1);static RED=new mt(1,0,0,1);static GREEN=new mt(0,1,0,1);static BLUE=new mt(0,0,1,1);static MAGENTA=new mt(1,0,1,1);set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new mt){return s.setFromString(e)}},R=class nt{static PI=3.1415927;static PI2=nt.PI*2;static invPI2=1/nt.PI2;static radiansToDegrees=180/nt.PI;static radDeg=nt.radiansToDegrees;static degreesToRadians=nt.PI/180;static degRad=nt.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*nt.degRad)}static sinDeg(e){return Math.sin(e*nt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*nt.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return nt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),h=s-e;return r<=(i-e)/h?e+Math.sqrt(r*h*(i-e)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Qe=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ze=class extends Qe{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Vs=class extends Ze{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class bt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,h){for(let o=s,a=r;o<s+h;o++,a++)i[a]=e[o]}static arrayFill(e,s,i,r){for(let h=s;h<i;h++)e[h]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let h=r;h<s;h++)e[h]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:bt.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(bt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return bt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return bt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Ls=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},vt=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Yt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ns=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTiLine truncated
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof ke){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new ke(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},gs=class Ot{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ot.AVAILABLE_CACHES.get(e);if(s)return s;const i=new Ot;return Ot.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},xs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},Fe=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Ee=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ws=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,h,o){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,f=a.d,d=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*R.signum(t.skeleton.scaleX),u=(s-t.worldY)*R.signum(t.skeleton.scaleY);break;case 2:let p=Math.abs(n*f-l*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*p*t.skeleton.scaleX,f=g*p*t.skeleton.scaleY,d+=Math.atan2(x,g)*R.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0) Line truncated
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/Utils.ts", "../../src/attachments/Attachment.ts", "../../src/attachments/Sequence.ts", "../../src/Animation.ts", "../../src/AnimationState.ts", "../../src/AnimationStateData.ts", "../../src/attachments/BoundingBoxAttachment.ts", "../../src/attachments/ClippingAttachment.ts", "../../src/Texture.ts", "../../src/TextureAtlas.ts", "../../src/attachments/MeshAttachment.ts", "../../src/attachments/PathAttachment.ts", "../../src/attachments/PointAttachment.ts", "../../src/attachments/RegionAttachment.ts", "../../src/AtlasAttachmentLoader.ts", "../../src/BoneData.ts", "../../src/Bone.ts", "../../src/ConstraintData.ts", "../../src/AssetManagerBase.ts", "../../src/Event.ts", "../../src/EventData.ts", "../../src/IkConstraint.ts", "../../src/IkConstraintData.ts", "../../src/PathConstraintData.ts", "../../src/PathConstraint.ts", "../../src/PhysicsConstraint.ts", "../../src/Slot.ts", "../../src/TransformConstraint.ts", "../../src/Skeleton.ts", "../../src/PhysicsConstraintData.ts", "../../src/SkeletonData.ts", "../../src/Skin.ts", "../../src/SlotData.ts", "../../src/TransformConstraintData.ts", "../../src/SkeletonBinary.ts", "../../src/SkeletonBounds.ts", "../../src/Triangulator.ts", "../../src/SkeletonClipping.ts", "../../src/SkeletonJson.ts", "../../src/polyfills.ts"],
"sourcesContent": ["/******************************************************************************\n * Spine Runtimes License Agreement\n * Last updated April 5, 2025. Replaces all prior versions.\n *\n * Copyright (c) 2013-2025, Esoteric Software LLC\n *\n * Integration of the Spine Runtimes into software or otherwise creating\n * derivative works of the Spine Runtimes is permitted under the terms and\n * conditions of Section 2 of the Spine Editor License Agreement:\n * http://esotericsoftware.com/spine-editor-license\n *\n * Otherwise, it is permitted to integrate the Spine Runtimes into software\n * or otherwise create derivative works of the Spine Runtimes (collectively,\n * \"Products\"), provided that each user of the Products must obtain their own\n * Spine Editor license and redistribution of the Products in any form must\n * include this license and copyright notice.\n *\n * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,\n * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *****************************************************************************/\n\nimport { Skeleton } from \"./Skeleton.js\";\nimport { MixBlend } from \"./Animation.js\";\n\nexport interface StringMap<T> {\n\t[key: string]: T;\n}\n\nexport class IntSet {\n\tarray = new Array<number | undefined>();\n\n\tadd (value: number): boolean {\n\t\tlet contains = this.contains(value);\n\t\tthis.array[value | 0] = value | 0;\n\t\treturn !contains;\n\t}\n\n\tcontains (value: number) {\n\t\treturn this.array[value | 0] != undefined;\n\t}\n\n\tremove (value: number) {\n\t\tthis.array[value | 0] = undefined;\n\t}\n\n\tclear () {\n\t\tthis.array.length = 0;\n\t}\n}\n\nexport class StringSet {\n\tentries: StringMap<boolean> = {};\n\tsize = 0;\n\n\tadd (value: string): boolean {\n\t\tlet contains = this.entries[value];\n\t\tthis.entries[value] = true;\n\t\tif (!contains) {\n\t\t\tthis.size++;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\taddAll (values: string[]): boolean {\n\t\tlet oldSize = this.size;\n\t\tfor (var i = 0, n = values.length; i < n; i++)\n\t\t\tthis.add(values[i]);\n\t\treturn oldSize != this.size;\n\t}\n\n\tcontains (value: string) {\n\t\treturn this.entries[value];\n\t}\n\n\tclear () {\n\t\tthis.entries = {};\n\t\tthis.size = 0;\n\t}\n}\n\nexport type NumberArrayLike = Array<number> | Float32Array;\nexport type IntArrayLike = Array<number> | Int16Array;\n\nexport interface Disposable {\n\tdispose (): void;\n}\n\nexport interface Restorable {\n\trestore (): void;\n}\n\nexport class Color {\n\tpublic static WHITE = new Color(1, 1, 1, 1);\n\tpublic static RED = new Color(1, 0, 0, 1);\n\tpublic static GREEN = new Color(0, 1, 0, 1);\n\tpublic static BLUE = new Color(0, 0, 1, 1);\n\tpublic static MAGENTA = new Color(1, 0, 1, 1);\n\n\tconstructor (public r: number = 0, public g: number = 0, public b: number = 0, public a: number = 0) {\n\t}\n\n\tset (r: number, g: number, b: number, a: number) {\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\t\tthis.a = a;\n\t\treturn this.clamp();\n\t}\n\n\tsetFromColor (c: Color) {\n\t\tthis.r = c.r;\n\t\tthis.g = c.g;\n\t\tthis.b = c.b;\n\t\tthis.a = c.a;\n\t\treturn this;\n\t}\n\n\tsetFromString (hex: string) {\n\t\thex = hex.charAt(0) == '#' ? hex.substr(1) : hex;\n\t\tthis.r = parseInt(hex.substr(0, 2), 16) / 255;\n\t\tthis.g = parseInt(hex.substr(2, 2), 16) / 255;\n\t\tthis.b = parseInt(hex.substr(4, 2), 16) / 255;\n\t\tthis.a = hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255;\n\t\treturn this;\n\t}\n\n\tadd (r: number, g: number, b: number, a: number) {\n\t\tthis.r += r;\n\t\tthis.g += g;\n\t\tthis.b += b;\n\t\tthis.a += a;\n\t\treturn this.clamp();\n\t}\n\n\tclamp () {\n\t\tif (this.r < 0) this.r = 0;\n\t\telse if (this.r > 1) this.r = 1;\n\n\t\tif (this.g < 0) this.g = 0;\n\t\telse if (this.g > 1) this.g = 1;\n\n\t\tif (this.b < 0) this.b = 0;\n\t\telse if (this.b > 1) this.b = 1;\n\n\t\tif (this.a < 0) this.a = 0;\n\t\telse if (this.a > 1) this.a = 1;\n\t\treturn this;\n\t}\n\n\tstatic rgba8888ToColor (color: Color, value: number) {\n\t\tcolor.r = ((value & 0xff000000) >>> 24) / 255;\n\t\tcolor.g = ((value & 0x00ff0000) >>> 16) / 255;\n\t\tcolor.b = ((value & 0x0000ff00) >>> 8) / 255;\n\t\tcolor.a = ((value & 0x000000ff)) / 255;\n\t}\n\n\tstatic rgb888ToColor (color: Color, value: number) {\n\t\tcoLine truncated
"mappings": ";AAoCO,IAAM,SAAN,MAAa;AAAA,EACnB,QAAQ,IAAI,MAA0B;AAAA,EAEtC,IAAK,OAAwB;AAC5B,QAAI,WAAW,KAAK,SAAS,KAAK;AAClC,SAAK,MAAM,QAAQ,CAAC,IAAI,QAAQ;AAChC,WAAO,CAAC;AAAA,EACT;AAAA,EAEA,SAAU,OAAe;AACxB,WAAO,KAAK,MAAM,QAAQ,CAAC,KAAK;AAAA,EACjC;AAAA,EAEA,OAAQ,OAAe;AACtB,SAAK,MAAM,QAAQ,CAAC,IAAI;AAAA,EACzB;AAAA,EAEA,QAAS;AACR,SAAK,MAAM,SAAS;AAAA,EACrB;AACD;AAEO,IAAM,YAAN,MAAgB;AAAA,EACtB,UAA8B,CAAC;AAAA,EAC/B,OAAO;AAAA,EAEP,IAAK,OAAwB;AAC5B,QAAI,WAAW,KAAK,QAAQ,KAAK;AACjC,SAAK,QAAQ,KAAK,IAAI;AACtB,QAAI,CAAC,UAAU;AACd,WAAK;AACL,aAAO;AAAA,IACR;AACA,WAAO;AAAA,EACR;AAAA,EAEA,OAAQ,QAA2B;AAClC,QAAI,UAAU,KAAK;AACnB,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,IAAI,GAAG;AACzC,WAAK,IAAI,OAAO,CAAC,CAAC;AACnB,WAAO,WAAW,KAA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,OAAqB,WAAmB,SAAiB,OAAU;AACvF,aAAS,IAAI,WAAW,IAAI,SAAS;AACpC,YAAM,CAAC,IAAI;AAAA,EACb;AAAA,EAEA,OAAO,aAAiB,OAAiB,MAAc,QAAa,GAAa;AAChF,QAAI,UAALine truncated
"names": ["v", "SequenceMode", "MixBlend", "MixDirection", "x", "y", "i", "vertexAttachment", "constraint", "i", "n", "timeline", "EventType", "TextureFilter", "TextureWrap", "page", "Inherit", "s", "PositionMode", "SpacingMode", "RotateMode", "closed", "pathLength", "multiplier", "Physics", "BlendMode", "closed", "n", "LinkedMesh", "readTimeline1", "readTimeline2", "timeline"]
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/index.ts", "../../src/Utils.ts", "../../src/attachments/Attachment.ts", "../../src/attachments/Sequence.ts", "../../src/Animation.ts", "../../src/AnimationState.ts", "../../src/AnimationStateData.ts", "../../src/attachments/BoundingBoxAttachment.ts", "../../src/attachments/ClippingAttachment.ts", "../../src/Texture.ts", "../../src/TextureAtlas.ts", "../../src/attachments/MeshAttachment.ts", "../../src/attachments/PathAttachment.ts", "../../src/attachments/PointAttachment.ts", "../../src/attachments/RegionAttachment.ts", "../../src/AtlasAttachmentLoader.ts", "../../src/BoneData.ts", "../../src/Bone.ts", "../../src/ConstraintData.ts", "../../src/AssetManagerBase.ts", "../../src/Event.ts", "../../src/EventData.ts", "../../src/IkConstraint.ts", "../../src/IkConstraintData.ts", "../../src/PathConstraintData.ts", "../../src/PathConstraint.ts", "../../src/PhysicsConstraint.ts", "../../src/Slot.ts", "../../src/TransformConstraint.ts", "../../src/Skeleton.ts", "../../src/PhysicsConstraintData.ts", "../../src/SkeletonData.ts", "../../src/Skin.ts", "../../src/SlotData.ts", "../../src/TransformConstraintData.ts", "../../src/SkeletonBinary.ts", "../../src/SkeletonBounds.ts", "../../src/Triangulator.ts", "../../src/SkeletonClipping.ts", "../../src/SkeletonJson.ts", "../../src/polyfills.ts"],
"sourcesContent": ["export * from './Animation.js';\nexport * from './AnimationState.js';\nexport * from './AnimationStateData.js';\nexport * from './AtlasAttachmentLoader.js';\nexport * from './Bone.js';\nexport * from './BoneData.js';\nexport * from './ConstraintData.js';\nexport * from './AssetManagerBase.js';\nexport * from './Event.js';\nexport * from './EventData.js';\nexport * from './IkConstraint.js';\nexport * from './IkConstraintData.js';\nexport * from './PathConstraint.js';\nexport * from './PathConstraintData.js';\nexport * from './Skeleton.js';\nexport * from './SkeletonBinary.js';\nexport * from './SkeletonBounds.js';\nexport * from './SkeletonClipping.js';\nexport * from './SkeletonData.js';\nexport * from './SkeletonJson.js';\nexport * from './Skin.js';\nexport * from './Slot.js';\nexport * from './SlotData.js';\nexport * from './Texture.js';\nexport * from './TextureAtlas.js';\nexport * from './TransformConstraint.js';\nexport * from './TransformConstraintData.js';\nexport * from './Triangulator.js';\nexport * from './Updatable.js';\nexport * from './Utils.js';\nexport * from './polyfills.js';\nexport * from './attachments/Attachment.js';\nexport * from './attachments/AttachmentLoader.js';\nexport * from './attachments/BoundingBoxAttachment.js';\nexport * from './attachments/ClippingAttachment.js';\nexport * from './attachments/MeshAttachment.js';\nexport * from './attachments/PathAttachment.js';\nexport * from './attachments/PointAttachment.js';\nexport * from './attachments/RegionAttachment.js';\n", "/******************************************************************************\n * Spine Runtimes License Agreement\n * Last updated April 5, 2025. Replaces all prior versions.\n *\n * Copyright (c) 2013-2025, Esoteric Software LLC\n *\n * Integration of the Spine Runtimes into software or otherwise creating\n * derivative works of the Spine Runtimes is permitted under the terms and\n * conditions of Section 2 of the Spine Editor License Agreement:\n * http://esotericsoftware.com/spine-editor-license\n *\n * Otherwise, it is permitted to integrate the Spine Runtimes into software\n * or otherwise create derivative works of the Spine Runtimes (collectively,\n * \"Products\"), provided that each user of the Products must obtain their own\n * Spine Editor license and redistribution of the Products in any form must\n * include this license and copyright notice.\n *\n * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,\n * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *****************************************************************************/\n\nimport { Skeleton } from \"./Skeleton.js\";\nimport { MixBlend } from \"./Animation.js\";\n\nexport interface StringMap<T> {\n\t[key: string]: T;\n}\n\nexport class IntSet {\n\tarray = new Array<number | undefined>();\n\n\tadd (value: number): boolean {\n\t\tlet contains = this.contains(value);\n\t\tthis.array[value | 0] = value | 0;\n\t\treturn !contains;\n\t}\n\n\tcontains (value: number) {\n\t\treturn this.array[value | 0] != undefined;\n\t}\n\n\tremove (value: number) {\n\t\tthis.array[value | 0] = undefined;\n\t}\n\n\tclear () {\n\t\tthis.array.length = 0;\n\t}\n}\n\nexport class StringSet {\n\tentries: StringMap<boolean> = {};\n\tsize = 0;\n\n\tadd (value: string): boolean {\n\t\tlet contains = this.entries[value];\n\t\tthis.entries[value] = true;\n\t\tif (!contains) {\n\t\t\tthis.size++;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\taddAll (values: string[]): boolean {\n\t\tlet oldSize = this.size;\n\t\tfor (var i = 0, n = values.length; i < n; i++)\n\t\t\tthis.add(values[i]);\n\t\treturn oldSize != this.size;\n\t}\n\n\tcontains (value: string) {\n\t\treturn this.entries[value];\n\t}\n\n\tclear () {\n\t\tthis.entries = {};\n\t\tthis.size = 0;\n\t}\n}\n\nexport type NumberArrayLike = Array<number> | Float32Array;\nexport type IntArrayLike = Array<number> | Int16Array;\n\nexport interface Disposable {\n\tdispose (): void;\n}\n\nexport interface Restorable {\n\trestore (): void;\n}\n\nexport class Color {\n\tpublic static WHITE = new Color(1, 1, 1, 1);\n\tpublic static RED = new Color(1, 0, 0, 1);\n\tpublic static GREEN = new Color(0, 1, 0, 1);\n\tpublic static BLUE = new Color(0, 0, 1, 1);\n\tpublic static MAGENTA = new Color(1, 0, 1, 1);\n\n\tconstructor (public r: numbeLine truncated
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoCO,MAA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EO,MAAM,MAAN,cAAkB,cAAc;AAAA,IAC5B,QAAQ;AAAA,IAElB,YAAa,OAAe;AAC3B,YAAM;AACN,WAAK,QAAQ;AAAA,IACd;AAAA,IAEA,cAAe,GAAmB;AACjC,UAAI,KAAK,IAAK,QAAO,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,IAAI;AACnD,aAAO,KAAK,Line truncated
"names": ["v", "SequenceMode", "MixBlend", "MixDirection", "x", "y", "i", "vertexAttachment", "constraint", "i", "n", "timeline", "EventType", "TextureFilter", "TextureWrap", "page", "Inherit", "s", "PositionMode", "SpacingMode", "RotateMode", "closed", "pathLength", "multiplier", "Physics", "BlendMode", "closed", "n", "LinkedMesh", "readTimeline1", "readTimeline2", "timeline"]
}
@@ -0,0 +1,2 @@
"use strict";var spine=(()=>{var qe=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,Ds=Object.getOwnPropertyNames,Ns=Object.prototype.hasOwnProperty,Os=(e,t)=>{for(var s in t)qe(e,s,{get:t[s],enumerable:!0})},qs=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ds(t))!Ns.call(e,r)&&r!==s&&qe(e,r,{get:()=>t[r],enumerable:!(i=Ls(t,r))||i.enumerable});return e},Us=e=>qs(qe({},"__esModule",{value:!0}),e),jt={};Os(jt,{AlphaTimeline:()=>st,Animation:()=>Te,AnimationState:()=>$s,AnimationStateAdapter:()=>js,AnimationStateData:()=>Js,AssetCache:()=>us,AssetManagerBase:()=>ei,AtlasAttachmentLoader:()=>Zs,Attachment:()=>We,AttachmentTimeline:()=>ue,BinaryInput:()=>As,BlendMode:()=>Ot,Bone:()=>Yt,BoneData:()=>Mt,BoundingBoxAttachment:()=>St,CURRENT:()=>ls,ClippingAttachment:()=>Ct,Color:()=>q,ConstraintData:()=>Ae,CurveTimeline:()=>ie,CurveTimeline1:()=>se,CurveTimeline2:()=>ke,DebugUtils:()=>_s,DeformTimeline:()=>nt,Downloader:()=>ms,DrawOrderTimeline:()=>ge,Event:()=>Xt,EventData:()=>Ft,EventQueue:()=>rs,EventTimeline:()=>Me,EventType:()=>ns,FIRST:()=>yt,FakeTexture:()=>Ks,HOLD_FIRST:()=>Xe,HOLD_MIX:()=>as,HOLD_SUBSEQUENT:()=>vt,IkConstraint:()=>gs,IkConstraintData:()=>Et,IkConstraintTimeline:()=>at,Inherit:()=>Re,InheritTimeline:()=>Ze,IntSet:()=>Ws,Interpolation:()=>Jt,MathUtils:()=>R,MeshAttachment:()=>Ee,MixBlend:()=>ts,MixDirection:()=>ss,PathAttachment:()=>ve,PathConstraint:()=>xs,PathConstraintData:()=>Rt,PathConstraintMixTimeline:()=>ct,PathConstraintPositionTimeline:()=>ot,PathConstraintSpacingTimeline:()=>ht,Physics:()=>ys,PhysicsConstraintDampingTimeline:()=>ut,PhysicsConstraintGravityTimeline:()=>xt,PhysicsConstraintInertiaTimeline:()=>dt,PhysicsConstraintMassTimeline:()=>mt,PhysicsConstraintMixTimeline:()=>wt,PhysicsConstraintResetTimeline:()=>bt,PhysicsConstraintStrengthTimeline:()=>ft,PhysicsConstraintTimeline:()=>ce,PhysicsConstraintWindTimeline:()=>gt,PointAttachment:()=>fs,Pool:()=>pe,PositionMode:()=>Pt,Pow:()=>Kt,PowOut:()=>zs,RGB2Timeline:()=>rt,RGBA2Timeline:()=>it,RGBATimeline:()=>et,RGBTimeline:()=>tt,RegionAttachment:()=>kt,RotateMode:()=>Vt,RotateTimeline:()=>ye,SETUP:()=>At,SUBSEQUENT:()=>Ye,ScaleTimeline:()=>He,ScaleXTimeline:()=>$e,ScaleYTimeline:()=>je,SequenceTimeline:()=>pt,ShearTimeline:()=>Je,ShearXTimeline:()=>Ke,ShearYTimeline:()=>Qe,Skeleton:()=>ps,SkeletonBinary:()=>si,SkeletonBounds:()=>Bi,SkeletonClipping:()=>Vi,SkeletonData:()=>Lt,SkeletonJson:()=>Li,Skin:()=>Pe,SkinEntry:()=>Dt,Slot:()=>ws,SlotData:()=>Nt,SpacingMode:()=>Bt,StringSet:()=>Ue,Texture:()=>os,TextureAtlas:()=>It,TextureAtlasPage:()=>ds,TextureAtlasRegion:()=>Tt,TextureFilter:()=>Fe,TextureRegion:()=>cs,TextureWrap:()=>hs,TimeKeeper:()=>Gs,Timeline:()=>$,TrackEntry:()=>is,TransformConstraint:()=>bs,TransformConstraintData:()=>qt,TransformConstraintTimeline:()=>lt,TranslateTimeline:()=>ze,TranslateXTimeline:()=>_e,TranslateYTimeline:()=>Ge,Triangulator:()=>Ss,Utils:()=>P,Vector2:()=>Ie,VertexAttachment:()=>le,WindowedMean:()=>Hs});var Ws=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ue=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},q=class me{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new me(1,1,1,1);static RED=new me(1,0,0,1);static GREEN=new me(0,1,0,1);static BLUE=new me(0,0,1,1);static MAGENTA=new me(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new me){return s.setFromString(t)}},R=class ae{static PI=3.1415927;static PI2=ae.PI*2;static invPI2=1/ae.PI2;static radiansToDegrees=180/ae.PI;static radDeg=ae.radiansToDegrees;static degreesToRadians=ae.PI/180;static degRad=ae.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*ae.degRad)}static sinDegLine truncated
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof It){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new It(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},us=class Oe{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=Oe.AVAILABLE_CACHES.get(t);if(s)return s;const i=new Oe;return Oe.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},ms=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let h=()=>{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},Xt=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Ft=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},gs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,h,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,f=n.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*R.signum(e.skeleton.scaleX),u=(s-e.worldY)*R.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(a*f-l*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;l=-x*p*e.skeleton.scaleX,f=g*p*e.skeleton.scaleY,d+=Math.atan2(x,g)*R.radDeg;default:let y=t-n.worldX,v=s-n.worldY,A=a*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0) Line truncated
+39
View File
@@ -0,0 +1,39 @@
export * from './Animation.js';
export * from './AnimationState.js';
export * from './AnimationStateData.js';
export * from './AtlasAttachmentLoader.js';
export * from './Bone.js';
export * from './BoneData.js';
export * from './ConstraintData.js';
export * from './AssetManagerBase.js';
export * from './Event.js';
export * from './EventData.js';
export * from './IkConstraint.js';
export * from './IkConstraintData.js';
export * from './PathConstraint.js';
export * from './PathConstraintData.js';
export * from './Skeleton.js';
export * from './SkeletonBinary.js';
export * from './SkeletonBounds.js';
export * from './SkeletonClipping.js';
export * from './SkeletonData.js';
export * from './SkeletonJson.js';
export * from './Skin.js';
export * from './Slot.js';
export * from './SlotData.js';
export * from './Texture.js';
export * from './TextureAtlas.js';
export * from './TransformConstraint.js';
export * from './TransformConstraintData.js';
export * from './Triangulator.js';
export * from './Updatable.js';
export * from './Utils.js';
export * from './polyfills.js';
export * from './attachments/Attachment.js';
export * from './attachments/AttachmentLoader.js';
export * from './attachments/BoundingBoxAttachment.js';
export * from './attachments/ClippingAttachment.js';
export * from './attachments/MeshAttachment.js';
export * from './attachments/PathAttachment.js';
export * from './attachments/PointAttachment.js';
export * from './attachments/RegionAttachment.js';
+40
View File
@@ -0,0 +1,40 @@
export * from './Animation.js';
export * from './AnimationState.js';
export * from './AnimationStateData.js';
export * from './AtlasAttachmentLoader.js';
export * from './Bone.js';
export * from './BoneData.js';
export * from './ConstraintData.js';
export * from './AssetManagerBase.js';
export * from './Event.js';
export * from './EventData.js';
export * from './IkConstraint.js';
export * from './IkConstraintData.js';
export * from './PathConstraint.js';
export * from './PathConstraintData.js';
export * from './Skeleton.js';
export * from './SkeletonBinary.js';
export * from './SkeletonBounds.js';
export * from './SkeletonClipping.js';
export * from './SkeletonData.js';
export * from './SkeletonJson.js';
export * from './Skin.js';
export * from './Slot.js';
export * from './SlotData.js';
export * from './Texture.js';
export * from './TextureAtlas.js';
export * from './TransformConstraint.js';
export * from './TransformConstraintData.js';
export * from './Triangulator.js';
export * from './Updatable.js';
export * from './Utils.js';
export * from './polyfills.js';
export * from './attachments/Attachment.js';
export * from './attachments/AttachmentLoader.js';
export * from './attachments/BoundingBoxAttachment.js';
export * from './attachments/ClippingAttachment.js';
export * from './attachments/MeshAttachment.js';
export * from './attachments/PathAttachment.js';
export * from './attachments/PointAttachment.js';
export * from './attachments/RegionAttachment.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxnQkFBZ0IsQ0FBQztBQUMvQixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHlCQUF5QixDQUFDO0FBQ3hDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjL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91bmRpbmdCb3hBdHRhY2htZW50LmpzJztcbmV4cG9ydCAqIGZyb20gJy4vYXR0YWNobWVudHMvQ2xpcHBpbmdBdHRhY2htZW50LmpzJztcbmV4cG9ydCAqIGZyb20gJy4vYXR0YWNobWVudHMvTWVzaEF0dGFjaG1lbnQuanMnO1xuZXhwb3J0ICogZnJvbSAnLi9hdHRhY2htZW50cy9QYXRoQXR0YWNobWVudC5qcyc7XG5leHBvcnQgKiBmcm9tICcuL2F0dGFjaG1lbnRzL1BvaW50QXR0YWNobWVudC5qcyc7XG5leHBvcnQgKiBmcm9tICcuL2F0dGFjaG1lbnRzL1JlZ2lvbkF0dGFjaG1lbnQuanMnO1xuIl19
+29
View File
@@ -0,0 +1,29 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
export {};
+39
View File
@@ -0,0 +1,39 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
(() => {
if (typeof Math.fround === "undefined") {
Math.fround = (function (array) {
return function (x) {
return array[0] = x, array[0];
};
})(new Float32Array(1));
}
})();
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9seWZpbGxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3BvbHlmaWxscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OytFQTJCK0U7QUFFL0UsQ0FBQyxHQUFHLEVBQUU7SUFDTCxJQUFJLE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxXQUFXLEVBQUUsQ0FBQztRQUN4QyxJQUFJLENBQUMsTUFBTSxHQUFHLENBQUMsVUFBVSxLQUFLO1lBQzdCLE9BQU8sVUFBVSxDQUFTO2dCQUN6QixPQUFPLEtBQUssQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLEVBQUUsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQy9CLENBQUMsQ0FBQztRQUNILENBQUMsQ0FBQyxDQUFDLElBQUksWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDekIsQ0FBQztBQUNGLENBQUMsQ0FBQyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4gKiBTcGluZSBSdW50aW1lcyBMaWNlbnNlIEFncmVlbWVudFxuICogTGFzdCB1cGRhdGVkIEFwcmlsIDUsIDIwMjUuIFJlcGxhY2VzIGFsbCBwcmlvciB2ZXJzaW9ucy5cbiAqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTMtMjAyNSwgRXNvdGVyaWMgU29mdHdhcmUgTExDXG4gKlxuICogSW50Z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Fx0XHRcdHJldHVybiBhcnJheVswXSA9IHgsIGFycmF5WzBdO1xuXHRcdFx0fTtcblx0XHR9KShuZXcgRmxvYXQzMkFycmF5KDEpKTtcblx0fVxufSkoKTtcblxuZXhwb3J0IHsgfVxuIl19
+33
View File
@@ -0,0 +1,33 @@
{
"name": "@esotericsoftware/spine-core",
"version": "4.2.120",
"description": "The official Spine Runtimes for the web.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"files": [
"dist/**/*",
"README.md",
"LICENSE"
],
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://github.com/esotericsoftware/spine-runtimes.git"
},
"keywords": [
"gamedev",
"animations",
"2d",
"spine",
"game-dev",
"runtimes",
"skeletal"
],
"author": "Esoteric Software LLC",
"license": "LicenseRef-LICENSE",
"bugs": {
"url": "https://github.com/esotericsoftware/spine-runtimes/issues"
},
"homepage": "https://github.com/esotericsoftware/spine-runtimes#readme"
}