add stopAnimationByName

This commit is contained in:
Nick Fisher
2024-03-04 15:40:44 +08:00
parent 1680573a1e
commit 61299e4587
2 changed files with 8 additions and 0 deletions

View File

@@ -365,7 +365,9 @@ abstract class FilamentController {
Future setAnimationFrame(
FilamentEntity entity, int index, int animationFrame);
Future stopAnimation(FilamentEntity entity, int animationIndex);
Future stopAnimationByName(FilamentEntity entity, String name);
///
/// Sets the current scene camera to the glTF camera under [name] in [entity].

View File

@@ -950,6 +950,12 @@ class FilamentControllerFFI extends FilamentController {
_sceneManager!, entity, index, loop, reverse, replaceActive, crossfade);
}
@override
Future stopAnimationByName(FilamentEntity entity, String name) async {
var animations = await getAnimationNames(entity);
await stopAnimation(entity, animations.indexOf(name));
}
@override
Future playAnimationByName(FilamentEntity entity, String name,
{bool loop = false,