Loop Animation While Holding Button

I created a button animation to play when I press the key but I want the button to loop the animation while its pressed. Is a “Do Once” loop the way to go since I want the animation to be manually controlled by the click hold? Or is there a better way to do this? This is my current code and the animation portion is on the top event in the middle. The animation node current just plays the set number of animations automatically when the button is pressed a single time, but I just want it to loop the animation while I have it pressed, and then stop when not pressed.

I just had to plug a Stop Animation node into the “on released” tree and it worked.