How to play Animation Player manually

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mrpaolosarino

The common usage of Animation Player is using play() to play it.
But I have an animation that changes the player’s energy.
I want to hold a certain button and then continue to play the animation.

:bust_in_silhouette: Reply From: MrEliptik

You could listen to the animation_finished signal (see AnimationPlayer — Godot Engine (stable) documentation in English), if the player is still holding the button, you call AnimationPlayer.play() again.