Ordinarily I would just say name the animations by their angles, and just set it that way, but you are using mirrored, so maybe do a loop and compare the int(angle/n)*n to int((360/loopindex)/n)*n
Where the loop, and n are equal to the number of animations.
If you have 8 animations the angles would go in increments of 45 since 360/8= 45
So index 0= 0, index 1 = 45, 2 = 90, etc.