How to animate rotation over 360 degrees? #20
-
Hi! I'm trying to rotate a UI element 360 degrees but it rotates to 0 or 180
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! Quaternions don't represent the Euler angles, they represent the 'orientation' of the object. Because of this, these two rotations are actually identical Quaternion.Euler(0, 0, 360) == Quaternion.Euler(0, 0, 0) and the tween will do nothing. For the same reason, it's impossible to animate rotations beyond 180 degrees using Quaternions. To address this, there is the Tween.EulerAngles() method in PrimeTween that can animate the eulerAngles property. It can be used to animate loading indicator like this: Tween.EulerAngles(loadingIndicatorTransform, Vector3.zero, new Vector3(0, 0, 360), 1, Ease.Linear, -1); Please see more info in this post. |
Beta Was this translation helpful? Give feedback.
Hi! Quaternions don't represent the Euler angles, they represent the 'orientation' of the object. Because of this, these two rotations are actually identical Quaternion.Euler(0, 0, 360) == Quaternion.Euler(0, 0, 0) and the tween will do nothing. For the same reason, it's impossible to animate rotations beyond 180 degrees using Quaternions.
To address this, there is the Tween.EulerAngles() method in PrimeTween that can animate the eulerAngles property. It can be used to animate loading indicator like this:
Please see more info in this post.