You’ll probably have to restate the question. And no, just adding /2 isn’t what I was suggesting.
What alexto suggested is elegant imo. It reduces all those events down to one event. And anything can be modified to meet other requirements you may have later. We generally reply with ideas that ideally you can then use or maybe modify to be useful for you.
I don’t get the idea that formulas are your thing. I mean we all are at different levels. So here’s one last attempt.
315 to 45 should be -22.5 to 22.5
0 to 90 should be 22.5 to 67.5
45 to 135 should be 67.5 to 112.5
… and so on
Notice the pattern? Where one range stops the next one starts so there is no overlap and no directions will seem to be skipped.
I’ll leave it to you to find the other ranges but you can calculate them with:
a-45/2 to a+45/2
Alexto’s formula rounds an angle to the nearest 45 and combines it with an animation lookup. That’s super useful to simplify things.
The meat of it is round(a/45)*45 which rounds to the nearest 45.
And sure he wrote it for one animation type but it should be trivial to use the same idea for other animation types.
Anyways, that’s should get you some ideas maybe. I don’t think I can give anything simpler that wouldn’t require a lot of extra work on my part.