Unity3d从代码创建AnimationCurve(问题)

时间:2015-04-24 12:45:11

标签: unity3d unity3d-gui

我正在尝试从代码创建ui动画。位置动画工作正常,但旋转曲线创建错误。

enter image description here enter image description here

旋转值仅在最后一帧中更改。为什么呢?

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);

0 个答案:

没有答案