[libgdx] Javadoc.

This commit is contained in:
Nathan Sweet 2026-03-24 20:02:18 -04:00
parent dffbc043f1
commit ca5ff77a8f
21 changed files with 111 additions and 48 deletions

View File

@ -91,13 +91,13 @@ public class BonePose implements Pose<BonePose>, Update {
this.scaleY = scaleY; this.scaleY = scaleY;
} }
/** Sets local x and y scale. */ /** Sets local scaleX and scaleY. */
public void setScale (float scaleX, float scaleY) { public void setScale (float scaleX, float scaleY) {
this.scaleX = scaleX; this.scaleX = scaleX;
this.scaleY = scaleY; this.scaleY = scaleY;
} }
/** Sets local x and y scale to the same value. */ /** Sets local scaleX and scaleY to the same value. */
public void setScale (float scale) { public void setScale (float scale) {
scaleX = scale; scaleX = scale;
scaleY = scale; scaleY = scale;

View File

@ -29,10 +29,11 @@
package com.esotericsoftware.spine; package com.esotericsoftware.spine;
import com.esotericsoftware.spine.Animation.EventTimeline;
import com.esotericsoftware.spine.Animation.Timeline; import com.esotericsoftware.spine.Animation.Timeline;
import com.esotericsoftware.spine.AnimationState.AnimationStateListener; import com.esotericsoftware.spine.AnimationState.AnimationStateListener;
/** Stores the current pose values for an {@link Event}. /** Fired by {@link EventTimeline} when specific animation times are reached.
* <p> * <p>
* See {@link Timeline#apply(Skeleton, float, float, com.badlogic.gdx.utils.Array, float, boolean, boolean, boolean, boolean)}, * See {@link Timeline#apply(Skeleton, float, float, com.badlogic.gdx.utils.Array, float, boolean, boolean, boolean, boolean)},
* {@link AnimationStateListener#event(com.esotericsoftware.spine.AnimationState.TrackEntry, Event)}, and * {@link AnimationStateListener#event(com.esotericsoftware.spine.AnimationState.TrackEntry, Event)}, and

View File

@ -29,6 +29,8 @@
package com.esotericsoftware.spine; package com.esotericsoftware.spine;
import com.badlogic.gdx.utils.Null;
/** Stores the setup pose values for an {@link Event}. /** Stores the setup pose values for an {@link Event}.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-events">Events</a> in the Spine User Guide. */
@ -36,7 +38,8 @@ public class EventData {
final String name; final String name;
int intValue; int intValue;
float floatValue; float floatValue;
String stringValue, audioPath; String stringValue;
@Null String audioPath;
float volume, balance; float volume, balance;
public EventData (String name) { public EventData (String name) {
@ -69,15 +72,17 @@ public class EventData {
this.stringValue = stringValue; this.stringValue = stringValue;
} }
public String getAudioPath () { /** Path to an audio file relative to the audio path in the Spine project. */
public @Null String getAudioPath () {
return audioPath; return audioPath;
} }
public void setAudioPath (String audioPath) { public void setAudioPath (@Null String audioPath) {
if (audioPath == null) throw new IllegalArgumentException("audioPath cannot be null."); if (audioPath == null) throw new IllegalArgumentException("audioPath cannot be null.");
this.audioPath = audioPath; this.audioPath = audioPath;
} }
/** If an audio path is set, the volume for the audio. */
public float getVolume () { public float getVolume () {
return volume; return volume;
} }
@ -86,6 +91,7 @@ public class EventData {
this.volume = volume; this.volume = volume;
} }
/** If an audio path is set, the left/right balance for the audio. */
public float getBalance () { public float getBalance () {
return balance; return balance;
} }

View File

@ -35,8 +35,8 @@ import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.BoneData.Inherit; import com.esotericsoftware.spine.BoneData.Inherit;
/** Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of /** Adjusts the local rotation of 1 or 2 constrained bones so the world position of the tip of the last bone is as close to the
* the last bone is as close to the target bone as possible. * target bone as possible.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-ik-constraints">IK constraints</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-ik-constraints">IK constraints</a> in the Spine User Guide. */
public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkConstraintPose> { public class IkConstraint extends Constraint<IkConstraint, IkConstraintData, IkConstraintPose> {

View File

@ -43,8 +43,7 @@ import com.esotericsoftware.spine.Skin.SkinEntry;
import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.PathAttachment; import com.esotericsoftware.spine.attachments.PathAttachment;
/** Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the /** Adjusts the rotation, translation, and scale of the constrained bones so they follow a {@link PathAttachment}.
* constrained bones so they follow a {@link PathAttachment}.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-path-constraints">Path constraints</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-path-constraints">Path constraints</a> in the Spine User Guide. */
public class PathConstraint extends Constraint<PathConstraint, PathConstraintData, PathConstraintPose> { public class PathConstraint extends Constraint<PathConstraint, PathConstraintData, PathConstraintPose> {

View File

@ -31,7 +31,7 @@ package com.esotericsoftware.spine;
import static com.esotericsoftware.spine.utils.SpineUtils.*; import static com.esotericsoftware.spine.utils.SpineUtils.*;
/** Stores the current pose for a physics constraint. A physics constraint applies physics to bones. /** Applies physics to a bone.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */
public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsConstraintData, PhysicsConstraintPose> { public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsConstraintData, PhysicsConstraintPose> {
@ -58,6 +58,8 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
return copy; return copy;
} }
/** Resets all physics state that was the result of previous movement. Use this after moving a bone to prevent physics from
* reacting to the movement. */
public void reset (Skeleton skeleton) { public void reset (Skeleton skeleton) {
remaining = 0; remaining = 0;
lastTime = skeleton.time; lastTime = skeleton.time;
@ -76,7 +78,7 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
scaleVelocity = 0; scaleVelocity = 0;
} }
/** Translates the physics constraint so next {@link #update(Skeleton, Physics)} forces are applied as if the bone moved an /** Translates the physics constraint so the next {@link #update(Skeleton, Physics)} forces are applied as if the bone moved an
* additional amount in world space. */ * additional amount in world space. */
public void translate (float x, float y) { public void translate (float x, float y) {
ux -= x; ux -= x;
@ -85,8 +87,8 @@ public class PhysicsConstraint extends Constraint<PhysicsConstraint, PhysicsCons
cy -= y; cy -= y;
} }
/** Rotates the physics constraint so next {@link #update(Skeleton, Physics)} forces are applied as if the bone rotated around /** Rotates the physics constraint so the next {@link #update(Skeleton, Physics)} forces are applied as if the bone rotated
* the specified point in world space. */ * around the specified point in world space. */
public void rotate (float x, float y, float degrees) { public void rotate (float x, float y, float degrees) {
float r = degrees * degRad, cos = cos(r), sin = sin(r); float r = degrees * degRad, cos = cos(r), sin = sin(r);
float dx = cx - x, dy = cy - y; float dx = cx - x, dy = cy - y;

View File

@ -54,6 +54,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.bone = bone; this.bone = bone;
} }
/** The time in milliseconds required to advanced the physics simulation one step. */
public float getStep () { public float getStep () {
return step; return step;
} }
@ -62,6 +63,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.step = step; this.step = step;
} }
/** Physics influence on x translation, 0-1. */
public float getX () { public float getX () {
return x; return x;
} }
@ -70,6 +72,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.x = x; this.x = x;
} }
/** Physics influence on y translation, 0-1. */
public float getY () { public float getY () {
return y; return y;
} }
@ -78,6 +81,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.y = y; this.y = y;
} }
/** Physics influence on rotation, 0-1. */
public float getRotate () { public float getRotate () {
return rotate; return rotate;
} }
@ -86,6 +90,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.rotate = rotate; this.rotate = rotate;
} }
/** Physics influence on scaleX, 0-1. */
public float getScaleX () { public float getScaleX () {
return scaleX; return scaleX;
} }
@ -94,6 +99,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.scaleX = scaleX; this.scaleX = scaleX;
} }
/** Physics influence on shearX, 0-1. */
public float getShearX () { public float getShearX () {
return shearX; return shearX;
} }
@ -102,6 +108,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.shearX = shearX; this.shearX = shearX;
} }
/** Movement greater than the limit will not have a greater affect on physics. */
public float getLimit () { public float getLimit () {
return limit; return limit;
} }
@ -110,6 +117,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.limit = limit; this.limit = limit;
} }
/** True when this constraint's inertia is controlled by global slider timelines. */
public boolean getInertiaGlobal () { public boolean getInertiaGlobal () {
return inertiaGlobal; return inertiaGlobal;
} }
@ -118,6 +126,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.inertiaGlobal = inertiaGlobal; this.inertiaGlobal = inertiaGlobal;
} }
/** True when this constraint's strength is controlled by global slider timelines. */
public boolean getStrengthGlobal () { public boolean getStrengthGlobal () {
return strengthGlobal; return strengthGlobal;
} }
@ -126,6 +135,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.strengthGlobal = strengthGlobal; this.strengthGlobal = strengthGlobal;
} }
/** True when this constraint's damping is controlled by global slider timelines. */
public boolean getDampingGlobal () { public boolean getDampingGlobal () {
return dampingGlobal; return dampingGlobal;
} }
@ -134,6 +144,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.dampingGlobal = dampingGlobal; this.dampingGlobal = dampingGlobal;
} }
/** True when this constraint's mass is controlled by global slider timelines. */
public boolean getMassGlobal () { public boolean getMassGlobal () {
return massGlobal; return massGlobal;
} }
@ -142,6 +153,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.massGlobal = massGlobal; this.massGlobal = massGlobal;
} }
/** True when this constraint's wind is controlled by global slider timelines. */
public boolean getWindGlobal () { public boolean getWindGlobal () {
return windGlobal; return windGlobal;
} }
@ -150,6 +162,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.windGlobal = windGlobal; this.windGlobal = windGlobal;
} }
/** True when this constraint's gravity is controlled by global slider timelines. */
public boolean getGravityGlobal () { public boolean getGravityGlobal () {
return gravityGlobal; return gravityGlobal;
} }
@ -158,6 +171,7 @@ public class PhysicsConstraintData extends ConstraintData<PhysicsConstraint, Phy
this.gravityGlobal = gravityGlobal; this.gravityGlobal = gravityGlobal;
} }
/** True when this constraint's mix is controlled by global slider timelines. */
public boolean getMixGlobal () { public boolean getMixGlobal () {
return mixGlobal; return mixGlobal;
} }

View File

@ -43,6 +43,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
mix = pose.mix; mix = pose.mix;
} }
/** Controls how much bone movement is converted into physics movement. */
public float getInertia () { public float getInertia () {
return inertia; return inertia;
} }
@ -51,6 +52,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.inertia = inertia; this.inertia = inertia;
} }
/** The amount of force used to return properties to the unconstrained value. */
public float getStrength () { public float getStrength () {
return strength; return strength;
} }
@ -59,6 +61,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.strength = strength; this.strength = strength;
} }
/** Reduces the speed of physics movements, with more of a reduction at higher speeds. */
public float getDamping () { public float getDamping () {
return damping; return damping;
} }
@ -67,6 +70,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.damping = damping; this.damping = damping;
} }
/** Determines susceptibility to acceleration. */
public float getMassInverse () { public float getMassInverse () {
return massInverse; return massInverse;
} }
@ -75,6 +79,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.massInverse = massInverse; this.massInverse = massInverse;
} }
/** Applies a constant force along the world X axis. */
public float getWind () { public float getWind () {
return wind; return wind;
} }
@ -83,6 +88,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.wind = wind; this.wind = wind;
} }
/** Applies a constant force along the world Y axis. */
public float getGravity () { public float getGravity () {
return gravity; return gravity;
} }
@ -91,7 +97,7 @@ public class PhysicsConstraintPose implements Pose<PhysicsConstraintPose> {
this.gravity = gravity; this.gravity = gravity;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */ /** A percentage (0+) that controls the mix between the constrained and unconstrained poses. */
public float getMix () { public float getMix () {
return mix; return mix;
} }

View File

@ -45,6 +45,7 @@ abstract public class PosedData<P extends Pose> {
return name; return name;
} }
/** The setup pose that most animations are relative to. */
public P getSetupPose () { public P getSetupPose () {
return setup; return setup;
} }

View File

@ -408,38 +408,38 @@ public class Skeleton {
* name. * name.
* <p> * <p>
* See {@link #getAttachment(int, String)}. */ * See {@link #getAttachment(int, String)}. */
public @Null Attachment getAttachment (String slotName, String attachmentName) { public @Null Attachment getAttachment (String slotName, String placeholderName) {
SlotData slot = data.findSlot(slotName); SlotData slot = data.findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
return getAttachment(slot.getIndex(), attachmentName); return getAttachment(slot.getIndex(), placeholderName);
} }
/** 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 {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and skin
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked. * placeholder name. First the skin is checked and if the attachment was not found, the default skin is checked.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */ * See <a href="https://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
public @Null Attachment getAttachment (int slotIndex, String attachmentName) { public @Null Attachment getAttachment (int slotIndex, String placeholderName) {
if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null."); if (placeholderName == null) throw new IllegalArgumentException("placeholderName cannot be null.");
if (skin != null) { if (skin != null) {
Attachment attachment = skin.getAttachment(slotIndex, attachmentName); Attachment attachment = skin.getAttachment(slotIndex, placeholderName);
if (attachment != null) return attachment; if (attachment != null) return attachment;
} }
if (data.defaultSkin != null) return data.defaultSkin.getAttachment(slotIndex, attachmentName); if (data.defaultSkin != null) return data.defaultSkin.getAttachment(slotIndex, placeholderName);
return null; return null;
} }
/** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with /** 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 SlotPose#attachment}. * {@link #getAttachment(int, String)}, then setting the slot's {@link SlotPose#attachment}.
* @param attachmentName May be null to clear the slot's attachment. */ * @param placeholderName May be null to clear the slot's attachment. */
public void setAttachment (String slotName, @Null String attachmentName) { public void setAttachment (String slotName, @Null String placeholderName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Slot slot = findSlot(slotName); Slot slot = findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
Attachment attachment = null; Attachment attachment = null;
if (attachmentName != null) { if (placeholderName != null) {
attachment = getAttachment(slot.data.index, attachmentName); attachment = getAttachment(slot.data.index, placeholderName);
if (attachment == null) if (attachment == null)
throw new IllegalArgumentException("Attachment not found: " + attachmentName + ", for slot: " + slotName); throw new IllegalArgumentException("Attachment not found: " + placeholderName + ", for slot: " + slotName);
} }
slot.pose.setAttachment(attachment); slot.pose.setAttachment(attachment);
} }
@ -449,10 +449,13 @@ public class Skeleton {
return constraints; return constraints;
} }
/** The skeleton's physics constraints. */
public Array<PhysicsConstraint> getPhysicsConstraints () { public Array<PhysicsConstraint> getPhysicsConstraints () {
return physics; return physics;
} }
/** Finds a constraint of the specified type by comparing each constraints's name. It is more efficient to cache the results of
* this method than to call it multiple times. */
public @Null <T extends Constraint> T findConstraint (String constraintName, Class<T> type) { public @Null <T extends Constraint> T findConstraint (String constraintName, Class<T> type) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type == null) throw new IllegalArgumentException("type cannot be null.");
@ -604,6 +607,7 @@ public class Skeleton {
this.y = y; this.y = y;
} }
/** The x component of a vector that defines the direction {@link PhysicsConstraintPose#getWind()} is applied. */
public float getWindX () { public float getWindX () {
return windX; return windX;
} }
@ -612,6 +616,7 @@ public class Skeleton {
this.windX = windX; this.windX = windX;
} }
/** The y component of a vector that defines the direction {@link PhysicsConstraintPose#getWind()} is applied. */
public float getWindY () { public float getWindY () {
return windY; return windY;
} }
@ -620,6 +625,7 @@ public class Skeleton {
this.windY = windY; this.windY = windY;
} }
/** The x component of a vector that defines the direction {@link PhysicsConstraintPose#getGravity()} is applied. */
public float getGravityX () { public float getGravityX () {
return gravityX; return gravityX;
} }
@ -628,6 +634,7 @@ public class Skeleton {
this.gravityX = gravityX; this.gravityX = gravityX;
} }
/** The y component of a vector that defines the direction {@link PhysicsConstraintPose#getGravity()} is applied. */
public float getGravityY () { public float getGravityY () {
return gravityY; return gravityY;
} }

View File

@ -168,6 +168,8 @@ public class SkeletonData {
return constraints; return constraints;
} }
/** Finds a constraint of the specified type by comparing each constraints's name. It is more efficient to cache the results of
* this method than to call it multiple times. */
public @Null <T extends ConstraintData> T findConstraint (String constraintName, Class<T> type) { public @Null <T extends ConstraintData> T findConstraint (String constraintName, Class<T> type) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type == null) throw new IllegalArgumentException("type cannot be null.");
@ -255,7 +257,7 @@ public class SkeletonData {
this.hash = hash; this.hash = hash;
} }
/** The path to the images directory as defined in Spine, or null if nonessential data was not exported. */ /** The path to the images folder as defined in Spine, or null if nonessential data was not exported. */
public @Null String getImagesPath () { public @Null String getImagesPath () {
return imagesPath; return imagesPath;
} }
@ -264,7 +266,7 @@ public class SkeletonData {
this.imagesPath = imagesPath; this.imagesPath = imagesPath;
} }
/** The path to the audio directory as defined in Spine, or null if nonessential data was not exported. */ /** The path to the audio folder as defined in Spine, or null if nonessential data was not exported. */
public @Null String getAudioPath () { public @Null String getAudioPath () {
return audioPath; return audioPath;
} }

View File

@ -186,6 +186,7 @@ public class Skin {
hashCode = placeholderName.hashCode() + slotIndex * 37; hashCode = placeholderName.hashCode() + slotIndex * 37;
} }
/** The {@link Skeleton#getSlots()} index. */
public int getSlotIndex () { public int getSlotIndex () {
return slotIndex; return slotIndex;
} }
@ -195,6 +196,7 @@ public class Skin {
return placeholderName; return placeholderName;
} }
/** The attachment for this skin entry. */
public Attachment getAttachment () { public Attachment getAttachment () {
return attachment; return attachment;
} }

View File

@ -34,9 +34,9 @@ import com.esotericsoftware.spine.Animation.PhysicsConstraintTimeline;
import com.esotericsoftware.spine.Animation.SlotTimeline; import com.esotericsoftware.spine.Animation.SlotTimeline;
import com.esotericsoftware.spine.Animation.Timeline; import com.esotericsoftware.spine.Animation.Timeline;
/** Stores the setup pose for a {@link PhysicsConstraint}. /** Applies an animation based on either the slider's {@link SliderPose#time} or a bone's transform property.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-physics-constraints">Physics constraints</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-sliders">Sliders</a> in the Spine User Guide. */
public class Slider extends Constraint<Slider, SliderData, SliderPose> { public class Slider extends Constraint<Slider, SliderData, SliderPose> {
static private final float[] offsets = new float[6]; static private final float[] offsets = new float[6];
@ -114,6 +114,7 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
} }
} }
/** When set, the bone's transform property is used to set the slider's {@link SliderPose#time}. */
public Bone getBone () { public Bone getBone () {
return bone; return bone;
} }

View File

@ -50,6 +50,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
return new Slider(this, skeleton); return new Slider(this, skeleton);
} }
/** The animation the slider will apply. */
public Animation getAnimation () { public Animation getAnimation () {
return animation; return animation;
} }
@ -58,6 +59,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.animation = animation; this.animation = animation;
} }
/** When true, the animation is applied by adding it to the current pose rather than overwriting it. */
public boolean getAdditive () { public boolean getAdditive () {
return additive; return additive;
} }
@ -66,6 +68,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.additive = additive; this.additive = additive;
} }
/** When true, the animation repeats after its duration, otherwise the last frame is used. */
public boolean getLoop () { public boolean getLoop () {
return loop; return loop;
} }
@ -74,6 +77,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.loop = loop; this.loop = loop;
} }
/** When set, the bone's transform property is used to set the slider's {@link SliderPose#time}. */
public @Null BoneData getBone () { public @Null BoneData getBone () {
return bone; return bone;
} }
@ -82,6 +86,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.bone = bone; this.bone = bone;
} }
/** When a bone is set, the specified transform property is used to set the slider's {@link SliderPose#time}. */
public @Null FromProperty getProperty () { public @Null FromProperty getProperty () {
return property; return property;
} }
@ -90,6 +95,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.property = property; this.property = property;
} }
/** When a bone is set, the offset is added to the property. */
public float getOffset () { public float getOffset () {
return offset; return offset;
} }
@ -98,6 +104,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.offset = offset; this.offset = offset;
} }
/** When a bone is set, this is the scale of the {@link #property} value in relation to the slider time. */
public float getScale () { public float getScale () {
return scale; return scale;
} }
@ -106,6 +113,7 @@ public class SliderData extends ConstraintData<Slider, SliderPose> {
this.scale = scale; this.scale = scale;
} }
/** When true and a bone is set, the bone's local transform property is read instead of its world transform. */
public boolean getLocal () { public boolean getLocal () {
return local; return local;
} }

View File

@ -38,6 +38,7 @@ public class SliderPose implements Pose<SliderPose> {
mix = pose.mix; mix = pose.mix;
} }
/** The time in the {@link SliderData#animation} to apply the animation. */
public float getTime () { public float getTime () {
return time; return time;
} }
@ -46,6 +47,7 @@ public class SliderPose implements Pose<SliderPose> {
this.time = time; this.time = time;
} }
/** A percentage that controls the mix between the constrained and unconstrained poses. */
public float getMix () { public float getMix () {
return mix; return mix;
} }

View File

@ -31,9 +31,10 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store /** Organizes attachments for {@link Skeleton#drawOrder} purposes and provide a place to store state for an attachment.
* state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared * <p>
* across multiple skeletons. */ * State cannot be stored in an attachment itself because attachments are stateless and may be shared across multiple
* skeletons. */
public class Slot extends Posed<SlotData, SlotPose> { public class Slot extends Posed<SlotData, SlotPose> {
final Skeleton skeleton; final Skeleton skeleton;
final Bone bone; final Bone bone;

View File

@ -38,9 +38,7 @@ import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.Sequence; import com.esotericsoftware.spine.attachments.Sequence;
import com.esotericsoftware.spine.attachments.VertexAttachment; import com.esotericsoftware.spine.attachments.VertexAttachment;
/** Stores a slot's pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store state /** Stores a slot's pose. */
* for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared across
* multiple skeletons. */
public class SlotPose implements Pose<SlotPose> { public class SlotPose implements Pose<SlotPose> {
final Color color = new Color(1, 1, 1, 1); final Color color = new Color(1, 1, 1, 1);
@Null Color darkColor; @Null Color darkColor;

View File

@ -36,8 +36,7 @@ import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.TransformConstraintData.FromProperty; import com.esotericsoftware.spine.TransformConstraintData.FromProperty;
import com.esotericsoftware.spine.TransformConstraintData.ToProperty; import com.esotericsoftware.spine.TransformConstraintData.ToProperty;
/** Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained /** Adjusts the world transform of the constrained bones to match that of the source bone.
* bones to match that of the source bone.
* <p> * <p>
* See <a href="https://esotericsoftware.com/spine-transform-constraints">Transform constraints</a> in the Spine User Guide. */ * See <a href="https://esotericsoftware.com/spine-transform-constraints">Transform constraints</a> in the Spine User Guide. */
public class TransformConstraint extends Constraint<TransformConstraint, TransformConstraintData, TransformConstraintPose> { public class TransformConstraint extends Constraint<TransformConstraint, TransformConstraintData, TransformConstraintPose> {

View File

@ -42,7 +42,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
mixShearY = pose.mixShearY; mixShearY = pose.mixShearY;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. */ /** A percentage that controls the mix between the constrained and unconstrained rotation. */
public float getMixRotate () { public float getMixRotate () {
return mixRotate; return mixRotate;
} }
@ -51,7 +51,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixRotate = mixRotate; this.mixRotate = mixRotate;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained translation X. */ /** A percentage that controls the mix between the constrained and unconstrained translation X. */
public float getMixX () { public float getMixX () {
return mixX; return mixX;
} }
@ -60,7 +60,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixX = mixX; this.mixX = mixX;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained translation Y. */ /** A percentage that controls the mix between the constrained and unconstrained translation Y. */
public float getMixY () { public float getMixY () {
return mixY; return mixY;
} }
@ -69,7 +69,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixY = mixY; this.mixY = mixY;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. */ /** A percentage that controls the mix between the constrained and unconstrained scale X. */
public float getMixScaleX () { public float getMixScaleX () {
return mixScaleX; return mixScaleX;
} }
@ -78,7 +78,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixScaleX = mixScaleX; this.mixScaleX = mixScaleX;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. */ /** A percentage that controls the mix between the constrained and unconstrained scale X. */
public float getMixScaleY () { public float getMixScaleY () {
return mixScaleY; return mixScaleY;
} }
@ -87,7 +87,7 @@ public class TransformConstraintPose implements Pose<TransformConstraintPose> {
this.mixScaleY = mixScaleY; this.mixScaleY = mixScaleY;
} }
/** A percentage (0-1) that controls the mix between the constrained and unconstrained shear Y. */ /** A percentage that controls the mix between the constrained and unconstrained shear Y. */
public float getMixShearY () { public float getMixShearY () {
return mixShearY; return mixShearY;
} }

View File

@ -60,7 +60,7 @@ public class PointAttachment extends Attachment {
color.set(other.color); color.set(other.color);
} }
/** The local X position. */ /** The local x position. */
public float getX () { public float getX () {
return x; return x;
} }
@ -69,7 +69,7 @@ public class PointAttachment extends Attachment {
this.x = x; this.x = x;
} }
/** The local Y position. */ /** The local y position. */
public float getY () { public float getY () {
return y; return y;
} }

View File

@ -46,6 +46,9 @@ public class Sequence {
private float[][] uvs, offsets; private float[][] uvs, offsets;
private int start, digits, setupIndex; private int start, digits, setupIndex;
/** @param count The number of texture regions this sequence will display.
* @param pathSuffix If true, the {@link #getPath(String, int) path} has a numeric suffix. If false, all regions will use the
* same path, so <code>count</code> should be 1. */
public Sequence (int count, boolean pathSuffix) { public Sequence (int count, boolean pathSuffix) {
regions = new TextureRegion[count]; regions = new TextureRegion[count];
this.pathSuffix = pathSuffix; this.pathSuffix = pathSuffix;
@ -95,10 +98,12 @@ public class Sequence {
} }
} }
/** The list of texture regions this sequence will display. */
public TextureRegion[] getRegions () { public TextureRegion[] getRegions () {
return regions; return regions;
} }
/** Returns the {@link #getRegions()} index for the {@link SlotPose#getSequenceIndex()}. */
public int resolveIndex (SlotPose pose) { public int resolveIndex (SlotPose pose) {
int index = pose.getSequenceIndex(); int index = pose.getSequenceIndex();
if (index == -1) index = setupIndex; if (index == -1) index = setupIndex;
@ -106,10 +111,13 @@ public class Sequence {
return index; return index;
} }
/** Returns the texture region from {@link #getRegions()} for the specified index. */
public TextureRegion getRegion (int index) { public TextureRegion getRegion (int index) {
return regions[index]; return regions[index];
} }
/** Returns the UVs for the specified index. {@link #getRegions() Regions} must be populated and {@link #update(HasSequence)}
* called before calling this method. */
public float[] getUVs (int index) { public float[] getUVs (int index) {
return uvs[index]; return uvs[index];
} }
@ -119,6 +127,7 @@ public class Sequence {
return offsets[index]; return offsets[index];
} }
/** The starting number for the numeric {@link #getPath(String, int) path} suffix. */
public int getStart () { public int getStart () {
return start; return start;
} }
@ -127,6 +136,8 @@ public class Sequence {
this.start = start; this.start = start;
} }
/** The minimum number of digits in the numeric {@link #getPath(String, int) path} suffix, for zero padding. 0 for no zero
* padding. */
public int getDigits () { public int getDigits () {
return digits; return digits;
} }
@ -144,10 +155,12 @@ public class Sequence {
this.setupIndex = index; this.setupIndex = index;
} }
/** Returns true if the {@link #getPath(String, int) path} has a numeric suffix. */
public boolean hasPathSuffix () { public boolean hasPathSuffix () {
return pathSuffix; return pathSuffix;
} }
/** Returns the specified base path with an optional numeric suffix for the specified index. */
public String getPath (String basePath, int index) { public String getPath (String basePath, int index) {
if (!pathSuffix) return basePath; if (!pathSuffix) return basePath;
var buffer = new StringBuilder(basePath.length() + digits); var buffer = new StringBuilder(basePath.length() + digits);
@ -168,6 +181,7 @@ public class Sequence {
return nextID++; return nextID++;
} }
/** Controls how {@link Sequence#getRegions()} are displayed over time. */
static public enum SequenceMode { static public enum SequenceMode {
hold, once, loop, pingpong, onceReverse, loopReverse, pingpongReverse; hold, once, loop, pingpong, onceReverse, loopReverse, pingpongReverse;