[haxe] More documentation synchronization with reference implementation

This commit is contained in:
Mario Zechner 2025-05-22 22:11:12 +02:00
parent 6d6e85229a
commit 0c6788cd97
76 changed files with 511 additions and 352 deletions

View File

@ -70,17 +70,17 @@ class Bone implements Updatable {
public var ashearX:Float = 0;
/** The applied local shearY. */
public var ashearY:Float = 0;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
/** Part of the world transform matrix for the X axis. If changed, updateAppliedTransform() should be called. */
public var a:Float = 0;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
/** Part of the world transform matrix for the Y axis. If changed, updateAppliedTransform() should be called. */
public var b:Float = 0;
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
/** Part of the world transform matrix for the X axis. If changed, updateAppliedTransform() should be called. */
public var c:Float = 0;
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
/** Part of the world transform matrix for the Y axis. If changed, updateAppliedTransform() should be called. */
public var d:Float = 0;
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
/** The world X position. If changed, updateAppliedTransform() should be called. */
public var worldX:Float = 0;
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
/** The world Y position. If changed, updateAppliedTransform() should be called. */
public var worldY:Float = 0;
/** Determines how parent world transforms affect this bone. */
public var inherit:Inherit = Inherit.normal;
@ -115,7 +115,7 @@ class Bone implements Updatable {
return _children;
}
/** @param parent May be null. */
/** Copy constructor. Does not copy the children bones. */
public function new(data:BoneData, skeleton:Skeleton, parent:Bone) {
if (data == null)
throw new SpineException("data cannot be null.");
@ -138,7 +138,7 @@ class Bone implements Updatable {
/** Computes the world transform using the parent bone and this bone's local transform.
* <p>
* See {@link #updateWorldTransformWith(float, float, float, float, float, float, float)}. */
* See updateWorldTransformWith(). */
public function updateWorldTransform():Void {
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
}
@ -284,7 +284,7 @@ class Bone implements Updatable {
/** Computes the applied transform values from the world transform.
* <p>
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
* If the world transform is modified (by a constraint, rotateWorld(), 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 another
* constraint).
* <p>
@ -370,58 +370,49 @@ class Bone implements Updatable {
}
}
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
/** The world rotation for the X axis, calculated using a and c. */
public var worldRotationX(get, never):Float;
private function get_worldRotationX():Float {
return Math.atan2(c, a) * MathUtils.radDeg;
}
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
/** The world rotation for the Y axis, calculated using b and d. */
public var worldRotationY(get, never):Float;
private function get_worldRotationY():Float {
return Math.atan2(d, b) * MathUtils.radDeg;
}
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
/** The magnitude (always positive) of the world scale X, calculated using a and c. */
public var worldScaleX(get, never):Float;
private function get_worldScaleX():Float {
return Math.sqrt(a * a + c * c);
}
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
/** The magnitude (always positive) of the world scale Y, calculated using b and d. */
public var worldScaleY(get, never):Float;
private function get_worldScaleY():Float {
return Math.sqrt(b * b + d * d);
}
/** Transforms a point from world coordinates to the parent bone's local coordinates.
* @param world The world coordinates to transform.
* @return The transformed coordinates in the parent's local space.
*/
private function worldToParent(world: Array<Float>):Array<Float> {
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
public function worldToParent(world: Array<Float>):Array<Float> {
if (world == null)
throw new SpineException("world cannot be null.");
return parent == null ? world : parent.worldToLocal(world);
}
/** Transforms a point from the parent bone's coordinates to world coordinates.
* @param world The parent coordinates to transform.
* @return The transformed coordinates in world space.
*/
private function parentToWorld(world: Array<Float>):Array<Float> {
/** Transforms a point from the parent bone's coordinates to world coordinates. */
public function parentToWorld(world: Array<Float>):Array<Float> {
if (world == null)
throw new SpineException("world cannot be null.");
return parent == null ? world : parent.localToWorld(world);
}
/** Transforms a point from world coordinates to the bone's local coordinates.
* @param world The world coordinates to transform.
* @return The transformed coordinates in local space.
*/
/** Transforms a point from world coordinates to the bone's local coordinates. */
public function worldToLocal(world:Array<Float>):Array<Float> {
var a:Float = a, b:Float = b, c:Float = c, d:Float = d;
var invDet:Float = 1 / (a * d - b * c);
@ -431,10 +422,7 @@ class Bone implements Updatable {
return world;
}
/** Transforms a point from the bone's local coordinates to world coordinates.
* @param local The local coordinates to transform.
* @return The transformed coordinates in world space.
*/
/** Transforms a point from the bone's local coordinates to world coordinates. */
public function localToWorld(local:Array<Float>):Array<Float> {
var localX:Float = local[0], localY:Float = local[1];
local[0] = localX * a + localY * b + worldX;
@ -442,20 +430,14 @@ class Bone implements Updatable {
return local;
}
/** Transforms a world rotation to a local rotation.
* @param worldRotation The world rotation in degrees.
* @return The rotation in local space in degrees.
*/
/** Transforms a world rotation to a local rotation. */
public function worldToLocalRotation(worldRotation:Float):Float {
var sin:Float = MathUtils.sinDeg(worldRotation),
cos:Float = MathUtils.cosDeg(worldRotation);
return Math.atan2(a * sin - c * cos, d * cos - b * sin) * MathUtils.radDeg + rotation - shearX;
}
/** Transforms a local rotation to a world rotation.
* @param localRotation The local rotation in degrees.
* @return The rotation in world space in degrees.
*/
/** Transforms a local rotation to a world rotation. */
public function localToWorldRotation(localRotation:Float):Float {
localRotation -= rotation - shearX;
var sin:Float = MathUtils.sinDeg(localRotation),
@ -465,10 +447,8 @@ class Bone implements Updatable {
/** 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.
* @param degrees The rotation in degrees.
*/
* After changes are made to the world transform, updateAppliedTransform() should be called and
* update() will need to be called on any child bones, recursively. */
public function rotateWorld(degrees:Float):Void {
degrees *= MathUtils.degRad;
var sin:Float = Math.sin(degrees), cos:Float = Math.cos(degrees);

View File

@ -29,7 +29,7 @@
package spine;
/** Stores the setup pose for a {@link Bone}. */
/** Stores the setup pose for a spine.Bone. */
class BoneData {
private var _index:Int;
private var _name:String;
@ -53,10 +53,9 @@ class BoneData {
public var shearY:Float = 0;
/** Determines how parent world transforms affect this bone. */
public var inherit:Inherit = Inherit.normal;
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#getSkin()} contains
/** When true, spine.Skeleton.updateWorldTransform() only updates this bone if the spine.Skeleton.getSkin() contains
* this bone.
*
* See {@link Skin#getBones()}. */
* @see spine.Skin.getBones() */
public var skinRequired:Bool = false;
/** The color of the bone as it was in Spine, or a default color if nonessential data was not exported. Bones are not usually
* rendered at runtime. */
@ -66,7 +65,7 @@ class BoneData {
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
public var visible:Bool = false;
/** @param parent May be null. */
/** Copy constructor. */
public function new(index:Int, name:String, parent:BoneData) {
if (index < 0)
throw new SpineException("index must be >= 0");
@ -77,7 +76,7 @@ class BoneData {
_parent = parent;
}
/** The index of the bone in {@link Skeleton#getBones()}. */
/** The index of the bone in spine.Skeleton.getBones(). */
public var index(get, never):Int;
private function get_index():Int {
@ -87,7 +86,7 @@ class BoneData {
/** The name of the bone, which is unique across all bones in the skeleton. */
public var name(get, never):String;
function get_name():String {
private function get_name():String {
return _name;
}

View File

@ -34,12 +34,11 @@ class ConstraintData {
/** The constraint's name, which is unique across all constraints in the skeleton of the same type. */
public var name:String;
/** The ordinal of this constraint for the order a skeleton's constraints will be applied by
* Skeleton#updateWorldTransform(). */
* spine.Skeleton.updateWorldTransform(). */
public var order:Int = 0;
/** When true, Skeleton#updateWorldTransform() only updates this constraint if the Skeleton#getSkin()
/** When true, spine.Skeleton.updateWorldTransform() only updates this constraint if the spine.Skeleton.getSkin()
* contains this constraint.
*
* See Skin#getConstraints(). */
* @see spine.Skin.getConstraints() */
public var skinRequired:Bool = false;
function new(name:String, order:Int, skinRequired:Bool) {

View File

@ -29,12 +29,12 @@
package spine;
/** Stores the current pose values for an {@link Event}.
* <p>
* See Timeline
* {@link Timeline#apply(Skeleton, float, float, com.badlogic.gdx.utils.Array, float, com.esotericsoftware.spine.Animation.MixBlend, com.esotericsoftware.spine.Animation.MixDirection)},
* AnimationStateListener {@link AnimationStateListener#event(com.esotericsoftware.spine.AnimationState.TrackEntry, Event)}, and
* <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */
/** Stores the current pose values for an Event.
*
* @see spine.Timeline
* @see spine.Timeline.apply()
* @see spine.AnimationStateListener.event()
* @see <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */
class Event {
private var _data:EventData;

View File

@ -29,8 +29,8 @@
package spine;
/** Stores the setup pose values for an {@link Event}.
* <p>
/** Stores the setup pose values for an spine.Event.
*
* See <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */
class EventData {
private var _name:String;

View File

@ -30,15 +30,15 @@
package spine;
interface HasTextureRegion {
/** The name used to find the {@link #region}. */
/** The name used to find the region. */
public var path:String;
/** Sets the region used to draw the attachment. After setting the region or if the region's properties are changed,
* {@link #updateRegion()} must be called. */
* updateRegion() must be called. */
public var region:TextureRegion;
/** The color to tint the attachment. */
public var color:Color;
public var sequence:Sequence;
/** Updates any values the attachment calculates using the {@link #region}. Must be called after setting the
* {@link #region} or if the region's properties are changed. */
/** Updates any values the attachment calculates using the region. Must be called after setting the
* region or if the region's properties are changed. */
public function updateRegion():Void;
}

View File

@ -46,7 +46,7 @@ class IkConstraint implements Updatable {
public var compress:Bool = false;
/** When true and the target is out of range, the parent bone is scaled to reach it.
* <p>
* For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if {@link #getSoftness()} is
* For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if getSoftness() is
* > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied. */
public var stretch:Bool = false;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation.
@ -58,6 +58,7 @@ class IkConstraint implements Updatable {
public var softness:Float = 0;
public var active:Bool = false;
/** Copy constructor. */
public function new(data:IkConstraintData, skeleton:Skeleton) {
if (data == null)
throw new SpineException("data cannot be null.");
@ -111,7 +112,7 @@ class IkConstraint implements Updatable {
}
public function toString():String {
return _data.name != null ? _data.name : "IkContstraint?";
return _data.name != null ? _data.name : "IkConstraint?";
}
/** Applies 1 bone IK. The target is specified in the world coordinate system. */

View File

@ -29,8 +29,8 @@
package spine;
/** Stores the setup pose for an {@link IkConstraint}.
* <p>
/** Stores the setup pose for a spine.IkConstraint.
*
* See <a href="https://esotericsoftware.com/spine-ik-constraints">IK constraints</a> in the Spine User Guide. */
class IkConstraintData extends ConstraintData {
/** The bones that are constrained by this IK constraint. */
@ -47,10 +47,10 @@ class IkConstraintData extends ConstraintData {
public var compress:Bool = false;
/** When true and the target is out of range, the parent bone is scaled to reach it.
*
* For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if {@link #getSoftness()} is
* For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if softness is
* > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied. */
public var stretch:Bool = false;
/** When true and {@link #getCompress()} or {@link #getStretch()} is used, the bone is scaled on both the X and Y axes. */
/** When true and compress or stretch is used, the bone is scaled on both the X and Y axes. */
public var uniform:Bool = false;
/** For two bone IK, the target bone's distance from the maximum reach of the bones where rotation begins to slow. The bones
* will not straighten completely until the target is this far out of range. */

View File

@ -29,14 +29,14 @@
package spine;
/** Stores the setup pose for a {@link PathConstraint}.
* <p>
/** Stores the setup pose for a spine.PathConstraint.
*
* See <a href="https://esotericsoftware.com/spine-path-constraints">Path constraints</a> in the Spine User Guide. */
class PathConstraintData extends ConstraintData {
/** The bones that will be modified by this path constraint. */
private var _bones:Array<BoneData> = new Array<BoneData>();
/** The slot whose path attachment will be used to constrained the bones. */
/** The slot whose path attachment will be used to constrain the bones. */
public var target:SlotData;
/** The mode for positioning the first bone on the path. */
public var positionMode:PositionMode = PositionMode.fixed;

View File

@ -30,7 +30,7 @@
package spine;
/** Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
* <p>
*
* See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
class PhysicsConstraint implements Updatable {
private var _data:PhysicsConstraintData;
@ -42,6 +42,7 @@ class PhysicsConstraint implements Updatable {
public var massInverse:Float = 0;
public var wind:Float = 0;
public var gravity:Float = 0;
/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */
public var mix:Float = 0;
private var _reset:Bool = true;

View File

@ -44,6 +44,11 @@ typedef Function = haxe.Constraints.Function;
this.instantiator = instantiator;
}
/**
* This pool keeps a reference to the obtained instance, so it should be returned to the pool via Pool.free(),
* Pool.freeAll() or clear() to avoid leaking memory.
* @return The obtained instance from the pool or a new instance if the pool is empty.
*/
public function obtain():T {
return this.items.length > 0 ? this.items.pop() : this.instantiator();
}

View File

@ -29,10 +29,12 @@
package spine;
/** Controls how the first bone is positioned along the path.
/**
* Controls how the first bone is positioned along the path.
* <p>
* See <a href="https://esotericsoftware.com/spine-path-constraints#Position-mode">Position mode</a> in the Spine User
* Guide. */
* Guide.
*/
class PositionMode {
public static var fixed(default, never):PositionMode = new PositionMode("fixed");
public static var percent(default, never):PositionMode = new PositionMode("percent");

View File

@ -86,9 +86,9 @@ class Skeleton {
* <p>
* Bones that do not inherit translation are still affected by this property. */
public var y:Float = 0;
/** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
/** Returns the skeleton's time. This is used for time-based manipulations, such as spine.PhysicsConstraint.
* <p>
* See {@link #update(float)}. */
* See Skeleton.update(). */
public var time:Float = 0;
/** Creates a new skeleton with the specified skeleton data. */
@ -143,7 +143,7 @@ class Skeleton {
updateCache();
}
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
/** Caches information about bones and constraints. Must be called if the Skeleton.skin is modified or if bones,
* constraints, or weighted path attachments are added or removed. */
public function updateCache():Void {
_updateCache.resize(0);
@ -463,7 +463,7 @@ class Skeleton {
return _data;
}
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
/** The list of bones and constraints, sorted in the order they should be updated, as computed by Skeleton.updateCache(). */
public var getUpdateCache(get, never):Array<Updatable>;
private function get_getUpdateCache():Array<Updatable> {
@ -524,7 +524,7 @@ class Skeleton {
/** Sets a skin by name.
* <p>
* See {@link #setSkin(Skin)}. */
* See Skeleton.skin. */
private function set_skinName(skinName:String):String {
var skin:Skin = data.findSkin(skinName);
if (skin == null)
@ -545,14 +545,14 @@ class Skeleton {
return _skin;
}
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default skin}. If the
* skin is changed, {@link #updateCache()} is called.
/** Sets the skin used to look up attachments before looking in the spine.SkeletonData default skin. If the
* skin is changed, Skeleton.updateCache() is called.
* <p>
* 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.
* <p>
* 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(Skeleton)} is called before the next time the
* Skeleton.setSlotsToSetupPose(). Also, often spine.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. */
private function set_skin(newSkin:Skin):Skin {
@ -579,15 +579,15 @@ class Skeleton {
return _skin;
}
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
/** Finds an attachment by looking in the Skeleton.skin and spine.SkeletonData defaultSkin using the slot name and attachment
* name.
* <p>
* See {@link #getAttachment(int, String)}. */
* See Skeleton.getAttachmentForSlotIndex(). */
public function getAttachmentForSlotName(slotName:String, attachmentName:String):Attachment {
return getAttachmentForSlotIndex(data.findSlot(slotName).index, attachmentName);
}
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
/** Finds an attachment by looking in the Skeleton.skin and spine.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.
* <p>
* See <a href="https://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
@ -604,8 +604,8 @@ class Skeleton {
return null;
}
/** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with
* {@link #getAttachment(int, String)}, then setting the slot's {@link Slot#attachment}.
/** A convenience method to set an attachment by finding the slot with Skeleton.findSlot(), finding the attachment with
* Skeleton.getAttachmentForSlotIndex(), then setting the slot's spine.Slot attachment.
* @param attachmentName May be null to clear the slot's attachment. */
public function setAttachment(slotName:String, attachmentName:String):Void {
if (slotName == null)
@ -683,8 +683,8 @@ class Skeleton {
private var _tempVertices = new Array<Float>();
private var _bounds = new Rectangle();
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
* Optionally applies clipping. */
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. Optionally applies
* clipping. */
public function getBounds(clipper: SkeletonClipping = null):Rectangle {
var minX:Float = Math.POSITIVE_INFINITY;
var minY:Float = Math.POSITIVE_INFINITY;
@ -741,18 +741,18 @@ class Skeleton {
return _bounds;
}
/** Increments the skeleton's {@link #time}. */
/** Increments the skeleton's Skeleton.time. */
public function update (delta:Float):Void {
time += delta;
}
/** Calls {@link PhysicsConstraint#translate(float, float)} for each physics constraint. */
/** Calls spine.PhysicsConstraint.translate() for each physics constraint. */
public function physicsTranslate (x:Float, y:Float):Void {
for (physicsConstraint in physicsConstraints)
physicsConstraint.translate(x, y);
}
/** Calls {@link PhysicsConstraint#rotate(float, float, float)} for each physics constraint. */
/** Calls spine.PhysicsConstraint.rotate() for each physics constraint. */
public function physicsRotate (x:Float, y:Float, degrees:Float):Void {
for (physicsConstraint in physicsConstraints)
physicsConstraint.rotate(x, y, degrees);

View File

@ -82,6 +82,13 @@ import spine.attachments.PointAttachment;
import spine.attachments.RegionAttachment;
import spine.attachments.VertexAttachment;
/**
* Loads skeleton data in the Spine binary format.
* <p>
* See <a href="https://esotericsoftware.com/spine-binary-format">Spine binary format</a> and
* <a href="https://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data">JSON and binary data</a> in the Spine
* Runtimes Guide.
*/
class SkeletonBinary {
public var attachmentLoader:AttachmentLoader;
public var scale:Float = 1;

View File

@ -274,8 +274,10 @@ class SkeletonClipping {
}
}
/** 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. */
/**
* 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.
*/
public function clip(x1:Float, y1:Float, x2:Float, y2:Float, x3:Float, y3:Float, clippingArea:Array<Float>, output:Array<Float>):Bool {
var originalOutput:Array<Float> = output;
var clipped:Bool = false;

View File

@ -108,6 +108,7 @@ class SkeletonData {
/** 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.
* @param boneName The name of the bone to find.
* @return May be null. */
public function findBone(boneName:String):BoneData {
if (boneName == null)
@ -121,6 +122,7 @@ class SkeletonData {
}
/** Finds the index of a bone by comparing each bone's name.
* @param boneName The name of the bone to find.
* @return -1 if the bone was not found. */
public function findBoneIndex(boneName:String):Int {
if (boneName == null)
@ -136,6 +138,7 @@ class SkeletonData {
/** 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.
* @param slotName The name of the slot to find.
* @return May be null. */
public function findSlot(slotName:String):SlotData {
if (slotName == null)
@ -152,6 +155,7 @@ class SkeletonData {
/** 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.
* @param skinName The name of the skin to find.
* @return May be null. */
public function findSkin(skinName:String):Skin {
if (skinName == null)
@ -167,6 +171,7 @@ class SkeletonData {
/** 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.
* @param eventName The name of the event to find.
* @return May be null. */
public function findEvent(eventName:String):EventData {
if (eventName == null)
@ -182,6 +187,7 @@ class SkeletonData {
/** 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.
* @param animationName The name of the animation to find.
* @return May be null. */
public function findAnimation(animationName:String):Animation {
if (animationName == null)
@ -197,6 +203,7 @@ class SkeletonData {
/** 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.
* @param constraintName The name of the IK constraint to find.
* @return May be null. */
public function findIkConstraint(constraintName:String):IkConstraintData {
if (constraintName == null)
@ -212,6 +219,7 @@ class SkeletonData {
/** 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.
* @param constraintName The name of the transform constraint to find.
* @return May be null. */
public function findTransformConstraint(constraintName:String):TransformConstraintData {
if (constraintName == null)
@ -224,6 +232,7 @@ class SkeletonData {
}
/** Finds the index of a transform constraint by comparing each transform constraint's name.
* @param transformConstraintName The name of the transform constraint to find.
* @return -1 if the transform constraint was not found. */
public function findTransformConstraintIndex(transformConstraintName:String):Int {
if (transformConstraintName == null)
@ -239,6 +248,7 @@ class SkeletonData {
/** 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.
* @param constraintName The name of the path constraint to find.
* @return May be null. */
public function findPathConstraint(constraintName:String):PathConstraintData {
if (constraintName == null)
@ -252,6 +262,7 @@ class SkeletonData {
}
/** Finds the index of a path constraint by comparing each path constraint's name.
* @param pathConstraintName The name of the path constraint to find.
* @return -1 if the path constraint was not found. */
public function findPathConstraintIndex(pathConstraintName:String):Int {
if (pathConstraintName == null)
@ -267,10 +278,11 @@ class SkeletonData {
/** 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.
* @param constraintName The name of the physics constraint to find.
* @return May be null. */
public function findPhysicsConstraint(constraintName:String):PhysicsConstraintData {
if (constraintName == null)
throw new SpineException("physicsConstraintName cannot be null.");
throw new SpineException("constraintName cannot be null.");
for (i in 0...physicsConstraints.length) {
var constraint:PhysicsConstraintData = physicsConstraints[i];
if (constraint.name == constraintName)
@ -280,6 +292,7 @@ class SkeletonData {
}
/** Finds the index of a physics constraint by comparing each physics constraint's name.
* @param constraintName The name of the physics constraint to find.
* @return -1 if the physics constraint was not found. */
public function findPhysicsConstraintIndex(constraintName:String):Int {
if (constraintName == null)

View File

@ -35,8 +35,8 @@ import spine.attachments.MeshAttachment;
/** Stores attachments by slot index and attachment name.
*
* See SkeletonData {@link SkeletonData#defaultSkin}, Skeleton {@link Skeleton#skin}, and
* <a href="https://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
* See spine.SkeletonData.defaultSkin, spine.Skeleton.skin, and
* Runtime skins at https://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide. */
class Skin {
private var _name:String;
private var _attachments:Array<StringMap<Attachment>> = new Array<StringMap<Attachment>>();
@ -215,16 +215,16 @@ class Skin {
return _constraints;
}
/** The skin's name, which is unique across all skins in the skeleton. */
public var name(get, never):String;
/** The skin's name, which is unique across all skins in the skeleton. */
private function get_name():String {
return _name;
}
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
public var color(get, never):Color;
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
private function get_color():Color {
return _color;
}

View File

@ -32,14 +32,14 @@ package spine;
import spine.attachments.Attachment;
import spine.attachments.VertexAttachment;
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store
/** Stores a slot's current pose. Slots organize attachments for 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. */
class Slot {
private var _data:SlotData;
private var _bone:Bone;
/** The color used to tint the slot's attachment. If {@link #darkColor} is set, this is used as the light color for two
/** The color used to tint the slot's attachment. If darkColor is set, this is used as the light color for two
* color tinting. */
public var 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
@ -48,16 +48,15 @@ class Slot {
private var _attachment:Attachment;
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
* {@link Sequence#setupIndex}. */
/** The index of the texture region to display when the slot's attachment has a spine.attachments.Sequence. -1 represents the
* Sequence.getSetupIndex(). */
public var sequenceIndex = -1;
public var attachmentState:Int = 0;
/** 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.
* <p>
* See {@link VertexAttachment#computeWorldVertices(Slot, int, int, float[], int, int)} and {@link DeformTimeline}. */
* @see spine.attachments.VertexAttachment.computeWorldVertices()
* @see spine.animation.DeformTimeline */
public var deform:Array<Float> = new Array<Float>();
/** Copy constructor. */
@ -101,8 +100,8 @@ class Slot {
return _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#timelineAttachment} as the
/** Sets the slot's attachment and, if the attachment changed, resets sequenceIndex and clears the deform.
* The deform is not cleared if the old attachment has the same spine.attachments.VertexAttachment.timelineAttachment as the
* specified attachment. */
public function set_attachment(attachmentNew:Attachment):Attachment {
if (attachment == attachmentNew)

View File

@ -29,13 +29,13 @@
package spine;
/** Stores the setup pose for a {@link Slot}. */
/** Stores the setup pose for a spine.Slot. */
class SlotData {
private var _index:Int;
private var _name:String;
private var _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
/** The color used to tint the slot's attachment. If SlotData.darkColor is set, this is used as the light color for two
* color tinting. */
public var color: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
@ -60,7 +60,7 @@ class SlotData {
_boneData = boneData;
}
/** The index of the slot in {@link Skeleton#getSlots()}. */
/** The index of the slot in spine.Skeleton.getSlots(). */
public var index(get, never):Int;
private function get_index():Int {

View File

@ -29,9 +29,11 @@
package spine;
/** Stores the setup pose for a {@link TransformConstraint}.
* <p>
* See <a href="https://esotericsoftware.com/spine-transform-constraints">Transform constraints</a> in the Spine User Guide. */
/**
* Stores the setup pose for a spine.TransformConstraint.
*
* See <a href="https://esotericsoftware.com/spine-transform-constraints">Transform constraints</a> in the Spine User Guide.
*/
class TransformConstraintData extends ConstraintData {
private var _bones:Array<BoneData> = new Array<BoneData>();
@ -68,7 +70,9 @@ class TransformConstraintData extends ConstraintData {
super(name, 0, false);
}
/** The bones that will be modified by this transform constraint. */
/**
* The bones that will be modified by this transform constraint.
*/
public var bones(get, never):Array<BoneData>;
private function get_bones():Array<BoneData> {

View File

@ -29,9 +29,6 @@
package spine;
/**
* Triangulator class used for polygon triangulation and decomposition.
*/
class Triangulator {
private var convexPolygons:Array<Array<Float>> = new Array<Array<Float>>();
private var convexPolygonsIndices:Array<Array<Int>> = new Array<Array<Int>>();

View File

@ -29,17 +29,17 @@
package spine;
/** The interface for items updated by {@link Skeleton#updateWorldTransform(Physics)}. */
/** The interface for items updated by spine.Skeleton.updateWorldTransform(). */
interface Updatable {
/** @param physics Determines how physics and other non-deterministic updates are applied. */
function update(physics:Physics):Void;
/** Returns false when this item won't be updated by
* {@link Skeleton#updateWorldTransform(Physics)} 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() */
* spine.Skeleton.updateWorldTransform() because a skin is required and the
* active skin does not contain this item.
* @see spine.Skin.getBones()
* @see spine.Skin.getConstraints()
* @see spine.BoneData.getSkinRequired()
* @see spine.ConstraintData.getSkinRequired() */
function isActive():Bool;
}

View File

@ -33,7 +33,7 @@ import spine.Event;
import spine.Skeleton;
import spine.Slot;
/** Changes the alpha for a slot's {@link Slot#color}. */
/** Changes the alpha for a slot's spine.Slot.color. */
class AlphaTimeline extends CurveTimeline1 implements SlotTimeline {
private static inline var ENTRIES:Int = 4;
private static inline var R:Float = 1;

View File

@ -74,25 +74,25 @@ class Animation {
}
/** Applies the animation's timelines to the specified skeleton.
* <p>
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
*
* See Timeline.apply().
* @param skeleton The skeleton the animation is being applied to. This provides access to the bones, slots, and other skeleton
* components the timelines may change.
* @param lastTime The last time in seconds this animation was applied. Some timelines trigger only at specific times rather
* than every frame. Pass -1 the first time an animation is applied to ensure frame 0 is triggered.
* @param time The time in seconds the skeleton is being posed for. Most timelines find the frame before and the frame after
* this time and interpolate between the frame values. If beyond the {@link #getDuration()} and <code>loop</code> is
* this time and interpolate between the frame values. If beyond the duration and loop is
* true then the animation will repeat, else the last frame will be applied.
* @param loop If true, the animation repeats after the {@link #getDuration()}.
* @param loop If true, the animation repeats after the duration.
* @param events If any events are fired, they are added to this list. Can be null to ignore fired events or if no timelines
* fire events.
* @param alpha 0 applies the current or setup values (depending on <code>blend</code>). 1 applies the timeline values. Between
* @param alpha 0 applies the current or setup values (depending on blend). 1 applies the timeline values. Between
* 0 and 1 applies values between the current or setup values and the timeline values. By adjusting
* <code>alpha</code> over time, an animation can be mixed in or out. <code>alpha</code> can also be useful to apply
* alpha over time, an animation can be mixed in or out. alpha can also be useful to apply
* animations on top of each other (layering).
* @param blend Controls how mixing is applied when <code>alpha</code> < 1.
* @param blend Controls how mixing is applied when alpha < 1.
* @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions,
* such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */
* such as DrawOrderTimeline or AttachmentTimeline. */
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, loop:Bool, events:Array<Event>, alpha:Float, blend:MixBlend,
direction:MixDirection):Void {
if (skeleton == null)
@ -109,9 +109,9 @@ class Animation {
}
}
/** The animation's name, which is unique across all animations in the skeleton. */
public var name(get, never):String;
/** The animation's name, which is unique across all animations in the skeleton. */
private function get_name():String {
return _name;
}
@ -120,9 +120,9 @@ class Animation {
return _name;
}
/** If the returned array or the timelines it contains are modified, setTimelines() must be called. */
public var timelines(get, never):Array<Timeline>;
/** If the returned array or the timelines it contains are modified, {@link #setTimelines(Array)} must be called. */
private function get_timelines():Array<Timeline> {
return _timelines;
}

View File

@ -35,11 +35,52 @@ import spine.Event;
import spine.Pool;
import spine.Skeleton;
/**
* Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
* multiple animations on top of each other (layering).
* <p>
* See <a href='https://esotericsoftware.com/spine-applying-animations/'>Applying Animations</a> in the Spine Runtimes Guide.
*/
class AnimationState {
/**
* 1) A previously applied timeline has set this property.<br>
* Result: Mix from the current pose to the timeline pose.
*/
public static inline var SUBSEQUENT:Int = 0;
/**
* 1) This is the first timeline to set this property.<br>
* 2) The next track entry applied after this one does not have a timeline to set this property.<br>
* Result: Mix from the setup pose to the timeline pose.
*/
public static inline var FIRST:Int = 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.
*/
public static inline var HOLD_SUBSEQUENT:Int = 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.
*/
public static inline var HOLD_FIRST:Int = 3;
/**
* 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 have a timeline to set this property.<br>
* 4) timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.<br>
* 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.<br>
* 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 to the mixed
* out position.
*/
public static inline var HOLD_MIX:Int = 4;
public static inline var SETUP:Int = 1;
public static inline var CURRENT:Int = 2;
@ -67,6 +108,9 @@ class AnimationState {
private var unkeyedState:Int = 0;
/**
* Creates an uninitialized AnimationState. The animation state data must be set before use.
*/
public function new(data:AnimationStateData) {
if (data == null)
throw new SpineException("data can not be null");
@ -77,6 +121,9 @@ class AnimationState {
});
}
/**
* Increments each track entry spine.animation.TrackEntry.getTrackTime(), setting queued animations as current if needed.
*/
public function update(delta:Float):Void {
delta *= timeScale;
for (i in 0...tracks.length) {
@ -138,6 +185,9 @@ class AnimationState {
queue.drain();
}
/**
* Returns true when all mixing from entries are complete.
*/
private function updateMixingFrom(to:TrackEntry, delta:Float):Bool {
var from:TrackEntry = to.mixingFrom;
if (from == null)
@ -165,6 +215,11 @@ class AnimationState {
return false;
}
/**
* Poses the skeleton using the track entry animations. The animation state is not changed, so can be applied to multiple
* skeletons to pose them identically.
* @return True if any animations were applied.
*/
public function apply(skeleton:Skeleton):Bool {
if (skeleton == null)
throw new SpineException("skeleton cannot be null.");
@ -350,6 +405,12 @@ class AnimationState {
return mix;
}
/**
* Applies the attachment timeline and sets spine.Slot.attachmentState.
* @param attachments False when: 1) the attachment timeline is mixing out, 2) mix < attachmentThreshold, and 3) the timeline
* is not the last timeline to set the slot's attachment. In that case the timeline is applied only so subsequent
* timelines see any deform.
*/
public function applyAttachmentTimeline(timeline:AttachmentTimeline, skeleton:Skeleton, time:Float, blend:MixBlend, attachments:Bool) {
var slot = skeleton.slots[timeline.slotIndex];
if (!slot.bone.active)
@ -366,6 +427,10 @@ class AnimationState {
slot.attachmentState = this.unkeyedState + SETUP;
}
/**
* Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
* the first time the mixing was applied.
*/
public function applyRotateTimeline(timeline:RotateTimeline, skeleton:Skeleton, time:Float, alpha:Float, blend:MixBlend, timelinesRotation:Array<Float>,
i:Int, firstFrame:Bool) {
if (firstFrame)
@ -481,6 +546,12 @@ class AnimationState {
}
}
/**
* Removes all animations from all tracks, leaving skeletons in their current pose.
* <p>
* It may be desired to use spine.animation.AnimationState.setEmptyAnimations() to mix the skeletons back to the setup pose,
* rather than leaving them in their current pose.
*/
public function clearTracks():Void {
var oldTrainDisabled:Bool = queue.drainDisabled;
queue.drainDisabled = true;
@ -492,6 +563,12 @@ class AnimationState {
queue.drain();
}
/**
* Removes all animations from the track, leaving skeletons in their current pose.
* <p>
* It may be desired to use spine.animation.AnimationState.setEmptyAnimation() to mix the skeletons back to the setup pose,
* rather than leaving them in their current pose.
*/
public function clearTrack(trackIndex:Int):Void {
if (trackIndex >= tracks.length)
return;
@ -540,6 +617,11 @@ class AnimationState {
queue.start(current);
}
/**
* Sets an animation by name.
* <p>
* See spine.animation.AnimationState.setAnimation().
*/
public function setAnimationByName(trackIndex:Int, animationName:String, loop:Bool):TrackEntry {
var animation:Animation = data.skeletonData.findAnimation(animationName);
if (animation == null)
@ -547,6 +629,14 @@ class AnimationState {
return setAnimation(trackIndex, animation, loop);
}
/**
* 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 spine.animation.TrackEntry.getTrackEnd() determines when the track is cleared.
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
* after the spine.animation.AnimationStateListener.dispose() event occurs.
*/
public function setAnimation(trackIndex:Int, animation:Animation, loop:Bool):TrackEntry {
if (animation == null)
throw new SpineException("animation cannot be null.");
@ -571,6 +661,11 @@ class AnimationState {
return entry;
}
/**
* Queues an animation by name.
* <p>
* See spine.animation.AnimationState.addAnimation().
*/
public function addAnimationByName(trackIndex:Int, animationName:String, loop:Bool, delay:Float):TrackEntry {
var animation:Animation = data.skeletonData.findAnimation(animationName);
if (animation == null)
@ -578,6 +673,16 @@ class AnimationState {
return addAnimation(trackIndex, animation, loop, delay);
}
/**
* 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 spine.animation.AnimationState.setAnimation().
* @param delay If > 0, sets spine.animation.TrackEntry.getDelay(). If <= 0, the delay set is the duration of the previous track entry
* minus any mix duration (from the spine.animation.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.
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
* after the spine.animation.AnimationStateListener.dispose() event occurs.
*/
public function addAnimation(trackIndex:Int, animation:Animation, loop:Bool, delay:Float):TrackEntry {
if (animation == null)
throw new SpineException("animation cannot be null.");
@ -605,6 +710,23 @@ class AnimationState {
return entry;
}
/**
* Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
* spine.animation.TrackEntry.getMixDuration(). An empty animation has no timelines and serves as a placeholder for mixing in or out.
* <p>
* Mixing out is done by setting an empty animation with a mix duration using either spine.animation.AnimationState.setEmptyAnimation(),
* spine.animation.AnimationState.setEmptyAnimations(), or spine.animation.AnimationState.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.
* <p>
* Mixing in is done by first setting an empty animation, then adding an animation using
* spine.animation.AnimationState.addAnimation() with the desired delay (an empty animation has a duration of 0) and on
* the returned track entry, set the spine.animation.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.
*/
public function setEmptyAnimation(trackIndex:Int, mixDuration:Float):TrackEntry {
var entry:TrackEntry = setAnimation(trackIndex, emptyAnimation, false);
entry.mixDuration = mixDuration;
@ -612,6 +734,19 @@ class AnimationState {
return entry;
}
/**
* Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
* spine.animation.TrackEntry.getMixDuration(). If the track is empty, it is equivalent to calling
* spine.animation.AnimationState.setEmptyAnimation().
* <p>
* See spine.animation.AnimationState.setEmptyAnimation().
* @param delay If > 0, sets spine.animation.TrackEntry.getDelay(). 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 spine.animation.AnimationStateListener.dispose() event occurs.
*/
public function addEmptyAnimation(trackIndex:Int, mixDuration:Float, delay:Float):TrackEntry {
var entry:TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay);
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
@ -620,6 +755,10 @@ class AnimationState {
return entry;
}
/**
* Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
* duration.
*/
public function setEmptyAnimations(mixDuration:Float):Void {
var oldDrainDisabled:Bool = queue.drainDisabled;
queue.drainDisabled = true;
@ -675,7 +814,9 @@ class AnimationState {
return entry;
}
/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
/**
* Removes the spine.animation.TrackEntry.getNext() next entry and all entries after it for the specified entry.
*/
public function clearNext(entry:TrackEntry):Void {
var next:TrackEntry = entry.next;
while (next != null) {
@ -757,6 +898,9 @@ class AnimationState {
}
}
/**
* Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing.
*/
public function getCurrent(trackIndex:Int):TrackEntry {
if (trackIndex >= tracks.length)
return null;
@ -769,6 +913,9 @@ class AnimationState {
return onComplete.listeners.length > 0 || onEnd.listeners.length > 0;
}
/**
* Removes all listeners added with spine.animation.AnimationState.addListener().
*/
public function clearListeners():Void {
onStart.listeners.resize(0);
onInterrupt.listeners.resize(0);
@ -778,6 +925,11 @@ class AnimationState {
onEvent.listeners.resize(0);
}
/**
* Discards all listener notifications that have not yet been delivered. This can be useful to call from an
* spine.animation.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.
*/
public function clearListenerNotifications():Void {
queue.clear();
}

View File

@ -32,7 +32,7 @@ package spine.animation;
import haxe.ds.StringMap;
import spine.SkeletonData;
/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */
/** Stores mix (crossfade) durations to be applied when spine.animation.AnimationState animations are changed. */
class AnimationStateData {
private var _skeletonData:SkeletonData;
private var animationToMixTime:StringMap<Float> = new StringMap<Float>();
@ -53,7 +53,7 @@ class AnimationStateData {
/** Sets a mix duration by animation name.
*
* See {@link #setMix(Animation, Animation, float)}. */
* See AnimationStateData.setMix(). */
public function setMixByName(fromName:String, toName:String, duration:Float):Void {
var from:Animation = _skeletonData.findAnimation(fromName);
if (from == null)
@ -66,7 +66,7 @@ class AnimationStateData {
/** Sets the mix duration when changing from the specified animation to the other.
*
* See {@link TrackEntry#mixDuration}. */
* See spine.animation.TrackEntry.mixDuration. */
public function setMix(from:Animation, to:Animation, duration:Float):Void {
if (from == null)
throw new SpineException("from cannot be null.");
@ -75,7 +75,7 @@ class AnimationStateData {
animationToMixTime.set(from.name + ":" + to.name, duration);
}
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
/** Returns the mix duration to use when changing from the specified animation to the other, or the AnimationStateData.defaultMix if
* no mix duration has been set. */
public function getMix(from:Animation, to:Animation):Float {
if (animationToMixTime.exists(from.name + ":" + to.name))

View File

@ -33,7 +33,7 @@ import spine.Event;
import spine.Skeleton;
import spine.Slot;
/** Changes a slot's attachment. */
/** Changes a slot's spine.Slot.attachment. */
class AttachmentTimeline extends Timeline implements SlotTimeline {
public var slotIndex:Int = 0;

View File

@ -31,6 +31,6 @@ package spine.animation;
/** An interface for timelines which change the property of a bone. */
interface BoneTimeline {
/** The index of the bone in {@link Skeleton#getBones()} that will be changed when this timeline is applied. */
/** The index of the bone in spine.Skeleton.getBones() that will be changed when this timeline is applied. */
function getBoneIndex():Int;
}

View File

@ -38,7 +38,7 @@ class CurveTimeline extends Timeline {
private var curves:Array<Float>; // type, x, y, ...
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
/** @param bezierCount The maximum number of Bezier curves. See CurveTimeline.shrink().
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
public function new(frameCount:Int, bezierCount:Int, propertyIds:Array<String>) {
super(frameCount, propertyIds);
@ -109,9 +109,9 @@ class CurveTimeline extends Timeline {
}
/** 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 frameIndex The index into Timeline.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}. */
* @param i The index of the Bezier segments. See CurveTimeline.getCurveType(). */
public function getBezierValue(time:Float, frameIndex:Int, valueOffset:Int, i:Int):Float {
var x:Float, y:Float;
if (curves[i] > time) {

View File

@ -29,12 +29,13 @@
package spine.animation;
/** The base class for a {@link CurveTimeline} that sets one property. */
/** The base class for a spine.animation.CurveTimeline that sets one property. */
class CurveTimeline1 extends CurveTimeline {
private static inline var ENTRIES:Int = 2;
private static inline var VALUE:Int = 1;
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(Int)}.
/** @param frameCount The number of frames in the timeline.
* @param bezierCount The maximum number of Bezier curves. See spine.animation.CurveTimeline.shrink().
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
public function new(frameCount:Int, bezierCount:Int, propertyIds:Array<String>) {
super(frameCount, bezierCount, propertyIds);

View File

@ -29,14 +29,15 @@
package spine.animation;
/** The base class for a {@link CurveTimeline} which sets two properties. */
/** The base class for a spine.animation.CurveTimeline which sets two properties. */
class CurveTimeline2 extends CurveTimeline {
private static inline var ENTRIES:Int = 3;
private static inline var VALUE1:Int = 1;
private static inline var VALUE2:Int = 2;
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(Int)}.
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
/** @param frameCount The number of frames in the timeline.
* @param bezierCount The maximum number of Bezier curves. See spine.animation.CurveTimeline.shrink().
* @param propertyIds Array of unique identifiers for the properties the timeline modifies. */
public function new(frameCount:Int, bezierCount:Int, propertyIds:Array<String>) {
super(frameCount, bezierCount, propertyIds);
}

View File

@ -36,13 +36,13 @@ import spine.Event;
import spine.Skeleton;
import spine.Slot;
/** Changes a slot's {@link Slot#getDeform()} to deform a {@link VertexAttachment}. */
/** Changes a slot's spine.Slot.deform to deform a spine.attachments.VertexAttachment. */
class DeformTimeline extends CurveTimeline implements SlotTimeline {
public var slotIndex:Int = 0;
/** The attachment that will be deformed.
* <p>
* See {@link VertexAttachment#getTimelineAttachment()}. */
*
* @see spine.attachments.VertexAttachment.getTimelineAttachment() */
public var attachment:VertexAttachment;
/** The vertices for each frame. */

View File

@ -35,7 +35,7 @@ import spine.Slot;
/** Changes a skeleton's {@link Skeleton#drawOrder}. */
class DrawOrderTimeline extends Timeline {
/** The draw order for each frame. See {@link #setFrame(Int, Float, Array<Int>)}. */
/** The draw order for each frame. See setFrame(). */
public var drawOrders:Array<Array<Int>>;
public function new(frameCount:Int) {
@ -53,7 +53,7 @@ class DrawOrderTimeline extends Timeline {
/** Sets the time and draw order for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds.
* @param drawOrder For each slot in {@link Skeleton#slots}, the index of the slot in the new draw order. May be null to use setup pose draw order. */
* @param drawOrder For each slot in spine.Skeleton.slots, the index of the slot in the new draw order. May be null to use setup pose draw order. */
public function setFrame(frame:Int, time:Float, drawOrder:Array<Int>):Void {
frames[frame] = time;
drawOrders[frame] = drawOrder;

View File

@ -33,7 +33,7 @@ import spine.animation.Timeline;
import spine.Event;
import spine.Skeleton;
/** Fires an {@link Event} when specific animation times are reached. */
/** Fires an spine.Event when specific animation times are reached. */
class EventTimeline extends Timeline {
/** The event for each frame. */
public var events:Array<Event>;
@ -49,8 +49,7 @@ class EventTimeline extends Timeline {
}
/** Sets the time and event for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param event The event to set for the frame. */
* @param frame Between 0 and <code>frameCount</code>, inclusive. */
public function setFrame(frame:Int, event:Event):Void {
frames[frame] = event.time;
events[frame] = event;

View File

@ -29,9 +29,6 @@
package spine.animation;
/**
* Animation state event type.
*/
class EventType {
public static var start(default, never):EventType = new EventType();
public static var interrupt(default, never):EventType = new EventType();

View File

@ -33,8 +33,8 @@ import spine.Event;
import spine.IkConstraint;
import spine.Skeleton;
/** Changes an IK constraint's {@link IkConstraint#mix}, {@link IkConstraint#softness},
* {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */
/** Changes an IK constraint's spine.IkConstraint.mix, spine.IkConstraint.softness,
* spine.IkConstraint.bendDirection, spine.IkConstraint.stretch, and spine.IkConstraint.compress. */
class IkConstraintTimeline extends CurveTimeline {
private static inline var ENTRIES:Int = 6;
private static inline var MIX:Int = 1;
@ -43,7 +43,7 @@ class IkConstraintTimeline extends CurveTimeline {
private static inline var COMPRESS:Int = 4;
private static inline var STRETCH:Int = 5;
/** The index of the IK constraint in {@link Skeleton#ikConstraints} that will be changed when this timeline is
/** The index of the IK constraint in spine.Skeleton.ikConstraints that will be changed when this timeline is
* applied. */
public var constraintIndex:Int = 0;
@ -59,11 +59,7 @@ class IkConstraintTimeline extends CurveTimeline {
/** Sets the time, mix, softness, bend direction, compress, and stretch for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds.
* @param mix The mix value.
* @param softness The softness value.
* @param bendDirection 1 or -1.
* @param compress Whether to compress.
* @param stretch Whether to stretch. */
* @param bendDirection 1 or -1. */
public function setFrame(frame:Int, time:Float, mix:Float, softness:Float, bendDirection:Int, compress:Bool, stretch:Bool):Void {
frame *= ENTRIES;
frames[frame] = time;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's {@link Bone#getInherit()}. */
/** Changes a bone's spine.Bone.inherit. */
class InheritTimeline extends Timeline implements BoneTimeline {
public static inline var ENTRIES:Int = 2;
private static inline var INHERIT:Int = 1;
@ -53,10 +53,9 @@ class InheritTimeline extends Timeline implements BoneTimeline {
return boneIndex;
}
/** Sets the inherit value for the specified frame.
/** Sets the transform mode for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds.
* @param inherit The inherit value for this frame. */
* @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, inherit: Inherit):Void {
frame *= ENTRIES;
frames[frame] = time;

View File

@ -29,14 +29,9 @@
package spine.animation;
/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
* events.
* <p>
* TrackEntry events are collected during {@link AnimationState#update(float)} and {@link AnimationState#apply(Skeleton)} and
* fired only after those methods are finished.
* <p>
* See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
* {@link AnimationState#addListener(AnimationStateListener)}. */
/**
* Manages a collection of listeners for TrackEntry events.
*/
class Listeners {
private var _listeners:Array<TrackEntry->Void>;
@ -50,7 +45,7 @@ class Listeners {
_listeners = new Array<TrackEntry->Void>();
}
/** Invoked when this entry has been set as the current entry. {@link #end(TrackEntry)} will occur when this entry will no
/** Invoked when this entry has been set as the current entry. spine.animation.Listeners.end(TrackEntry) will occur when this entry will no
* longer be applied. */
public function invoke(entry:TrackEntry) {
for (listener in _listeners) {
@ -75,14 +70,9 @@ class Listeners {
}
}
/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
* events.
* <p>
* TrackEntry events are collected during {@link AnimationState#update(float)} and {@link AnimationState#apply(Skeleton)} and
* fired only after those methods are finished.
* <p>
* See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
* {@link AnimationState#addListener(AnimationStateListener)}. */
/**
* Manages a collection of event listeners for TrackEntry events.
*/
class EventListeners {
private var _listeners:Array<TrackEntry->Event->Void>;
@ -97,9 +87,9 @@ class EventListeners {
}
/** Invoked when this entry's animation triggers an event. This may occur during mixing (after
* {@link #interrupt(TrackEntry)}), see {@link TrackEntry#eventThreshold}.
* interrupt(TrackEntry)), see spine.animation.TrackEntry.eventThreshold.
* <p>
* Because this event is triggered at the end of {@link AnimationState#apply(Skeleton)}, any animations set in response to
* Because this event is triggered at the end of spine.animation.AnimationState.apply(Skeleton), any animations set in response to
* the event won't be applied until the next time the AnimationState is applied. */
public function invoke(entry:TrackEntry, event:Event) {
for (listener in _listeners) {

View File

@ -32,7 +32,7 @@ package spine.animation;
/** Controls how timeline values are mixed with setup pose values or current pose values when a timeline is applied with
* <code>alpha</code> < 1.
*
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */
* @see spine.animation.Timeline.apply() */
class MixBlend {
public var ordinal:Int = 0;
@ -44,8 +44,8 @@ class MixBlend {
* setup value is set. */
public static var setup(default, never):MixBlend = new MixBlend(0);
/** Transitions from the current value to the timeline value. Before the first frame, 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 frame.
* the setup value. Timelines which perform instant transitions, such as spine.animation.DrawOrderTimeline or
* spine.animation.AttachmentTimeline, use the setup value before the first frame.
*
* <code>first</code> is intended for the first animations applied, not for animations layered on top of those. */
public static var first(default, never):MixBlend = new MixBlend(1);

View File

@ -31,8 +31,9 @@ package spine.animation;
/** 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). Some timelines use this to decide how values are applied.
*
* See Timeline apply(Skeleton, float, float, Array, float, MixBlend, MixDirection). */
*
* @see spine.animation.Timeline.apply()
*/
class MixDirection {
public var ordinal:Int = 0;

View File

@ -33,15 +33,15 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
/** Changes a path constraint's {@link PathConstraint#getMixRotate()}, {@link PathConstraint#getMixX()}, and
* {@link PathConstraint#getMixY()}. */
/** Changes a path constraint's PathConstraint.mixRotate, PathConstraint.mixX, and
* PathConstraint.mixY. */
class PathConstraintMixTimeline extends CurveTimeline {
private static inline var ENTRIES:Int = 4;
private static inline var ROTATE:Int = 1;
private static inline var X:Int = 2;
private static inline var Y:Int = 3;
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
/** The index of the path constraint in spine.Skeleton.pathConstraints that will be changed when this timeline is
* applied. */
public var constraintIndex:Int = 0;
@ -54,7 +54,7 @@ class PathConstraintMixTimeline extends CurveTimeline {
return ENTRIES;
}
/** Sets the time and mix values for the specified frame.
/** Sets the time and color for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, mixRotate:Float, mixX:Float, mixY:Float):Void {

View File

@ -33,9 +33,9 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
/** Changes a path constraint's {@link PathConstraint#position}. */
/** Changes a path constraint's spine.PathConstraint.position. */
class PathConstraintPositionTimeline extends CurveTimeline1 {
/** The index of the path constraint in {@link Skeleton#pathConstraints} that will be changed when this timeline is
/** The index of the path constraint in spine.Skeleton.pathConstraints that will be changed when this timeline is
* applied. */
public var constraintIndex:Int = 0;

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getDamping()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.damping. */
class PhysicsConstraintDampingTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getGravity()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.gravity. */
class PhysicsConstraintGravityTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getInertia()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.inertia. */
class PhysicsConstraintInertiaTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getMassInverse()}. The timeline values are not inverted. */
/** Changes a physics constraint's spine.PhysicsConstraint.massInverse. The timeline values are not inverted. */
class PhysicsConstraintMassTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getMix()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.mix. */
class PhysicsConstraintMixTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getStrength()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.strength. */
class PhysicsConstraintStrengthTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);

View File

@ -33,13 +33,15 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
/** The base class for most {@link PhysicsConstraint} timelines. */
/** The base class for most spine.PhysicsConstraint timelines. */
abstract class PhysicsConstraintTimeline extends CurveTimeline1 {
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
/** The index of the physics constraint in Skeleton.physicsConstraints that will be changed when this timeline
* is applied, or -1 if all physics constraints in the skeleton will be changed. */
public var constraintIndex:Int = 0;
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
/**
* @param physicsConstraintIndex -1 for all physics constraints in the skeleton.
*/
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int, property:Int) {
super(frameCount, bezierCount, [property + "|" + physicsConstraintIndex]);
constraintIndex = physicsConstraintIndex;

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a physics constraint's {@link PhysicsConstraint#getWind()}. */
/** Changes a physics constraint's spine.PhysicsConstraint.wind. */
class PhysicsConstraintWindTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes the RGB for a slot's {@link Slot#getColor()} and {@link Slot#getDarkColor()} for two color tinting. */
/** Changes the RGB for a slot's spine.Slot.color and spine.Slot.darkColor for two color tinting. */
class RGB2Timeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 7;
private static inline var R:Int = 1;
@ -50,21 +50,15 @@ class RGB2Timeline extends CurveTimeline implements SlotTimeline {
return ENTRIES;
}
/** The index of the slot in {@link Skeleton#getSlots()} that will be changed when this timeline is applied. The
* {@link Slot#getDarkColor()} must not be null. */
/** The index of the slot in spine.Skeleton.slots that will be changed when this timeline is applied. The
* spine.Slot.darkColor must not be null. */
public function getSlotIndex():Int {
return slotIndex;
}
/** Sets the time, light color, and dark color for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds.
* @param r Red component for the light color (0-1).
* @param g Green component for the light color (0-1).
* @param b Blue component for the light color (0-1).
* @param r2 Red component for the dark color (0-1).
* @param g2 Green component for the dark color (0-1).
* @param b2 Blue component for the dark color (0-1). */
* @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, r:Float, g:Float, b:Float, r2:Float, g2:Float, b2:Float):Void {
frame *= ENTRIES;
frames[frame] = time;

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a slot's {@link Slot#getColor()} and {@link Slot#getDarkColor()} for two color tinting. */
/** Changes a slot's spine.Slot.getColor() and spine.Slot.getDarkColor() for two color tinting. */
class RGBA2Timeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 8;
private static inline var R:Int = 1;
@ -55,8 +55,8 @@ class RGBA2Timeline extends CurveTimeline implements SlotTimeline {
return ENTRIES;
}
/** The index of the slot in {@link Skeleton#getSlots()} that will be changed when this timeline is applied. The
* {@link Slot#getDarkColor()} must not be null. */
/** The index of the slot in spine.Skeleton.getSlots() that will be changed when this timeline is applied. The
* spine.Slot.getDarkColor() must not be null. */
public function getSlotIndex():Int {
return slotIndex;
}

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes a slot's {@link Slot#getColor()}. */
/** Changes a slot's spine.Slot.color. */
class RGBATimeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 5;
private static inline var R:Int = 1;
@ -53,12 +53,8 @@ class RGBATimeline extends CurveTimeline implements SlotTimeline {
}
/** Sets the time and color for the specified frame.
* @param frame Between 0 and <code>frameCount</code>, inclusive.
* @param time The frame time in seconds.
* @param r The red component.
* @param g The green component.
* @param b The blue component.
* @param a The alpha component. */
* @param frame Between 0 and frameCount, inclusive.
* @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, r:Float, g:Float, b:Float, a:Float):Void {
frame *= ENTRIES;
frames[frame] = time;

View File

@ -29,7 +29,7 @@
package spine.animation;
/** Changes the RGB for a slot's {@link Slot#getColor()}. */
/** Changes the RGB for a slot's spine.Slot.color. */
class RGBTimeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 4;
private static inline var R:Int = 1;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#rotation}. */
/** Changes a bone's local rotation. */
class RotateTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;

View File

@ -34,7 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#scaleX} and {@link Bone#scaleY}. */
/** Changes a bone's local spine.Bone.scaleX and spine.Bone.scaleY. */
class ScaleTimeline extends CurveTimeline2 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -34,7 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#scaleX}. */
/** Changes a bone's local spine.Bone.scaleX. */
class ScaleXTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -34,7 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#scaleY}. */
/** Changes a bone's local spine.Bone.scaleY. */
class ScaleYTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -63,10 +63,7 @@ class SequenceTimeline extends Timeline implements SlotTimeline {
/** 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.
* @param mode The sequence mode.
* @param index The sequence index.
* @param delay The delay between frames. */
* @param time Seconds between frames. */
public function setFrame(frame:Int, time:Float, mode:SequenceMode, index:Int, delay:Float) {
frame *= SequenceTimeline.ENTRIES;
frames[frame] = time;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
/** Changes a bone's local spine.Bone.shearX and spine.Bone.shearY. */
class ShearTimeline extends CurveTimeline2 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#shearX}. */
/** Changes a bone's local spine.Bone.shearX. */
class ShearXTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#shearY}. */
/** Changes a bone's local Bone.shearY. */
class ShearYTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;

View File

@ -31,6 +31,6 @@ package spine.animation;
/** An interface for timelines which change the property of a slot. */
interface SlotTimeline {
/** The index of the slot in {@link Skeleton#getSlots()} that will be changed when this timeline is applied. */
/** The index of the slot in spine.Skeleton.getSlots() that will be changed when this timeline is applied. */
function getSlotIndex():Int;
}

View File

@ -41,7 +41,6 @@ class Timeline {
/**
* @param propertyIds Unique identifiers for the properties the timeline modifies.
* @param frameCount The number of frames for this timeline.
*/
public function new(frameCount:Int, propertyIds:Array<String>) {
this.propertyIds = propertyIds;
@ -67,7 +66,7 @@ class Timeline {
/** Applies this timeline to the skeleton.
* @param skeleton The skeleton to which the timeline is being applied. This provides access to the bones, slots, and other
* skeleton components that the timeline may change.
* @param lastTime The last time in seconds this timeline was applied. Timelines such as {@link EventTimeline} trigger only
* @param lastTime The last time in seconds this timeline was applied. Timelines such as spine.animation.EventTimeline trigger only
* at specific times rather than every frame. In that case, the timeline triggers everything between
* <code>lastTime</code> (exclusive) and <code>time</code> (inclusive). Pass -1 the first time an animation is
* applied to ensure frame 0 is triggered.
@ -82,7 +81,7 @@ class Timeline {
* apply animations on top of each other (layering).
* @param blend Controls how mixing is applied when <code>alpha</code> < 1.
* @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions,
* such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}, and others such as {@link ScaleTimeline}.
* such as spine.animation.DrawOrderTimeline or spine.animation.AttachmentTimeline, and others such as spine.animation.ScaleTimeline.
*/
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array<Event>, alpha:Float, blend:MixBlend, direction:MixDirection):Void {
throw new SpineException("Timeline implementations must override apply()");

View File

@ -32,24 +32,24 @@ package spine.animation;
import spine.animation.Listeners.EventListeners;
import spine.Poolable;
/** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.
/** Stores settings and other state for the playback of an animation on an spine.animation.AnimationState track.
* <p>
* References to a track entry must not be kept after the {@link AnimationStateListener#dispose(TrackEntry)} event occurs. */
* References to a track entry must not be kept after the AnimationStateListener.dispose(TrackEntry) event occurs. */
class TrackEntry implements Poolable {
/** The animation to apply for this track entry. */
public var animation:Animation;
/** The animation queued to start after this animation, or null if there is none. <code>next</code> makes up a doubly linked
/** The animation queued to start after this animation, or null if there is none. next makes up a doubly linked
* list.
* <p>
* See {@link AnimationState#clearNext(TrackEntry)} to truncate the list. */
* See spine.animation.AnimationState.clearNext(TrackEntry) to truncate the list. */
public var next:TrackEntry;
/** The animation queued to play before this animation, or null. <code>previous</code> makes up a doubly linked list. */
/** The animation queued to play before this animation, or null. previous makes up a doubly linked list. */
public var previous:TrackEntry;
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
* mixing is currently occurring. When mixing from multiple animations, <code>mixingFrom</code> makes up a linked list. */
* mixing is currently occurring. When mixing from multiple animations, mixingFrom makes up a linked list. */
public var mixingFrom:TrackEntry;
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
* currently occurring. When mixing to multiple animations, <code>mixingTo</code> makes up a linked list. */
* currently occurring. When mixing to multiple animations, mixingTo makes up a linked list. */
public var mixingTo:TrackEntry;
public var onStart:Listeners = new Listeners();
public var onInterrupt:Listeners = new Listeners();
@ -59,7 +59,7 @@ class TrackEntry implements Poolable {
public var onEvent:EventListeners = new EventListeners();
/** The index of the track where this track entry is either current or queued.
* <p>
* See {@link AnimationState#getCurrent(int)}. */
* See spine.animation.AnimationState.getCurrent(int). */
public var trackIndex:Int = 0;
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
* duration. */
@ -71,58 +71,58 @@ class TrackEntry implements Poolable {
* <p>
* 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 <code>holdPrevious</code> to true applies the first animation
* 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.
* <p>
* Snapping will occur if <code>holdPrevious</code> is true and this animation does not key all the same properties as the
* Snapping will occur if holdPrevious is true and this animation does not key all the same properties as the
* previous animation. */
public var holdPrevious:Bool = false;
/** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
* <code>eventThreshold</code>, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
/** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) 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. */
public var eventThreshold:Float = 0;
/** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
* <code>mixAttachmentThreshold</code>, attachment timelines are applied while this animation is being mixed out. Defaults
/** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) is less than the
* mixAttachmentThreshold, 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. */
public var mixAttachmentThreshold:Float = 0;
/** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
/** When TrackEntry.getAlpha() is greater than alphaAttachmentThreshold, attachment timelines are applied.
* Defaults to 0, so attachment timelines are always applied. */
public var alphaAttachmentThreshold:Float = 0;
/** 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
/** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) is less than the
* mixDrawOrderThreshold, 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. */
public var mixDrawOrderThreshold:Float = 0;
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
* <p>
* When changing the <code>animationStart</code> time, it often makes sense to set {@link #getAnimationLast()} to the same
* When changing the animationStart time, it often makes sense to set TrackEntry.getAnimationLast() to the same
* value to prevent timeline keys before the start time from triggering. */
public var animationStart:Float = 0;
/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
* loop back to {@link #getAnimationStart()} at this time. Defaults to the animation {@link Animation#duration}. */
* loop back to TrackEntry.getAnimationStart() at this time. Defaults to the animation spine.animation.Animation.duration. */
public var animationEnd:Float = 0;
/** 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 <code>animationLast</code> time (exclusive) and
* <code>animationTime</code> (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
* 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. */
public var animationLast:Float = 0;
public var nextAnimationLast:Float = 0;
/** Seconds to postpone playing the animation. Must be >= 0. When this track entry is the current track entry,
* <code>delay</code> postpones incrementing the {@link #getTrackTime()}. When this track entry is queued,
* <code>delay</code> 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#getTrackTime()} >= this track entry's
* <code>delay</code>).
* delay postpones incrementing the TrackEntry.getTrackTime(). 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 TrackEntry.getTrackTime() >= this track entry's
* delay).
* <p>
* {@link #getTimeScale()} affects the delay.
* TrackEntry.getTimeScale() affects the delay.
* <p>
* When passing <code>delay</code> <= 0 to {@link AnimationState#addAnimation(int, Animation, boolean, float)} this
* <code>delay</code> is set using a mix duration from {@link AnimationStateData}. To change the {@link #getMixDuration()}
* afterward, use {@link #setMixDuration(float, float)} so this <code>delay</code> is adjusted. */
* When passing delay <= 0 to spine.animation.AnimationState.addAnimation(int, Animation, boolean, float) this
* delay is set using a mix duration from spine.animation.AnimationStateData. To change the TrackEntry.getMixDuration()
* afterward, use TrackEntry.setMixDuration(float, float) so this delay is adjusted. */
public var delay(default, set):Float = 0;
/** Current time in seconds this track entry has been the current track entry. The track time determines
* {@link #getAnimationTime()}. The track time can be set to start the animation at a time other than 0, without affecting
* TrackEntry.getAnimationTime(). The track time can be set to start the animation at a time other than 0, without affecting
* looping. */
public var trackTime:Float = 0;
public var trackLast:Float = 0;
@ -132,22 +132,22 @@ class TrackEntry implements Poolable {
* 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.
* <p>
* It may be desired to use {@link AnimationState#addEmptyAnimation(int, float, float)} rather than have the animation
* It may be desired to use spine.animation.AnimationState.addEmptyAnimation(int, float, float) rather than have the animation
* abruptly cease being applied. */
public var trackEnd:Float = 0;
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
* faster. Defaults to 1.
* <p>
* Values < 0 are not supported. To play an animation in reverse, use {@link #getReverse()}.
* Values < 0 are not supported. To play an animation in reverse, use TrackEntry.getReverse().
* <p>
* {@link #getMixTime()} is not affected by track entry time scale, so {@link #getMixDuration()} may need to be adjusted to
* TrackEntry.getMixTime() is not affected by track entry time scale, so TrackEntry.getMixDuration() may need to be adjusted to
* match the animation speed.
* <p>
* When using {@link AnimationState#addAnimation(int, Animation, boolean, float)} with a <code>delay</code> <= 0, the
* {@link #getDelay()} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
* When using spine.animation.AnimationState.addAnimation(int, Animation, boolean, float) with a delay <= 0, the
* TrackEntry.getDelay() is set using the mix duration from the spine.animation.AnimationStateData, assuming time scale to be 1. If
* the time scale is not 1, the delay may need to be adjusted.
* <p>
* See AnimationState {@link AnimationState#getTimeScale()} for affecting all animations. */
* See AnimationState spine.animation.AnimationState.getTimeScale() for affecting all animations. */
public var timeScale:Float = 0;
/** 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.
@ -155,34 +155,34 @@ class TrackEntry implements Poolable {
* 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. */
public var alpha:Float = 0;
/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
* slightly more than <code>mixDuration</code> when the mix is complete. */
/** Seconds from 0 to the TrackEntry.getMixDuration() when mixing from the previous animation to this animation. May be
* slightly more than mixDuration when the mix is complete. */
public var mixTime:Float = 0;
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
* {@link AnimationStateData#getMix(Animation, Animation)} based on the animation before this animation (if any).
* spine.animation.AnimationStateData.getMix(Animation, Animation) based on the animation before this animation (if any).
* <p>
* 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. A mix duration of 0 can be set at any time to end the mix on the next
* {@link AnimationState#update(float) update}.
* spine.animation.AnimationState.update(float) update.
* <p>
* The <code>mixDuration</code> can be set manually rather than use the value from
* {@link AnimationStateData#getMix(Animation, Animation)}. In that case, the <code>mixDuration</code> can be set for a new
* track entry only before {@link AnimationState#update(float)} is first called.
* The mixDuration can be set manually rather than use the value from
* spine.animation.AnimationStateData.getMix(Animation, Animation). In that case, the mixDuration can be set for a new
* track entry only before spine.animation.AnimationState.update(float) is first called.
* <p>
* When using {@link AnimationState#addAnimation(int, Animation, boolean, float)} with a <code>delay</code> <= 0, the
* {@link #getDelay()} is set using the mix duration from the {@link AnimationStateData}. If <code>mixDuration</code> is set
* When using spine.animation.AnimationState.addAnimation(int, Animation, boolean, float) with a delay <= 0, the
* TrackEntry.getDelay() is set using the mix duration from the spine.animation.AnimationStateData. If mixDuration is set
* afterward, the delay may need to be adjusted. For example:<br>
* <code>entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;</code><br>
* Alternatively, {@link #setMixDuration(float, float)} can be used to recompute the delay:<br>
* <code>entry.setMixDuration(0.25f, 0);</code> */
* entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;<br>
* Alternatively, TrackEntry.setMixDuration(float, float) can be used to recompute the delay:<br>
* entry.setMixDuration(0.25f, 0); */
public var mixDuration:Float = 0;
public var interruptAlpha:Float = 0;
public var totalAlpha:Float = 0;
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}.
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to spine.animation.MixBlend.replace.
* <p>
* Track entries on track 0 ignore this setting and always use {@link MixBlend#first}.
* Track entries on track 0 ignore this setting and always use spine.animation.MixBlend.first.
* <p>
* The <code>mixBlend</code> can be set for a new track entry only before {@link AnimationState#apply(Skeleton)} is first
* The mixBlend can be set for a new track entry only before spine.animation.AnimationState.apply(Skeleton) is first
* called. */
public var mixBlend:MixBlend = MixBlend.replace;
public var timelineMode:Array<Int> = new Array<Int>();
@ -202,12 +202,12 @@ class TrackEntry implements Poolable {
public function new() {}
/** Uses {@link #getTrackTime()} to compute the <code>animationTime</code>. When the <code>trackTime</code> is 0, the
* <code>animationTime</code> is equal to the <code>animationStart</code> time.
/** Uses TrackEntry.getTrackTime() to compute the animationTime. When the trackTime is 0, the
* animationTime is equal to the animationStart time.
* <p>
* The <code>animationTime</code> is between {@link #getAnimationStart()} and {@link #getAnimationEnd()}, except if this
* track entry is non-looping and {@link #getAnimationEnd()} is >= to the animation {@link Animation#duration}, then
* <code>animationTime</code> continues to increase past {@link #getAnimationEnd()}. */
* The animationTime is between TrackEntry.getAnimationStart() and TrackEntry.getAnimationEnd(), except if this
* track entry is non-looping and TrackEntry.getAnimationEnd() is >= to the animation spine.animation.Animation.duration, then
* animationTime continues to increase past TrackEntry.getAnimationEnd(). */
public function getAnimationTime():Float {
if (loop) {
var duration:Float = animationEnd - animationStart;
@ -218,9 +218,9 @@ class TrackEntry implements Poolable {
return Math.min(trackTime + animationStart, animationEnd);
}
/** If this track entry is non-looping, the track time in seconds when {@link #getAnimationEnd()} is reached, or the current
* {@link #getTrackTime()} if it has already been reached. If this track entry is looping, the track time when this
* animation will reach its next {@link #getAnimationEnd()} (the next loop completion). */
/** If this track entry is non-looping, the track time in seconds when TrackEntry.getAnimationEnd() is reached, or the current
* TrackEntry.getTrackTime() if it has already been reached. If this track entry is looping, the track time when this
* animation will reach its next TrackEntry.getAnimationEnd() (the next loop completion). */
public function getTrackComplete():Float {
var duration:Float = animationEnd - animationStart;
if (duration != 0) {
@ -234,13 +234,13 @@ class TrackEntry implements Poolable {
/** Returns true if this track entry has been applied at least once.
* <p>
* See {@link AnimationState#apply(Skeleton)}. */
* See spine.animation.AnimationState.apply(Skeleton). */
public function wasApplied() {
return nextTrackLast != -1;
}
/** 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)}. */
/** Returns true if there is a TrackEntry.getNext() track entry and it will become the current track entry during the next
* spine.animation.AnimationState.update(float). */
public function isNextReady():Bool {
return next != null && nextTrackLast - next.delay >= 0;
}
@ -263,9 +263,9 @@ class TrackEntry implements Poolable {
}
/** 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 #getAlpha()} and starting animations on other tracks.
* long way around when using TrackEntry.getAlpha() and starting animations on other tracks.
* <p>
* Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
* Mixing with spine.animation.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. */
@ -273,10 +273,10 @@ class TrackEntry implements Poolable {
timelinesRotation.resize(0);
}
/** Sets both {@link #getMixDuration()} and {@link #getDelay()}.
* @param mixDuration If > 0, sets {@link TrackEntry#getDelay()}. If <= 0, the delay set is the duration of the previous track
* entry minus the specified mix duration plus the specified <code>delay</code> (ie the mix ends at
* (<code>delay</code> = 0) or before (<code>delay</code> < 0) the previous track entry duration). If the previous
/** Sets both TrackEntry.getMixDuration() and TrackEntry.getDelay().
* @param mixDuration If > 0, sets TrackEntry.getDelay(). If <= 0, the delay set is the duration of the previous track
* entry minus the specified 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. */
public function setMixDurationWithDelay(mixDuration:Float):Float {
this.mixDuration = mixDuration;

View File

@ -34,9 +34,9 @@ import spine.Skeleton;
import spine.TransformConstraint;
import spine.TransformConstraintData;
/** Changes a transform constraint's {@link TransformConstraint#mixRotate}, {@link TransformConstraint#mixX},
* {@link TransformConstraint#mixY}, {@link TransformConstraint#mixScaleX},
* {@link TransformConstraint#mixScaleY}, and {@link TransformConstraint#mixShearY}. */
/** Changes a transform constraint's spine.TransformConstraint.mixRotate, spine.TransformConstraint.mixX,
* spine.TransformConstraint.mixY, spine.TransformConstraint.mixScaleX,
* spine.TransformConstraint.mixScaleY, and spine.TransformConstraint.mixShearY. */
class TransformConstraintTimeline extends CurveTimeline {
static public inline var ENTRIES:Int = 7;
private static inline var ROTATE:Int = 1;
@ -46,7 +46,7 @@ class TransformConstraintTimeline extends CurveTimeline {
private static inline var SCALEY:Int = 5;
private static inline var SHEARY:Int = 6;
/** The index of the transform constraint in {@link Skeleton#transformConstraints} that will be changed when this
/** The index of the transform constraint in spine.Skeleton.transformConstraints that will be changed when this
* timeline is applied. */
public var constraintIndex:Int = 0;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#x} and {@link Bone#y}. */
/** Changes a bone's local spine.Bone.x and spine.Bone.y. */
class TranslateTimeline extends CurveTimeline2 implements BoneTimeline {
public var boneIndex:Int = 0;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local x value. */
/** Changes a bone's local spine.Bone.x. */
class TranslateXTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;

View File

@ -33,7 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
/** Changes a bone's local {@link Bone#y}. */
/** Changes a bone's local y translation. */
class TranslateYTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;

View File

@ -32,6 +32,12 @@ package spine.attachments;
import spine.atlas.TextureAtlas;
import spine.Skin;
/**
* The interface which can be implemented to customize creating and populating attachments.
* <p>
* See <a href='https://esotericsoftware.com/spine-loading-skeleton-data#AttachmentLoader'>Loading skeleton data</a> in the Spine
* Runtimes Guide.
*/
class AtlasAttachmentLoader implements AttachmentLoader {
private var atlas:TextureAtlas;
@ -53,6 +59,9 @@ class AtlasAttachmentLoader implements AttachmentLoader {
}
}
/**
* @return May be null to not load the attachment.
*/
public function newRegionAttachment(skin:Skin, name:String, path:String, sequence:Sequence):RegionAttachment {
var attachment = new RegionAttachment(name, path);
if (sequence != null) {
@ -66,6 +75,9 @@ class AtlasAttachmentLoader implements AttachmentLoader {
return attachment;
}
/**
* @return May be null to not load the attachment. In that case null should also be returned for child meshes.
*/
public function newMeshAttachment(skin:Skin, name:String, path:String, sequence:Sequence):MeshAttachment {
var attachment = new MeshAttachment(name, path);
if (sequence != null) {
@ -79,18 +91,30 @@ class AtlasAttachmentLoader implements AttachmentLoader {
return attachment;
}
/**
* @return May be null to not load the attachment.
*/
public function newBoundingBoxAttachment(skin:Skin, name:String):BoundingBoxAttachment {
return new BoundingBoxAttachment(name);
}
/**
* @return May be null to not load the attachment.
*/
public function newPathAttachment(skin:Skin, name:String):PathAttachment {
return new PathAttachment(name);
}
/**
* @return May be null to not load the attachment.
*/
public function newPointAttachment(skin:Skin, name:String):PointAttachment {
return new PointAttachment(name);
}
/**
* @return May be null to not load the attachment.
*/
public function newClippingAttachment(skin:Skin, name:String):ClippingAttachment {
return new ClippingAttachment(name);
}

View File

@ -54,7 +54,7 @@ class MeshAttachment extends VertexAttachment implements HasTextureRegion {
public var height:Float = 0;
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
public var hullLength:Int = 0;
/** Vertex index pairs describing edges for controlling triangulation, or be null if nonessential data was not exported. Mesh
/** Vertex index pairs describing edges for controlling triangulation, or null if nonessential data was not exported. Mesh
* triangles will never cross edges. Triangulation is not performed at runtime. */
public var edges = new Array<Int>();
public var rendererObject:Dynamic;
@ -65,13 +65,14 @@ class MeshAttachment extends VertexAttachment implements HasTextureRegion {
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
private var _parentMesh:MeshAttachment;
/** Copy constructor. Use newLinkedMesh() if the other mesh is a linked mesh. */
public function new(name:String, path:String) {
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. */
/** Calculates uvs using the regionUVs and region. Must be called if the region, the region's properties, or
* the regionUVs are changed. */
public function updateRegion():Void {
if (region == null) {
throw new SpineException("Region not set.");
@ -192,14 +193,14 @@ class MeshAttachment extends VertexAttachment implements HasTextureRegion {
return copy;
}
/** If the attachment has a {@link #sequence}, the region may be changed. */
/** If the attachment has a sequence, the region may be changed. */
public override function computeWorldVertices(slot:Slot, start:Int, count:Int, worldVertices:Array<Float>, offset:Int, stride:Int):Void {
if (sequence != null)
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. */
/** Returns a new mesh with the parentMesh set to this mesh's parent mesh, if any, else to this mesh. */
public function newLinkedMesh():MeshAttachment {
var copy:MeshAttachment = new MeshAttachment(name, path);
copy.rendererObject = rendererObject;

View File

@ -46,6 +46,7 @@ class PointAttachment extends VertexAttachment {
* attachments are not usually rendered at runtime. */
public var color:Color = new Color(0.38, 0.94, 0, 1);
/** Copy constructor. */
public function new(name:String) {
super(name);
}

View File

@ -66,7 +66,7 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
*
* See {@link #updateRegion()}. */
* See RegionAttachment.updateRegion(). */
private var offsets:Array<Float> = new Array<Float>();
public var uvs:Array<Float> = new Array<Float>();
@ -80,7 +80,7 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
this.path = path;
}
/** Calculates the {@link #offsets} and {@link #uvs} using the region and the attachment's transform. Must be called if the
/** Calculates the RegionAttachment.offsets and RegionAttachment.uvs using the region and the attachment's transform. Must be called if the
* region, the region's properties, or the transform are changed. */
public function updateRegion():Void {
if (region == null) {
@ -145,12 +145,11 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
}
}
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a RegionAttachment.sequence, the region may
* be changed.
*
* See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
* Runtimes Guide.
* @param slot The slot the attachment is bound to.
* @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. */

View File

@ -34,20 +34,20 @@ import spine.Skeleton;
import spine.Slot;
/** 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}. */
* spine.Slot.deform. */
class VertexAttachment extends Attachment {
private static var nextID:Int = 0;
/** The bones which affect the {@link vertices}. 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
/** The bones which affect the vertices. 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 spine.Skeleton.bones. Will be null
* if this attachment has no weights. */
public var bones:Array<Int>;
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are <code>x,y</code>
* entries for each vertex. For a weighted attachment, the values are <code>x,y,weight</code> entries for each bone affecting
/** 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. */
public var vertices = new Array<Float>();
/** The maximum number of world vertex values that can be output by
* {@link computeWorldVertices} using the <code>count</code> parameter. */
* computeWorldVertices() using the `count` parameter. */
public var worldVerticesLength:Int = 0;
/** Returns a unique ID for this attachment. */
public var id:Int = nextID++;
@ -60,17 +60,17 @@ class VertexAttachment extends Attachment {
timelineAttachment = this;
}
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
/** Transforms the attachment's local vertices to world coordinates. If the slot's spine.Slot.deform is
* not empty, it is used to deform the vertices.
* <p>
* See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> 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} - <code>start</code>.
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + <code>count</code> *
* <code>stride</code> / 2.
* @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. */
* @param start The index of the first vertices value to transform. Each vertex has 2 values, x and y.
* @param count The number of world vertex values to output. Must be <= 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. */
public function computeWorldVertices(slot:Slot, start:Int, count:Int, worldVertices:Array<Float>, offset:Int, stride:Int):Void {
count = offset + (count >> 1) * stride;
var skeleton:Skeleton = slot.skeleton;

View File

@ -79,6 +79,7 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
public var beforeUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {};
public var afterUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {};
/** Creates an uninitialized SkeletonSprite. The skeleton and animation state must be set before use. */
public function new(skeletonData:SkeletonData, animationStateData:AnimationStateData = null) {
super();
Bone.yDown = true;

View File

@ -98,7 +98,7 @@ public class Event {
return time;
}
/** The events's setup pose data. */
/** The event's setup pose data. */
public EventData getData () {
return data;
}