So I was messing around posing an armor stand the other day, and I thought it would be cool if the armor stand could track players with their head. I've searched online a bit, but I've only seen one other case where someone got it to work, and even then the stand only turned it's head in 90 degree increments. Not sure if this had been done, or if it's even possible, but is there some way to use the execute command from an armor stand to test for the nearest players X and Z cords, and potentially use a Tangent() function to determine the angle the head needs to turn? The most ideal behavior would be if the stands head acted like an enchantment table book, except if there was no player in range it just returned to a default position instead of spinning. I realize that even if that's possible it's probably a royal pain to implement via commands, so really if anyone knows a command that kind of does something similar please share and I'll give it a shot.
I'm using 1.12.2 so if the only way to do this is in 1.13 so be it, but if not then all the better.