- 最后登录
- 2018-12-19
- 注册时间
- 2012-8-20
- 阅读权限
- 90
- 积分
- 54706
- 纳金币
- 32328
- 精华
- 41
|
The power of animation clips can be increased by using Animation Events, which allow you to call functions in the object's script at specified points in the timeline.动画剪辑中可以添加动画事件,使你在时间轴特定的帧调用脚本中的函数。The function called by an animation event can optionally take one parameter. The parameter can be a float, string, int, object reference or an AnimationEvent object. The AnimationEvent object has member variables that allow a float, string, integer and object reference to be passed into the function all at once, along with other information about the event that triggered the function call.动画事件调用函数时,可以用一个参数。参数可以是float,string,应用对象,或者动画事件对象。函数被调用时,动画事件对象可以将float,string,integer和引用对象等,这些成员变量全部传递给函数。// This JavaScript function can be called by an Animation Event
//这个JavaScript函数会被动画事件调用
function PrintFloat (theValue : float) {
Debug.Log ("rintFloat is called with a value of " + theValue);
}You can add an animation event to a clip at the current playhead position by clicking the Event button or at any point in the animation by double-clicking the Event Line at the point where you want the event to be triggered. Once added, an event can be repositioned by dragging with the mouse. You can delete an event by selecting it and pressing Delete, or by right-clicking on it and selecting Delete Event from the contextual menu.你可以在动画剪辑添加动画事件,在当前播放头的位置,单击"事件"按钮,或在任何时候在动画中通过双击你想要的事件被触发的事件行的地步。添加完毕后,一个事件可以用鼠标拖动来重新定位。你可以选择它,然后按下Delete键,删除事件,或用鼠标右键单击它,并从上下文菜单中选择删除事件。
Animation Events are shown in the Event Line. Add a new Animation Event by double-clicking the Event Line or by using the Event button.
动画事件显示在事件行上。通过双击事件行,或使用"事件"按钮,添加一个新的动画事件。When you add an event, a dialog box will appear to prompt you for the name of the function and the value of the parameter you want to pass to it.当您添加一个事件时,会出现一个对话框,提示你选择你函数和函数所需要的参数。
The Animation Event popup dialog lets you specify which function to call with which parameter value.
在动画事件 对话框上 可以选择函数并输入该函数的参数The events added to a clip are shown as markers in the event line. Holding the mouse over a marker will show a tooltip with the function name and parameter value.添加到剪辑的事件会显示标记在事件轴上。鼠标移动到标记上,可以查看函数的名字和参数。
Holding the mouse cursor over an Animation Event marker will show which function it calls as well as the parameter value.
鼠标移动到动画事件标记上,会显示函数的名字和参数。
【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/ |
|