AnimationState class
Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies multiple animations on top of each other (layering).
See Applying Animations in the Spine Runtimes Guide.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAnimation(
int trackIndex, Animation animation, bool loop, double delay) → TrackEntry -
Adds an
animation
to be played after the current or last queued animation for a track attrackIndex
. If the track is empty, it is equivalent to calling setAnimation. -
addAnimationByName(
int trackIndex, String animationName, bool loop, double delay) → TrackEntry - Queues an animation by name.
-
addEmptyAnimation(
int trackIndex, double mixDuration, double delay) → TrackEntry - Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's TrackEntry.getMixDuration. If the track is empty, it is equivalent to calling setEmptyAnimation.
-
apply(
Skeleton skeleton) → void - Poses the skeleton using the track entry animations. The animation state is not changed, so can be applied to multiple skeletons to pose them identically.
-
clearTrack(
int trackIndex) → void - Removes all animations from the track, leaving skeletons in their current pose.
-
clearTracks(
) → void - Removes all animations from all tracks, leaving skeletons in their current pose.
-
getCurrent(
int trackIndex) → TrackEntry? - Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing.
-
getData(
) → AnimationStateData - The AnimationStateData to look up mix durations.
-
getNumTracks(
) → int - Returns the number of tracks that have animations queued.
-
getTimeScale(
) → double - Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower or faster. Defaults to 1.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setAnimation(
int trackIndex, Animation animation, bool loop) → TrackEntry -
Sets the current
animation
for a track attrackIndex
, discarding any queued animations. If the formerly current track entry was never applied to a skeleton, it is replaced (not mixed from). -
setAnimationByName(
int trackIndex, String animationName, bool loop) → TrackEntry - Sets an animation by name.
-
setEmptyAnimation(
int trackIndex, double mixDuration) → TrackEntry -
Sets an empty animation for a track at
trackIndex
, discarding any queued animations, and sets the track entry's TrackEntry.getMixDuration tomixDuration
. An empty animation has no timelines and serves as a placeholder for mixing in or out. -
setEmptyAnimations(
double mixDuration) → void - Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration.
-
setListener(
AnimationStateListener? listener) → void - The listener for events generated for all tracks managed by the AnimationState, or null.
-
setTimeScale(
double timeScale) → void -
toString(
) → String -
A string representation of this object.
inherited
-
update(
double delta) → void - Increments each track entry TrackEntry.getTrackTime, setting queued animations as current if needed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited