May I inquire about how to address a situation where the controlled character occasionally halts its movement while moving forward and turning?
I can reproduce your described unexpected behavior whenever holding both of the turn keys: A & D simultaneously / together.
I would recommend adding some more input to detect whether one of the turn keys are not being pressed while the other turn key is being pressed.
[A] pushed + [D] not pushed -> Turn left [A] not pushed + [D] pushed -> Turn right
The issue occurs because you detect for all key releases. So when “W” is kept pressed but “A” or “D” is released, the animation is set to idle. Until some other key is pressed.
One solution could be something like this:
Thank you for your teaching; I have gained knowledge from it.