我正在尝试从代码创建ui动画。位置动画工作正常,但旋转曲线创建错误。
旋转值仅在最后一帧中更改。为什么呢?
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);