import { _decorator, Component, Node } from 'cc'; import { ScriptMyAnimation } from './ScriptMyAnimation'; const { ccclass, property } = _decorator; @ccclass('AnimationNode') export class AnimationNode extends Node{ constructor(AnimationPath: string,aniDone?:Function) { super(); let aniNode = new Node(); let ani = aniNode.addComponent( ScriptMyAnimation) ani.AnimationPath = AnimationPath; ani.onAniDone = aniDone; this.addChild(aniNode); } }