I’m assuming you want it to always face the current movement direction when taking damage.
Try this for the first picture:
Though, a better solution would be to change the direction of the character based on input instead of velocity. This will simplify things a lot.