playAnimationByName method

  1. @override
Future playAnimationByName(
  1. ThermionEntity entity,
  2. String name, {
  3. bool loop = false,
  4. bool reverse = false,
  5. bool replaceActive = true,
  6. double crossfade = 0.0,
})
override

Schedules the glTF animation at index in entity to start playing on the next frame.

Implementation

@override
Future playAnimationByName(ThermionEntity entity, String name,
    {bool loop = false,
    bool reverse = false,
    bool replaceActive = true,
    double crossfade = 0.0}) async {
  final animationNames = await getAnimationNames(entity);
  final index = animationNames.indexOf(name);
  if (index == -1) {
    throw Exception("Animation ${name} not found.");
  }
  return playAnimation(entity, index,
      loop: loop,
      reverse: reverse,
      replaceActive: replaceActive,
      crossfade: crossfade);
}