2

I am trying to create ui animation from code. Position animation works fine, but rotation curves created wrong.

enter image description here enter image description here

rotation value changing only in last frame. why?

var angle = Quaternion.Euler(FadeOutEndAngleX, FadeOutEndAngleY, FadeOutEndAngleZ);

curve1 = AnimationCurve.Linear(0f, 0f, 0.5f, Screen.width);
curve2 = AnimationCurve.Linear(0f, 0f, 0.5f, Screen.height);
curve3 = AnimationCurve.Linear(0f, 0f, 0.5f, angle.x);
curve4 = AnimationCurve.Linear(0f, 0f, 0.5f, angle.y);
curve5 = AnimationCurve.Linear(0f, 0f, 0.5f, angle.z);
curve6 = AnimationCurve.Linear(0f, 0f, 0.5f, angle.w);

clip.SetCurve("", typeof(RectTransform), "m_AnchoredPosition.x", curve1);
clip.SetCurve("", typeof(RectTransform), "m_AnchoredPosition.y", curve2);
clip.SetCurve("", typeof(RectTransform), "localRotation.x", curve3);
clip.SetCurve("", typeof(RectTransform), "localRotation.y", curve4);
clip.SetCurve("", typeof(RectTransform), "localRotation.z", curve5);
clip.SetCurve("", typeof(RectTransform), "localRotation.w", curve6);
4

0 回答 0