Check out example codes for "x angle oes back after 90 unity". It will help you in understanding the concepts better.

Code Example 1

public static float CalcEulerSafeX(float x)
     {
         if (x >= -90 && x <= 90)
             return x;
         x = x % 180;
         if (x > 0)
             x -= 180;
         else
             x += 180;
         return x;
     }

Learn ReactJs, React Native from akashmittal.com