setAnimation method
Sets the current animation
for a track at trackIndex
, discarding any queued animations. If the formerly current track entry was never
applied to a skeleton, it is replaced (not mixed from).
If loop
is true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
duration. In either case TrackEntry.getTrackEnd determines when the track is cleared.
Returns a track entry to allow further customization of animation playback. References to the track entry must not be kept after the EventType.dispose event occurs.
Implementation
TrackEntry setAnimation(int trackIndex, Animation animation, bool loop) {
final entry = _bindings.spine_animation_state_set_animation(_state, trackIndex, animation._animation, loop ? -1 : 0);
if (entry.address == nullptr.address) throw Exception("Couldn't set animation ${animation.getName()}");
return TrackEntry._(entry, this);
}