I animated a TextureRect (black square) which comes from below the screen and disappears the same way (in AnimationPlayer: the TextureRect goes from one position to another). I want it so when holding a button (ex.: RMB) the animation plays and the TextureRect appears (comes up from below the screen via AnimationPlayer) and stays there as long as I'm holding down the button. And when I release the button, the TextureRect disappears with the corresponding animation (goes back, down below the screen via AnimationPlayer).
So far, I used this code so the TextureRect just appears and disappears but now I need it to do the same with animation.
if Input.is_action_pressed("aim"):
$black_box.visible = true
else:
$black_box.visible = false