addAnimationByName method

TrackEntry addAnimationByName(
  1. int trackIndex,
  2. String animationName,
  3. bool loop,
  4. double delay,
)

Queues an animation by name.

See addAnimation.

Implementation

TrackEntry addAnimationByName(int trackIndex, String animationName, bool loop, double delay) {
  final animation = animationName.toNativeUtf8(allocator: _allocator);
  final entry = _bindings.spine_animation_state_add_animation_by_name(_state, trackIndex, animation.cast(), loop ? -1 : 0, delay);
  _allocator.free(animation);
  if (entry.address == nullptr.address) throw Exception("Couldn't add animation $animationName");
  return TrackEntry._(entry, this);
}