Animations Rotating beyond 360 Degrees

Hi, so my issue is that I have an attack animation where the enemy twirls 360 degrees as it attacks. However, right after this animation ends and before it transitions back to its idle/walking animation, the enemy would twirl 360 degrees again, i’m assuming in the opposite direction in attempt to counteract its previous rotation. Is there a way to stop this from happening? Thanks!