-
文档版本:3.7
-
具体的问题或改进建议:
3.4版本的文档
public start() {
const animationComponent = this.node.getComponent(Animation);
if (animationComponent && animationComponent.defaultClip) {
const { defaultClip } = animationComponent;
defaultClip.events.push({
frame: 0.5, // 第 0.5 秒时触发事件
func: 'onTriggered', // 事件触发时调用的函数名称
params: [ 0 ], // 向 `func` 传递的参数
});
defaultClip.updateEventDatas();
}
}
3.7版本的文档
public start() {
const animationComponent = this.node.getComponent(Animation);
if (animationComponent && animationComponent.defaultClip) {
const { defaultClip } = animationComponent;
defaultClip.events.push({
frame: 0.5, // 第 0.5 秒时触发事件
func: 'onTriggered', // 事件触发时调用的函数名称
params: [ 0 ], // 向 `func` 传递的参数
});
}
}
少了 defaultClip.updateEventDatas(); 实践下来 照着新文档少写updateEventDatas方法,但是运行下来帧事件函数没有触发,必须补了updateEventDatas才行
