diff --git a/spine-haxe/spine-haxe/spine/BinaryInput.hx b/spine-haxe/spine-haxe/spine/BinaryInput.hx index dab9e5552..1af6cec4c 100644 --- a/spine-haxe/spine-haxe/spine/BinaryInput.hx +++ b/spine-haxe/spine-haxe/spine/BinaryInput.hx @@ -32,6 +32,9 @@ package spine; import haxe.io.FPHelper; import haxe.io.Bytes; +/** + * Input for reading skeleton data. + */ class BinaryInput { private var bytes:Bytes; private var index:Int = 0; diff --git a/spine-haxe/spine-haxe/spine/BlendMode.hx b/spine-haxe/spine-haxe/spine/BlendMode.hx index 9293ae753..d184999dc 100644 --- a/spine-haxe/spine-haxe/spine/BlendMode.hx +++ b/spine-haxe/spine-haxe/spine/BlendMode.hx @@ -29,6 +29,7 @@ package spine; +/** Determines how images are blended with existing pixels when drawn. */ class BlendMode { public static var normal(default, never):BlendMode = new BlendMode(0, "normal"); public static var additive(default, never):BlendMode = new BlendMode(1, "additive"); diff --git a/spine-haxe/spine-haxe/spine/Bone.hx b/spine-haxe/spine-haxe/spine/Bone.hx index b3535bbd1..3494741d5 100644 --- a/spine-haxe/spine-haxe/spine/Bone.hx +++ b/spine-haxe/spine-haxe/spine/Bone.hx @@ -29,6 +29,11 @@ package spine; +/** Stores a bone's current pose. + *
+ * A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a
+ * local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a
+ * constraint or application code modifies the world transform after it was computed from the local transform. */
class Bone implements Updatable {
static public var yDown:Bool = false;
@@ -37,48 +42,73 @@ class Bone implements Updatable {
private var _parent:Bone;
private var _children:Array
+ * See {@link #updateWorldTransformWith(float, float, float, float, float, float, float)}. */
public function updateWorldTransform():Void {
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY);
}
- /** Computes the world SRT using the parent bone and the specified local SRT. */
+ /** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
+ * specified local transform. Child bones are not updated.
+ *
+ * See World transforms in the Spine
+ * Runtimes Guide. */
public function updateWorldTransformWith(x:Float, y:Float, rotation:Float, scaleX:Float, scaleY:Float, shearX:Float, shearY:Float):Void {
ax = x;
ay = y;
@@ -234,6 +270,7 @@ class Bone implements Updatable {
d *= sy;
}
+ /** Sets this bone's local transform to the setup pose. */
public function setToSetupPose():Void {
x = data.x;
y = data.y;
@@ -245,10 +282,14 @@ class Bone implements Updatable {
inherit = data.inherit;
}
- /** Computes the individual applied transform values from the world transform. This can be useful to perform processing using
- * the applied transform after the world transform has been modified directly (eg, by a constraint).
+ /** Computes the applied transform values from the world transform.
*
- * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. */
+ * If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
+ * the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply another
+ * constraint).
+ *
+ * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
+ * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
public function updateAppliedTransform():Void {
var parent:Bone = parent;
if (parent == null) {
@@ -329,42 +370,58 @@ class Bone implements Updatable {
}
}
+ /** The world rotation for the X axis, calculated using {@link #a} and {@link #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}. */
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}. */
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}. */
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
+ * 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.
+ */
public function rotateWorld(degrees:Float):Void {
degrees *= MathUtils.degRad;
var sin:Float = Math.sin(degrees), cos:Float = Math.cos(degrees);
diff --git a/spine-haxe/spine-haxe/spine/BoneData.hx b/spine-haxe/spine-haxe/spine/BoneData.hx
index 29bb48beb..698f42914 100644
--- a/spine-haxe/spine-haxe/spine/BoneData.hx
+++ b/spine-haxe/spine-haxe/spine/BoneData.hx
@@ -29,23 +29,41 @@
package spine;
+/** Stores the setup pose for a {@link Bone}. */
class BoneData {
private var _index:Int;
private var _name:String;
private var _parent:BoneData;
+ /** The bone's length. */
public var length:Float = 0;
+ /** The local x translation. */
public var x:Float = 0;
+ /** The local y translation. */
public var y:Float = 0;
+ /** The local rotation in degrees, counter clockwise. */
public var rotation:Float = 0;
+ /** The local scaleX. */
public var scaleX:Float = 1;
+ /** The local scaleY. */
public var scaleY:Float = 1;
+ /** The local shearX. */
public var shearX:Float = 0;
+ /** The local shearY. */
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
+ * this bone.
+ *
+ * See {@link 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. */
public var color:Color = new Color(0, 0, 0, 0);
+ /** The bone icon as it was in Spine, or null if nonessential data was not exported. */
public var icon:String;
+ /** 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. */
@@ -59,12 +77,14 @@ class BoneData {
_parent = parent;
}
+ /** The index of the bone in {@link Skeleton#getBones()}. */
public var index(get, never):Int;
private function get_index():Int {
return _index;
}
+ /** The name of the bone, which is unique across all bones in the skeleton. */
public var name(get, never):String;
function get_name():String {
diff --git a/spine-haxe/spine-haxe/spine/Color.hx b/spine-haxe/spine-haxe/spine/Color.hx
index e9cb7ee01..a228f9bc6 100644
--- a/spine-haxe/spine-haxe/spine/Color.hx
+++ b/spine-haxe/spine-haxe/spine/Color.hx
@@ -29,6 +29,7 @@
package spine;
+/** A color class, storing the r, g, b and alpha components as floats in the range [0,1]. */
class Color {
public static var WHITE:Color = new Color(1, 1, 1, 1);
public static var RED:Color = new Color(1, 0, 0, 1);
diff --git a/spine-haxe/spine-haxe/spine/ConstraintData.hx b/spine-haxe/spine-haxe/spine/ConstraintData.hx
index 6bdde8587..1a1c6244b 100644
--- a/spine-haxe/spine-haxe/spine/ConstraintData.hx
+++ b/spine-haxe/spine-haxe/spine/ConstraintData.hx
@@ -29,9 +29,17 @@
package spine;
+/** The base class for all constraint datas. */
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(). */
public var order:Int = 0;
+ /** When true, Skeleton#updateWorldTransform() only updates this constraint if the Skeleton#getSkin()
+ * contains this constraint.
+ *
+ * See Skin#getConstraints(). */
public var skinRequired:Bool = false;
function new(name:String, order:Int, skinRequired:Bool) {
diff --git a/spine-haxe/spine-haxe/spine/Event.hx b/spine-haxe/spine-haxe/spine/Event.hx
index ef7856c8f..f100895bd 100644
--- a/spine-haxe/spine-haxe/spine/Event.hx
+++ b/spine-haxe/spine-haxe/spine/Event.hx
@@ -29,9 +29,16 @@
package spine;
+/** Stores the current pose values for an {@link Event}.
+ *
+ * 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
+ * Events in the Spine User Guide. */
class Event {
private var _data:EventData;
+ /** The animation time this event was keyed. */
public var time:Float = 0;
public var intValue:Int = 0;
public var floatValue:Float = 0;
@@ -46,6 +53,7 @@ class Event {
_data = data;
}
+ /** The event's setup pose data. */
public var data(get, never):EventData;
private function get_data():EventData {
diff --git a/spine-haxe/spine-haxe/spine/EventData.hx b/spine-haxe/spine-haxe/spine/EventData.hx
index 75f003db0..34c6c28ca 100644
--- a/spine-haxe/spine-haxe/spine/EventData.hx
+++ b/spine-haxe/spine-haxe/spine/EventData.hx
@@ -29,6 +29,9 @@
package spine;
+/** Stores the setup pose values for an {@link Event}.
+ *
+ * See Events in the Spine User Guide. */
class EventData {
private var _name:String;
@@ -45,6 +48,7 @@ class EventData {
_name = name;
}
+ /** The name of the event, which is unique across all events in the skeleton. */
public var name(get, never):String;
private function get_name():String {
diff --git a/spine-haxe/spine-haxe/spine/HasTextureRegion.hx b/spine-haxe/spine-haxe/spine/HasTextureRegion.hx
index be37e57c0..a34a79481 100644
--- a/spine-haxe/spine-haxe/spine/HasTextureRegion.hx
+++ b/spine-haxe/spine-haxe/spine/HasTextureRegion.hx
@@ -30,9 +30,15 @@
package spine;
interface HasTextureRegion {
+ /** The name used to find the {@link #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. */
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. */
public function updateRegion():Void;
}
diff --git a/spine-haxe/spine-haxe/spine/IkConstraint.hx b/spine-haxe/spine-haxe/spine/IkConstraint.hx
index 64f1373d8..c62015545 100644
--- a/spine-haxe/spine-haxe/spine/IkConstraint.hx
+++ b/spine-haxe/spine-haxe/spine/IkConstraint.hx
@@ -29,15 +29,32 @@
package spine;
+/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of
+ * the last bone is as close to the target bone as possible.
+ *
+ * See IK constraints in the Spine User Guide. */
class IkConstraint implements Updatable {
private var _data:IkConstraintData;
+ /** The bones that will be modified by this IK constraint. */
public var bones:Array
+ * 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
+ * > 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.
+ *
+ * For two bone IK: if the parent bone has local nonuniform scale, the child bone's local Y translation is set to 0. */
public var mix:Float = 0;
+ /** 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. */
public var softness:Float = 0;
public var active:Bool = false;
@@ -74,6 +91,7 @@ class IkConstraint implements Updatable {
stretch = data.stretch;
}
+ /** Applies the constraint to the constrained bones. */
public function update(physics:Physics):Void {
if (mix == 0)
return;
@@ -85,6 +103,7 @@ class IkConstraint implements Updatable {
}
}
+ /** The IK constraint's setup pose data. */
public var data(get, never):IkConstraintData;
private function get_data():IkConstraintData {
@@ -95,8 +114,7 @@ class IkConstraint implements Updatable {
return _data.name != null ? _data.name : "IkContstraint?";
}
- /** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world
- * coordinate system. */
+ /** Applies 1 bone IK. The target is specified in the world coordinate system. */
static public function apply1(bone:Bone, targetX:Float, targetY:Float, compress:Bool, stretch:Bool, uniform:Bool, alpha:Float):Void {
var p:Bone = bone.parent;
var pa:Float = p.a, pb:Float = p.b, pc:Float = p.c, pd:Float = p.d;
@@ -164,9 +182,8 @@ class IkConstraint implements Updatable {
bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY);
}
- /** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The
- * target is specified in the world coordinate system.
- * @param child Any descendant bone of the parent. */
+ /** Applies 2 bone IK. The target is specified in the world coordinate system.
+ * @param child A direct descendant of the parent bone. */
static public function apply2(parent:Bone, child:Bone, targetX:Float, targetY:Float, bendDir:Int, stretch:Bool, uniform:Bool, softness:Float,
alpha:Float):Void {
if (parent.inherit != Inherit.normal || child.inherit != Inherit.normal) return;
diff --git a/spine-haxe/spine-haxe/spine/IkConstraintData.hx b/spine-haxe/spine-haxe/spine/IkConstraintData.hx
index 9c05d84fb..a26aae5cd 100644
--- a/spine-haxe/spine-haxe/spine/IkConstraintData.hx
+++ b/spine-haxe/spine-haxe/spine/IkConstraintData.hx
@@ -29,14 +29,31 @@
package spine;
+/** Stores the setup pose for an {@link IkConstraint}.
+ *
+ * See IK constraints in the Spine User Guide. */
class IkConstraintData extends ConstraintData {
+ /** The bones that are constrained by this IK constraint. */
public var bones:Array
+ * See Path constraints in the Spine User Guide. */
class PathConstraintData extends ConstraintData {
+ /** The bones that will be modified by this path constraint. */
private var _bones:Array
+ * See Physics constraints in the Spine User Guide. */
class PhysicsConstraint implements Updatable {
private var _data:PhysicsConstraintData;
private var _bone:Bone = null;
@@ -108,6 +111,7 @@ class PhysicsConstraint implements Updatable {
return active;
}
+ /** Applies the constraint to the constrained bones. */
public function update(physics:Physics):Void {
var mix:Float = this.mix;
if (mix == 0) return;
@@ -291,6 +295,8 @@ class PhysicsConstraint implements Updatable {
bone.updateAppliedTransform();
}
+ /** Translates the physics constraint so next update(Physics) forces are applied as if the bone moved an additional
+ * amount in world space. */
public function translate (x:Float, y:Float):Void {
ux -= x;
uy -= y;
@@ -298,12 +304,15 @@ class PhysicsConstraint implements Updatable {
cy -= y;
}
+ /** Rotates the physics constraint so next update(Physics) forces are applied as if the bone rotated around the
+ * specified point in world space. */
public function rotate (x:Float, y:Float, degrees:Float):Void {
var r:Float = degrees * MathUtils.degRad, cos:Float = Math.cos(r), sin:Float = Math.sin(r);
var dx:Float = cx - x, dy:Float = cy - y;
translate(dx * cos - dy * sin - dx, dx * sin + dy * cos - dy);
}
+ /** The bone constrained by this physics constraint. */
public var bone(get, never):Bone;
private function get_bone():Bone {
@@ -312,6 +321,7 @@ class PhysicsConstraint implements Updatable {
else return _bone;
}
+ /** The physics constraint's setup pose data. */
public var data(get, never):PhysicsConstraintData;
private function get_data():PhysicsConstraintData {
diff --git a/spine-haxe/spine-haxe/spine/PhysicsConstraintData.hx b/spine-haxe/spine-haxe/spine/PhysicsConstraintData.hx
index 665e692f3..e646203bd 100644
--- a/spine-haxe/spine-haxe/spine/PhysicsConstraintData.hx
+++ b/spine-haxe/spine-haxe/spine/PhysicsConstraintData.hx
@@ -29,7 +29,11 @@
package spine;
+/** Stores the setup pose for a {@link PhysicsConstraint}.
+ *
+ * See Physics constraints in the Spine User Guide. */
class PhysicsConstraintData extends ConstraintData {
+ /** The bone constrained by this physics constraint. */
public var bone:BoneData;
public var x:Float = 0;
public var y:Float = 0;
@@ -44,6 +48,7 @@ class PhysicsConstraintData extends ConstraintData {
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;
public var inertiaGlobal:Bool = false;
public var strengthGlobal:Bool = false;
diff --git a/spine-haxe/spine-haxe/spine/Poolable.hx b/spine-haxe/spine-haxe/spine/Poolable.hx
index 8f6524ce5..1cd4dd791 100644
--- a/spine-haxe/spine-haxe/spine/Poolable.hx
+++ b/spine-haxe/spine-haxe/spine/Poolable.hx
@@ -29,6 +29,12 @@
package spine;
+/**
+ * Objects implementing this interface can be reset to prepare them for reuse by an object pool.
+ */
interface Poolable {
+ /**
+ * Resets this object to prepare it for reuse by an object pool.
+ */
function reset():Void;
}
diff --git a/spine-haxe/spine-haxe/spine/PositionMode.hx b/spine-haxe/spine-haxe/spine/PositionMode.hx
index 9fd0cef97..4c08d68a3 100644
--- a/spine-haxe/spine-haxe/spine/PositionMode.hx
+++ b/spine-haxe/spine-haxe/spine/PositionMode.hx
@@ -29,6 +29,10 @@
package spine;
+/** Controls how the first bone is positioned along the path.
+ *
+ * See Position mode in the Spine User
+ * Guide. */
class PositionMode {
public static var fixed(default, never):PositionMode = new PositionMode("fixed");
public static var percent(default, never):PositionMode = new PositionMode("percent");
diff --git a/spine-haxe/spine-haxe/spine/RotateMode.hx b/spine-haxe/spine-haxe/spine/RotateMode.hx
index 758a94635..93ce13798 100644
--- a/spine-haxe/spine-haxe/spine/RotateMode.hx
+++ b/spine-haxe/spine-haxe/spine/RotateMode.hx
@@ -29,9 +29,14 @@
package spine;
+/** Controls how bones are rotated, translated, and scaled to match the path.
+ *
+ * See Rotate mode in the Spine User Guide. */
class RotateMode {
public static var tangent(default, never):RotateMode = new RotateMode("tangent");
public static var chain(default, never):RotateMode = new RotateMode("chain");
+ /** When chain scale, constrained bones should all have the same parent. That way when the path constraint scales a bone, it
+ * doesn't affect other constrained bones. */
public static var chainScale(default, never):RotateMode = new RotateMode("chainScale");
public static var values(default, never):Array
+ * See Instance objects in the Spine
+ * Runtimes Guide. */
class Skeleton {
private static var quadTriangles:Array
+ * Bones that do not inherit scale are still affected by this property. */
public var scaleX:Float = 1;
+ /** Scales the entire skeleton on the Y axis.
+ *
+ * Bones that do not inherit scale are still affected by this property. */
public var scaleY(get, default):Float = 1;
function get_scaleY() {
return Bone.yDown ? -scaleY : scaleY;
}
+ /** Sets the skeleton X position, which is added to the root bone worldX position.
+ *
+ * Bones that do not inherit translation are still affected by this property. */
public var x:Float = 0;
+ /** Sets the skeleton Y position, which is added to the root bone worldY position.
+ *
+ * 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}.
+ *
+ * See {@link #update(float)}. */
public var time:Float = 0;
+ /** Creates a new skeleton with the specified skeleton data. */
public function new(data:SkeletonData) {
if (data == null) {
throw new SpineException("data cannot be null.");
@@ -115,8 +143,8 @@ class Skeleton {
updateCache();
}
- /** Caches information about bones and constraints. Must be called if bones, constraints, or weighted path attachments are
- * added or removed. */
+ /** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
+ * constraints, or weighted path attachments are added or removed. */
public function updateCache():Void {
_updateCache.resize(0);
@@ -350,7 +378,10 @@ class Skeleton {
}
}
- /** Updates the world transform for each bone and applies constraints. */
+ /** Updates the world transform for each bone and applies all constraints.
+ *
+ * See World transforms in the Spine
+ * Runtimes Guide. */
public function updateWorldTransform(physics:Physics):Void {
if (physics == null) throw new SpineException("physics is undefined");
for (bone in bones) {
@@ -368,6 +399,11 @@ class Skeleton {
}
}
+ /** Temporarily sets the root bone as a child of the specified bone, then updates the world transform for each bone and applies
+ * all constraints.
+ *
+ * See World transforms in the Spine
+ * Runtimes Guide. */
public function updateWorldTransformWith(physics:Physics, parent:Bone):Void {
// Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection.
var rootBone:Bone = rootBone;
@@ -396,7 +432,7 @@ class Skeleton {
}
}
- /** Sets the bones, constraints, and slots to their setup pose values. */
+ /** Sets the bones, constraints, slots, and draw order to their setup pose values. */
public function setToSetupPose():Void {
setBonesToSetupPose();
setSlotsToSetupPose();
@@ -411,6 +447,7 @@ class Skeleton {
for (constraint in this.physicsConstraints) constraint.setToSetupPose();
}
+ /** Sets the slots and draw order to their setup pose values. */
public function setSlotsToSetupPose():Void {
var i:Int = 0;
for (slot in slots) {
@@ -419,18 +456,21 @@ class Skeleton {
}
}
+ /** The skeleton's setup pose data. */
public var data(get, never):SkeletonData;
private function get_data():SkeletonData {
return _data;
}
- public var getUpdateCache(get, never):Array
+ * See {@link #setSkin(Skin)}. */
private function set_skinName(skinName:String):String {
var skin:Skin = data.findSkin(skinName);
if (skin == null)
@@ -492,16 +538,23 @@ class Skeleton {
return _skin == null ? null : _skin.name;
}
+ /** The skeleton's current skin. */
public var skin(get, set):Skin;
private function get_skin():Skin {
return _skin;
}
- /** Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default skin}.
- * 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.
- * @param newSkin May be null. */
+ /** 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.
+ *
+ * Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
+ * old skin, each slot's setup mode attachment is attached from the new skin.
+ *
+ * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
+ * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply(Skeleton)} 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 {
if (newSkin == _skin)
return null;
@@ -526,12 +579,18 @@ class Skeleton {
return _skin;
}
- /** @return May be null. */
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
+ * name.
+ *
+ * See {@link #getAttachment(int, String)}. */
public function getAttachmentForSlotName(slotName:String, attachmentName:String):Attachment {
return getAttachmentForSlotIndex(data.findSlot(slotName).index, attachmentName);
}
- /** @return May be null. */
+ /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
+ * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
+ *
+ * See Runtime skins in the Spine Runtimes Guide. */
public function getAttachmentForSlotIndex(slotIndex:Int, attachmentName:String):Attachment {
if (attachmentName == null)
throw new SpineException("attachmentName cannot be null.");
@@ -545,7 +604,9 @@ class Skeleton {
return null;
}
- /** @param attachmentName May be 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}.
+ * @param attachmentName May be null to clear the slot's attachment. */
public function setAttachment(slotName:String, attachmentName:String):Void {
if (slotName == null)
throw new SpineException("slotName cannot be null.");
@@ -567,7 +628,8 @@ class Skeleton {
throw new SpineException("Slot not found: " + slotName);
}
- /** @return May be null. */
+ /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
+ * than to call it repeatedly. */
public function findIkConstraint(constraintName:String):IkConstraint {
if (constraintName == null)
throw new SpineException("constraintName cannot be null.");
@@ -578,7 +640,8 @@ class Skeleton {
return null;
}
- /** @return May be null. */
+ /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
+ * this method than to call it repeatedly. */
public function findTransformConstraint(constraintName:String):TransformConstraint {
if (constraintName == null)
throw new SpineException("constraintName cannot be null.");
@@ -589,7 +652,8 @@ class Skeleton {
return null;
}
- /** @return May be null. */
+ /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
+ * than to call it repeatedly. */
public function findPathConstraint(constraintName:String):PathConstraint {
if (constraintName == null)
throw new SpineException("constraintName cannot be null.");
@@ -600,7 +664,8 @@ class Skeleton {
return null;
}
- /** @return May be null. */
+ /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
+ * method than to call it repeatedly. */
public function findPhysicsConstraint(constraintName:String):PhysicsConstraint {
if (constraintName == null)
throw new SpineException("constraintName cannot be null.");
@@ -618,6 +683,8 @@ class Skeleton {
private var _tempVertices = new Array
+ * See Data objects in the Spine Runtimes
+ * Guide. */
class SkeletonData {
- /** May be null. */
+ /** The skeleton's name, which by default is the name of the skeleton data file when possible, or null when a name hasn't been
+ * set. */
public var name:String;
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
public var bones:Array
+ * See {@link Skeleton#getAttachment(int, String)}. */
public var defaultSkin:Skin;
+ /** The skeleton's events. */
public var events:Array
+ * See {@link VertexAttachment#computeWorldVertices(Slot, int, int, float[], int, int)} and {@link DeformTimeline}. */
+
public var deform:Array
+ * See Spacing mode in the Spine User Guide. */
class SpacingMode {
public static var length(default, never):SpacingMode = new SpacingMode("length");
public static var fixed(default, never):SpacingMode = new SpacingMode("fixed");
diff --git a/spine-haxe/spine-haxe/spine/TransformConstraint.hx b/spine-haxe/spine-haxe/spine/TransformConstraint.hx
index b89a52cce..8f7b315f5 100644
--- a/spine-haxe/spine-haxe/spine/TransformConstraint.hx
+++ b/spine-haxe/spine-haxe/spine/TransformConstraint.hx
@@ -29,22 +29,34 @@
package spine;
+/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained
+ * bones to match that of the target bone.
+ *
+ * See Transform constraints in the Spine User Guide. */
class TransformConstraint implements Updatable {
private var _data:TransformConstraintData;
private var _bones:Array
+ * See Transform constraints in the Spine User Guide. */
class TransformConstraintData extends ConstraintData {
private var _bones:Array
+ * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
+ * @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
+ * See {@link VertexAttachment#getTimelineAttachment()}. */
public var attachment:VertexAttachment;
- /** The vertices for each key frame. */
+ /** The vertices for each frame. */
public var vertices:Array
+ * TrackEntry events are collected during {@link AnimationState#update(float)} and {@link AnimationState#apply(Skeleton)} and
+ * fired only after those methods are finished.
+ *
+ * See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
+ * {@link AnimationState#addListener(AnimationStateListener)}. */
class Listeners {
private var _listeners:Array
+ * TrackEntry events are collected during {@link AnimationState#update(float)} and {@link AnimationState#apply(Skeleton)} and
+ * fired only after those methods are finished.
+ *
+ * See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
+ * {@link AnimationState#addListener(AnimationStateListener)}. */
class EventListeners {
private var _listeners:Array
+ * Because this event is triggered at the end of {@link 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) {
listener(entry, event);
diff --git a/spine-haxe/spine-haxe/spine/animation/MixBlend.hx b/spine-haxe/spine-haxe/spine/animation/MixBlend.hx
index 0640c7ee1..0eba43214 100644
--- a/spine-haxe/spine-haxe/spine/animation/MixBlend.hx
+++ b/spine-haxe/spine-haxe/spine/animation/MixBlend.hx
@@ -29,6 +29,10 @@
package spine.animation;
+/** Controls how timeline values are mixed with setup pose values or current pose values when a timeline is applied with
+ *
+ * References to a track entry must not be kept after the {@link 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.
+ * See {@link AnimationState#clearNext(TrackEntry)} to truncate the list. */
public var next:TrackEntry;
+ /** The animation queued to play before this animation, or null.
+ * See {@link 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. */
public var loop:Bool = false;
+ /** If true, the animation will be applied in reverse. Events are not fired when an animation is applied in reverse. */
public var reverse:Bool = false;
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
+ * of being mixed out.
+ *
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
+ * while the second animation mixes from 0% to 100%. Setting
+ * Snapping will occur if
+ * When changing the
+ * It may be desired to use {@link 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.
+ *
+ * Values < 0 are not supported. To play an animation in reverse, use {@link #getReverse()}.
+ *
+ * {@link #getMixTime()} is not affected by track entry time scale, so {@link #getMixDuration()} may need to be adjusted to
+ * match the animation speed.
+ *
+ * When using {@link AnimationState#addAnimation(int, Animation, boolean, float)} with a
+ * See AnimationState {@link 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.
+ *
+ * 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
+ * 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}.
+ *
+ * The
+ * When using {@link AnimationState#addAnimation(int, Animation, boolean, float)} with a
+ * Track entries on track 0 ignore this setting and always use {@link MixBlend#first}.
+ *
+ * The
+ * If false, the shortest rotation direction is remembered when the mix starts and the same direction is used for the rest
+ * of the mix. Defaults to false. */
public var shortestRotation = false;
function set_delay(delay:Float):Float {
@@ -93,6 +202,12 @@ class TrackEntry implements Poolable {
public function new() {}
+ /** Uses {@link #getTrackTime()} to compute the
+ * The
+ * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
+ * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
+ * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
+ * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
public function resetRotationDirection():Void {
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
+ * See Loading skeleton data in the Spine
+ * Runtimes Guide. */
interface AttachmentLoader {
- /** @return May be null to not load an attachment. */
+ /** @return May be null to not load the attachment. */
function newRegionAttachment(skin:Skin, name:String, path:String, sequence:Sequence):RegionAttachment;
- /** @return May be null to not load an attachment. */
+ /** @return May be null to not load the attachment. In that case null should also be returned for child meshes. */
function newMeshAttachment(skin:Skin, name:String, path:String, sequence:Sequence):MeshAttachment;
- /** @return May be null to not load an attachment. */
+ /** @return May be null to not load the attachment. */
function newBoundingBoxAttachment(skin:Skin, name:String):BoundingBoxAttachment;
- /** @return May be null to not load an attachment */
+ /** @return May be null to not load the attachment. */
function newPathAttachment(skin:Skin, name:String):PathAttachment;
- /** @return May be null to not load an attachment */
+ /** @return May be null to not load the attachment. */
function newPointAttachment(skin:Skin, name:String):PointAttachment;
- /** @return May be null to not load an attachment */
+ /** @return May be null to not load the attachment. */
function newClippingAttachment(skin:Skin, name:String):ClippingAttachment;
}
diff --git a/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx b/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx
index cb4465812..733a4d8b8 100644
--- a/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx
@@ -29,6 +29,9 @@
package spine.attachments;
+/**
+ * The type of attachment.
+ */
class AttachmentType {
public static var region(default, never):AttachmentType = new AttachmentType(0, "region");
public static var boundingbox(default, never):AttachmentType = new AttachmentType(1, "boundingbox");
diff --git a/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx
index 14459d9e9..388c34e15 100644
--- a/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx
@@ -31,7 +31,14 @@ package spine.attachments;
import spine.Color;
+/** An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle
+ * effects, and more.
+ *
+ * See {@link SkeletonBounds} and Bounding Boxes in the Spine User
+ * Guide. */
class BoundingBoxAttachment extends VertexAttachment {
+ /** The color of the bounding box as it was in Spine, or a default color if nonessential data was not exported. Bounding boxes
+ * are not usually rendered at runtime. */
public var color:Color = new Color(0, 0, 0, 0);
public function new(name:String) {
diff --git a/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx
index 20dc3d4aa..5238926a3 100644
--- a/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx
@@ -32,8 +32,13 @@ package spine.attachments;
import spine.Color;
import spine.SlotData;
+/** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */
class ClippingAttachment extends VertexAttachment {
+ /** Clipping is performed between the clipping attachment's slot and the end slot. If null clipping is done until the end of
+ * the skeleton's rendering. */
public var endSlot:SlotData;
+ /** The color of the clipping attachment as it was in Spine, or a default color if nonessential data was not exported. Clipping
+ * attachments are not usually rendered at runtime. */
public var color:Color = new Color(0.2275, 0.2275, 0.2275, 1);
public function new(name:String) {
diff --git a/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx
index a05c05979..71e584aab 100644
--- a/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx
@@ -33,20 +33,36 @@ import spine.Color;
import spine.atlas.TextureAtlasRegion;
import spine.atlas.TextureAtlasPage;
+/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not
+ * supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
+ *
+ * See Mesh attachments in the Spine User Guide. */
class MeshAttachment extends VertexAttachment implements HasTextureRegion {
public var region:TextureRegion;
public var path:String;
+ /** The UV pair for each vertex, normalized within the texture region. */
public var regionUVs = new Array
+ * See {@link PathConstraint} and Paths in the Spine User Guide. */
class PathAttachment extends VertexAttachment {
+ /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
public var lengths:Array
+ * See Point Attachments in the Spine User Guide. */
class PointAttachment extends VertexAttachment {
public var x:Float = 0;
public var y:Float = 0;
public var rotation:Float = 0;
+ /** The color of the point attachment as it was in Spine, or a default color if nonessential data was not exported. Point
+ * attachments are not usually rendered at runtime. */
public var color:Color = new Color(0.38, 0.94, 0, 1);
public function new(name:String) {
diff --git a/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx
index 188352e2b..b9e9595b1 100644
--- a/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx
@@ -31,6 +31,9 @@ package spine.attachments;
import spine.Color;
+/** An attachment that displays a textured quadrilateral.
+ *
+ * See Region attachments in the Spine User Guide. */
class RegionAttachment extends Attachment implements HasTextureRegion {
public static inline var BLX:Int = 0;
public static inline var BLY:Int = 1;
@@ -41,12 +44,19 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
public static inline var BRX:Int = 6;
public static inline var BRY:Int = 7;
+ /** The local x translation. */
public var x:Float = 0;
+ /** The local y translation. */
public var y:Float = 0;
+ /** The local scaleX. */
public var scaleX:Float = 1;
+ /** The local scaleY. */
public var scaleY:Float = 1;
+ /** The local rotation. */
public var rotation:Float = 0;
+ /** The width of the region attachment in Spine. */
public var width:Float = 0;
+ /** The height of the region attachment in Spine. */
public var height:Float = 0;
public var color:Color = new Color(1, 1, 1, 1);
public var path:String;
@@ -54,15 +64,24 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
public var region:TextureRegion;
public var sequence:Sequence;
+ /** For each of the 4 vertices, a pair of
+ * See World transforms in the Spine
* Runtimes Guide.
* @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
- * @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
- * @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
- * `stride` / 2.
- * @param offset The `worldVertices` index to begin writing values.
- * @param stride The number of `worldVertices` entries between the value pairs written. */
+ * @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - 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 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 blend). 1 applies the timeline values. Between
+ * 0 and 1 applies values between the current or setup values and the timeline values. By adjusting
+ * 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 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}. */
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, loop:Bool, events:ArrayframeCount, inclusive.
+ * @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, attachmentName:String):Void {
frames[frame] = time;
attachmentNames[frame] = attachmentName;
diff --git a/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx b/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx
index fd229ea4d..ac40bd5ff 100644
--- a/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx
@@ -29,6 +29,8 @@
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. */
function getBoneIndex():Int;
}
diff --git a/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx b/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx
index 50e39c11d..2d3e3ab47 100644
--- a/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx
@@ -29,7 +29,7 @@
package spine.animation;
-/** Base class for frames that use an interpolation bezier curve. */
+/** The base class for timelines that interpolate between frame values using stepped, linear, or a Bezier curve. */
class CurveTimeline extends Timeline {
private static inline var LINEAR:Int = 0;
private static inline var STEPPED:Int = 1;
@@ -38,6 +38,8 @@ class CurveTimeline extends Timeline {
private var curves:ArrayframeCount - 1, inclusive. */
public function setLinear(frame:Int):Void {
curves[frame] = LINEAR;
}
+ /** Sets the specified frame to stepped interpolation.
+ * @param frame Between 0 and frameCount - 1, inclusive. */
public function setStepped(frame:Int):Void {
curves[frame] = STEPPED;
}
@@ -65,7 +71,7 @@ class CurveTimeline extends Timeline {
* @param bezier The ordinal of this Bezier curve for this timeline, between 0 and bezierCount - 1 (specified
* in the constructor), inclusive.
* @param frame Between 0 and frameCount - 1, inclusive.
- * @param value The index of the value for this frame that this curve is used for.
+ * @param value The index of the value for the frame this curve is used for.
* @param time1 The time for the first key.
* @param value1 The value for the first key.
* @param cx1 The time for the first Bezier handle.
@@ -105,7 +111,7 @@ 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 time.
* @param valueOffset The offset from frameIndex to the value this curve is used for.
- * @param i The index of the Bezier segments. See {@link #getCurveType(int)}. */
+ * @param i The index of the Bezier segments. See {@link #getCurveType}. */
public function getBezierValue(time:Float, frameIndex:Int, valueOffset:Int, i:Int):Float {
var x:Float, y:Float;
if (curves[i] > time) {
diff --git a/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx b/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx
index 60bc3f54b..882b00cda 100644
--- a/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx
+++ b/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx
@@ -44,7 +44,7 @@ class CurveTimeline1 extends CurveTimeline {
return ENTRIES;
}
- /** Sets the time and values for the specified frame.
+ /** Sets the time and value for the specified frame.
* @param frame Between 0 and frameCount, inclusive.
* @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, value1:Float):Void {
diff --git a/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx b/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx
index dc486eed0..cd295210d 100644
--- a/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx
@@ -36,13 +36,16 @@ import spine.Event;
import spine.Skeleton;
import spine.Slot;
+/** Changes a slot's {@link Slot#getDeform()} to deform a {@link VertexAttachment}. */
class DeformTimeline extends CurveTimeline implements SlotTimeline {
public var slotIndex:Int = 0;
- /** The attachment that will be deformed. */
+ /** The attachment that will be deformed.
+ * frameCount, inclusive.
+ * @param time The frame time in seconds.
+ * @param verticesOrDeform Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */
public function setFrame(frame:Int, time:Float, verticesOrDeform:Arraytime. */
private function getCurvePercent(time:Float, frame:Int):Float {
var i:Int = Std.int(curves[frame]);
var x:Float;
diff --git a/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx b/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx
index bc301a96f..0479bfe57 100644
--- a/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx
@@ -33,7 +33,9 @@ import spine.Event;
import spine.Skeleton;
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, ArrayframeCount, 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. */
public function setFrame(frame:Int, time:Float, drawOrder:ArrayframeCount, inclusive.
+ * @param event The event to set for the frame. */
public function setFrame(frame:Int, event:Event):Void {
frames[frame] = event.time;
events[frame] = event;
}
- /** Fires events for frames > `lastTime` and <= `time`. */
+ /** Fires events for frames > lastTime and <= time. */
public override function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:ArrayframeCount, 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. */
public function setFrame(frame:Int, time:Float, mix:Float, softness:Float, bendDirection:Int, compress:Bool, stretch:Bool):Void {
frame *= ENTRIES;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx b/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx
index 605eab100..68b9c08a2 100644
--- a/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's {@link Bone#getInherit()}. */
class InheritTimeline extends Timeline implements BoneTimeline {
public static inline var ENTRIES:Int = 2;
private static inline var INHERIT:Int = 1;
@@ -52,6 +53,10 @@ class InheritTimeline extends Timeline implements BoneTimeline {
return boneIndex;
}
+ /** Sets the inherit value for the specified frame.
+ * @param frame Between 0 and frameCount, inclusive.
+ * @param time The frame time in seconds.
+ * @param inherit The inherit value for this frame. */
public function setFrame(frame:Int, time:Float, inherit: Inherit):Void {
frame *= ENTRIES;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/Listeners.hx b/spine-haxe/spine-haxe/spine/animation/Listeners.hx
index de422b538..8832e1006 100644
--- a/spine-haxe/spine-haxe/spine/animation/Listeners.hx
+++ b/spine-haxe/spine-haxe/spine/animation/Listeners.hx
@@ -29,6 +29,14 @@
package spine.animation;
+/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
+ * events.
+ * alpha < 1.
+ *
+ * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}. */
class MixBlend {
public var ordinal:Int = 0;
@@ -36,8 +40,25 @@ class MixBlend {
this.ordinal = ordinal;
}
+ /** Transitions from the setup value to the timeline value (the current value is not used). Before the first frame, the
+ * 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.
+ *
+ * first 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);
+ /** Transitions from the current value to the timeline value. No change is made before the first frame (the current value is
+ * kept until the first frame).
+ *
+ * replace is intended for animations layered on top of others, not for the first animations applied. */
public static var replace(default, never):MixBlend = new MixBlend(2);
+ /** Transitions from the current value to the current value plus the timeline value. No change is made before the first
+ * frame (the current value is kept until the first frame).
+ *
+ * add is intended for animations layered on top of others, not for the first animations applied. Properties
+ * set by additive animations must be set manually or by another animation before applying the additive animations, else the
+ * property values will increase each time the additive animations are applied. */
public static var add(default, never):MixBlend = new MixBlend(3);
}
diff --git a/spine-haxe/spine-haxe/spine/animation/MixDirection.hx b/spine-haxe/spine-haxe/spine/animation/MixDirection.hx
index b379802ff..6a76efa0b 100644
--- a/spine-haxe/spine-haxe/spine/animation/MixDirection.hx
+++ b/spine-haxe/spine-haxe/spine/animation/MixDirection.hx
@@ -29,6 +29,10 @@
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). */
class MixDirection {
public var ordinal:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx
index 6c618eb99..38f54af0f 100644
--- a/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx
@@ -33,13 +33,16 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
+/** Changes a path constraint's {@link PathConstraint#getMixRotate()}, {@link PathConstraint#getMixX()}, and
+ * {@link PathConstraint#getMixY()}. */
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()} when this timeline is applied. */
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
+ * applied. */
public var constraintIndex:Int = 0;
public function new(frameCount:Int, bezierCount:Int, pathConstraintIndex:Int) {
@@ -51,6 +54,9 @@ class PathConstraintMixTimeline extends CurveTimeline {
return ENTRIES;
}
+ /** Sets the time and mix values for the specified frame.
+ * @param frame Between 0 and frameCount, inclusive.
+ * @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, mixRotate:Float, mixX:Float, mixY:Float):Void {
frame <<= 2;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx
index 94ea93a9b..d4b96f10e 100644
--- a/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx
@@ -33,8 +33,10 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
+/** Changes a path constraint's {@link PathConstraint#position}. */
class PathConstraintPositionTimeline extends CurveTimeline1 {
- /** The index of the path constraint in {@link Skeleton#pathConstraints} when this timeline is applied. */
+ /** The index of the path constraint in {@link Skeleton#pathConstraints} that will be changed when this timeline is
+ * applied. */
public var constraintIndex:Int = 0;
public function new(frameCount:Int, bezierCount:Int, pathConstraintIndex:Int) {
diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx
index 25bf25ee1..20f02b7a7 100644
--- a/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx
@@ -33,8 +33,10 @@ import spine.Event;
import spine.PathConstraint;
import spine.Skeleton;
+/** Changes a path constraint's {@link PathConstraint#spacing}. */
class PathConstraintSpacingTimeline extends CurveTimeline1 {
- /** The index of the path constraint in {@link Skeleton#pathConstraints} when this timeline is applied. */
+ /** The index of the path constraint in {@link Skeleton#pathConstraints} that will be changed when this timeline is
+ * applied. */
public var constraintIndex:Int = 0;
public function new(frameCount:Int, bezierCount:Int, pathConstraintIndex:Int) {
diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx
index 2706d2a51..544540603 100644
--- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx
@@ -29,7 +29,7 @@
package spine.animation;
-/** Changes a physics constraint's {@link PhysicsConstraint#getWind()}. */
+/** Changes a physics constraint's {@link PhysicsConstraint#getGravity()}. */
class PhysicsConstraintGravityTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx
index 1599eb06e..1cd15081b 100644
--- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx
@@ -29,7 +29,7 @@
package spine.animation;
-/** Changes a physics constraint's {@link PhysicsConstraint#getWind()}. */
+/** Changes a physics constraint's {@link PhysicsConstraint#getMix()}. */
class PhysicsConstraintMixTimeline extends PhysicsConstraintTimeline {
public function new(frameCount:Int, bezierCount:Int, physicsConstraintIndex:Int) {
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx
index d0b4482aa..07aae8c8b 100644
--- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx
@@ -33,11 +33,13 @@ import spine.animation.Timeline;
import spine.Event;
import spine.Skeleton;
+/** Resets a physics constraint when specific animation times are reached. */
class PhysicsConstraintResetTimeline extends Timeline {
/** The index of the physics constraint in {@link Skeleton#physicsConstraints} that will be reset when this timeline is
- * applied, or -1 if all physics constraints in the skeleton will be reset. */
+ * applied, or -1 if all physics constraints in the skeleton will be reset. */
public var constraintIndex:Int = 0;
+ /** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
public function new(frameCount:Int, physicsConstraintIndex:Int) {
propertyIds = [Std.string(Property.physicsConstraintReset)];
super(frameCount, propertyIds);
@@ -48,12 +50,13 @@ class PhysicsConstraintResetTimeline extends Timeline {
return frames.length;
}
- /** Sets the time in seconds and the event for the specified key frame. */
+ /** Sets the time for the specified frame.
+ * @param frame Between 0 and frameCount, inclusive. */
public function setFrame(frame:Int, time:Float):Void {
frames[frame] = time;
}
- /** Resets the physics constraint when frames > lastTime and <= time. */
+ /** Resets the physics constraint when frames > lastTime and <= time. */
public override function apply(skeleton:Skeleton, lastTime:Float, time:Float, firedEvents:ArrayframeCount, 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). */
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;
diff --git a/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx
index ae63d5014..115670830 100644
--- a/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx
@@ -29,6 +29,7 @@
package spine.animation;
+/** Changes a slot's {@link Slot#getColor()} and {@link 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;
@@ -54,11 +55,15 @@ 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. */
public function getSlotIndex():Int {
return slotIndex;
}
- /** Sets the time in seconds, light, and dark colors for the specified key frame. */
+ /** Sets the time, light color, and dark color for the specified frame.
+ * @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, r2:Float, g2:Float, b2:Float):Void {
frame <<= 3;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx
index b9983b0e8..413d0bc72 100644
--- a/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx
@@ -29,6 +29,7 @@
package spine.animation;
+/** Changes a slot's {@link Slot#getColor()}. */
class RGBATimeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 5;
private static inline var R:Int = 1;
@@ -51,7 +52,13 @@ class RGBATimeline extends CurveTimeline implements SlotTimeline {
return slotIndex;
}
- /** Sets the time in seconds, light, and dark colors for the specified key frame. */
+ /** Sets the time and color for the specified frame.
+ * @param frame Between 0 and frameCount, 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. */
public function setFrame(frame:Int, time:Float, r:Float, g:Float, b:Float, a:Float):Void {
frame *= ENTRIES;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx
index 161748998..6dc8b01c4 100644
--- a/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx
@@ -29,6 +29,7 @@
package spine.animation;
+/** Changes the RGB for a slot's {@link Slot#getColor()}. */
class RGBTimeline extends CurveTimeline implements SlotTimeline {
private static inline var ENTRIES:Int = 4;
private static inline var R:Int = 1;
@@ -50,7 +51,9 @@ class RGBTimeline extends CurveTimeline implements SlotTimeline {
return slotIndex;
}
- /** Sets the time in seconds, light, and dark colors for the specified key frame. */
+ /** Sets the time and color for the specified frame.
+ * @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):Void {
frame <<= 2;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx b/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx
index 005eb6ca7..06aebf04f 100644
--- a/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#rotation}. */
class RotateTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx
index 8c725aad4..de011141a 100644
--- a/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx
@@ -34,6 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#scaleX} and {@link Bone#scaleY}. */
class ScaleTimeline extends CurveTimeline2 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx
index 04c093205..f411dda05 100644
--- a/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx
@@ -34,6 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#scaleX}. */
class ScaleXTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx
index 2552368a0..0636fdcaf 100644
--- a/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx
@@ -34,6 +34,7 @@ import spine.Event;
import spine.MathUtils;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#scaleY}. */
class ScaleYTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx
index 1107e9842..158802a41 100644
--- a/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx
@@ -32,6 +32,7 @@ package spine.animation;
import spine.attachments.VertexAttachment;
import spine.attachments.Attachment;
+/** Changes a slot's {@link Slot#getSequenceIndex()} for an attachment's {@link Sequence}. */
class SequenceTimeline extends Timeline implements SlotTimeline {
static var ENTRIES = 3;
static var MODE = 1;
@@ -62,7 +63,10 @@ class SequenceTimeline extends Timeline implements SlotTimeline {
/** Sets the time, mode, index, and frame time for the specified frame.
* @param frame Between 0 and frameCount, inclusive.
- * @param time Seconds between frames. */
+ * @param time Seconds between frames.
+ * @param mode The sequence mode.
+ * @param index The sequence index.
+ * @param delay The delay between frames. */
public function setFrame(frame:Int, time:Float, mode:SequenceMode, index:Int, delay:Float) {
frame *= SequenceTimeline.ENTRIES;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx
index 8970c3d70..60f0fc8ee 100644
--- a/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#shearX} and {@link Bone#shearY}. */
class ShearTimeline extends CurveTimeline2 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx
index 5b700d70d..f056a29bf 100644
--- a/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#shearX}. */
class ShearXTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx
index 83f1b6cac..b44ee5716 100644
--- a/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#shearY}. */
class ShearYTimeline extends CurveTimeline1 implements BoneTimeline {
private var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx
index 1d2f73b51..8fe08bd27 100644
--- a/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx
@@ -29,6 +29,8 @@
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. */
function getSlotIndex():Int;
}
diff --git a/spine-haxe/spine-haxe/spine/animation/Timeline.hx b/spine-haxe/spine-haxe/spine/animation/Timeline.hx
index 59273c1d4..daa3b4629 100644
--- a/spine-haxe/spine-haxe/spine/animation/Timeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/Timeline.hx
@@ -32,32 +32,66 @@ package spine.animation;
import spine.Event;
import spine.Skeleton;
+/** The base class for all timelines. */
class Timeline {
+ /** Uniquely encodes both the type of this timeline and the skeleton properties that it affects. */
public var propertyIds:ArraylastTime (exclusive) and time (inclusive). Pass -1 the first time an animation is
+ * applied to ensure frame 0 is triggered.
+ * @param time The time in seconds that 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 last frame, the last frame will be
+ * applied.
+ * @param events If any events are fired, they are added to this list. Can be null to ignore fired events or if the timeline
+ * does not fire events.
+ * @param alpha 0 applies the current or setup value (depending on blend). 1 applies the timeline value.
+ * Between 0 and 1 applies a value between the current or setup value and the timeline value. By adjusting
+ * 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 alpha < 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}.
+ */
public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Arrayframes.
+ * @return The index of the first value <= time.
+ */
public static function search1(frames:Arrayframes.
+ * @return The index of the first value <= time.
+ */
public static function search(values:Arraynext makes up a doubly linked
+ * list.
+ * 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, 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, mixingTo makes up a linked list. */
public var mixingTo:TrackEntry;
public var onStart:Listeners = new Listeners();
public var onInterrupt:Listeners = new Listeners();
@@ -44,16 +57,54 @@ class TrackEntry implements Poolable {
public var onDispose:Listeners = new Listeners();
public var onComplete:Listeners = new Listeners();
public var onEvent:EventListeners = new EventListeners();
+ /** The index of the track where this track entry is either current or queued.
+ * 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.
+ * 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
+ * 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
+ * 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 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
+ * 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.
+ * animationStart time, it often makes sense to set {@link #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}. */
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 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;
@@ -70,20 +121,78 @@ class TrackEntry implements Poolable {
* afterward, use {@link #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
+ * looping. */
public var trackTime:Float = 0;
public var trackLast:Float = 0;
public var nextTrackLast:Float = 0;
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
+ * delay <= 0, the
+ * {@link #getDelay()} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
+ * the time scale is not 1, the delay may need to be adjusted.
+ * 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).
+ * mixDuration can be set manually rather than use the value from
+ * {@link AnimationStateData#getMix(Animation, Animation)}. In that case, the mixDuration can be set for a new
+ * track entry only before {@link AnimationState#update(float)} is first called.
+ * delay <= 0, the
+ * {@link #getDelay()} is set using the mix duration from the {@link AnimationStateData}. If mixDuration is set
+ * afterward, the delay may need to be adjusted. For example:
+ * entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;
+ * Alternatively, {@link #setMixDuration(float, float)} can be used to recompute the delay:
+ * 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}.
+ * mixBlend can be set for a new track entry only before {@link AnimationState#apply(Skeleton)} is first
+ * called. */
public var mixBlend:MixBlend = MixBlend.replace;
public var timelineMode:ArrayanimationTime. When the trackTime is 0, the
+ * animationTime is equal to the animationStart time.
+ * animationTime 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
+ * animationTime continues to increase past {@link #getAnimationEnd()}. */
public function getAnimationTime():Float {
if (loop) {
var duration:Float = animationEnd - animationStart;
@@ -147,10 +262,22 @@ class TrackEntry implements Poolable {
timelinesRotation.resize(0);
}
+ /** 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.
+ * 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;
if (delay <= 0) {
diff --git a/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx
index 4727fbd5d..c67874f48 100644
--- a/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx
@@ -34,6 +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}. */
class TransformConstraintTimeline extends CurveTimeline {
static public inline var ENTRIES:Int = 7;
private static inline var ROTATE:Int = 1;
@@ -43,7 +46,8 @@ class TransformConstraintTimeline extends CurveTimeline {
private static inline var SCALEY:Int = 5;
private static inline var SHEARY:Int = 6;
- /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
+ /** The index of the transform constraint in {@link Skeleton#transformConstraints} that will be changed when this
+ * timeline is applied. */
public var constraintIndex:Int = 0;
public function new(frameCount:Int, bezierCount:Int, transformConstraintIndex:Int) {
@@ -55,7 +59,9 @@ class TransformConstraintTimeline extends CurveTimeline {
return ENTRIES;
}
- /** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */
+ /** Sets the time, rotate mix, translate mix, scale mix, and shear mix for the specified frame.
+ * @param frame Between 0 and frameCount, inclusive.
+ * @param time The frame time in seconds. */
public function setFrame(frame:Int, time:Float, mixRotate:Float, mixX:Float, mixY:Float, mixScaleX:Float, mixScaleY:Float, mixShearY:Float):Void {
frame *= ENTRIES;
frames[frame] = time;
diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx
index b7ce20ec0..0202ae943 100644
--- a/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#x} and {@link Bone#y}. */
class TranslateTimeline extends CurveTimeline2 implements BoneTimeline {
public var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx
index a7d7c15b2..cc43a29fb 100644
--- a/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local x value. */
class TranslateXTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx
index 702c2e2ce..0ade5456c 100644
--- a/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx
+++ b/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx
@@ -33,6 +33,7 @@ import spine.Bone;
import spine.Event;
import spine.Skeleton;
+/** Changes a bone's local {@link Bone#y}. */
class TranslateYTimeline extends CurveTimeline1 implements BoneTimeline {
public var boneIndex:Int = 0;
diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx b/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx
index 37df62cd6..d19680041 100644
--- a/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx
+++ b/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx
@@ -29,10 +29,18 @@
package spine.atlas;
+/** The interface which can be implemented to customize loading images for texture atlas pages and regions. */
interface TextureLoader {
+ /** Loads a texture atlas page.
+ * @param page The page to load.
+ * @param path The path to the page image. */
function loadPage(page:TextureAtlasPage, path:String):Void;
+ /** Loads a texture atlas region.
+ * @param region The region to load. */
function loadRegion(region:TextureAtlasRegion):Void;
+ /** Unloads a texture atlas page.
+ * @param page The page to unload. */
function unloadPage(page:TextureAtlasPage):Void;
}
diff --git a/spine-haxe/spine-haxe/spine/attachments/Attachment.hx b/spine-haxe/spine-haxe/spine/attachments/Attachment.hx
index e54335ff7..984a4e94f 100644
--- a/spine-haxe/spine-haxe/spine/attachments/Attachment.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/Attachment.hx
@@ -29,6 +29,7 @@
package spine.attachments;
+/** The base class for all attachments. */
class Attachment {
private var _name:String;
@@ -39,6 +40,7 @@ class Attachment {
_name = name;
}
+ /** The attachment's name. */
public var name(get, never):String;
private function get_name():String {
@@ -49,6 +51,7 @@ class Attachment {
return name;
}
+ /** Returns a copy of the attachment. */
public function copy():Attachment {
throw new SpineException("Not implemented");
}
diff --git a/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx b/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx
index 612e53d6e..aabc04a65 100644
--- a/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx
+++ b/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx
@@ -31,22 +31,26 @@ package spine.attachments;
import spine.Skin;
+/** The interface which can be implemented to customize creating and populating attachments.
+ * x,y values that is the local position of the vertex.
+ *
+ * See {@link #updateRegion()}. */
private var offsets:Arrayoffset + 8.
+ * @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, worldVertices:Arrayx,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 Arraycount parameter. */
public var worldVerticesLength:Int = 0;
+ /** Returns a unique ID for this attachment. */
public var id:Int = nextID++;
+ /** Timelines for the timeline attachment are also applied to this attachment.
+ * May be null if no attachment-specific timelines should be applied. */
public var timelineAttachment:VertexAttachment;
public function new(name:String) {
@@ -49,15 +62,15 @@ class VertexAttachment extends Attachment {
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
* not empty, it is used to deform the vertices.
- *
- * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
+ * 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