【发布时间】:2014-12-23 08:45:38
【问题描述】:
在实例化按钮并将它们添加到场景中时,我需要执行某种动画,因此它们会通过向下滑动动画(或向左或向右滑动)添加到场景中。 到目前为止我的代码:
for (int i = 0; i < 4; i++) {
// Instantiate 4 buttons
Transform clone = (Transform)Instantiate (suggestionBtn,
new Vector3 (4, y, 0), Quaternion.identity);
// make instance the child of the canvas
clone.SetParent(gameObject.transform, false);
clone.transform.rotation = transform.localRotation;
y -= 70;
}
我不确定我是否需要制作动画文件并将它们附加到我需要动画的每个按钮或使用像LeanTween 这样的引擎,或者只是几行代码可以确保向下滑动/向左滑动/滑动正确的动画?
【问题讨论】:
-
很难,这是一个陈旧且过于复杂的脚本。您可能可以充分利用这个pastebin.com/18Xp09Ai 它有 4 个按钮的设置,每个按钮都有另外 4 个按钮。它向下滑动,然后向侧面滑动。 Itween 和 leantween 也是一个不错的选择。
-
如果您不想使用第 3 方资源 (iTween),您可以创建自己的补间方法。在这里看一个类似的问题,看看我的回答stackoverflow.com/questions/27119906/…