shouldent it be 1 and 360 degrees?

and if not then you need

rotateTo >= 0 && rotateTo <= 359 (bug).

I would assume...