// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html const { ccclass, property } = cc._decorator; @ccclass export default class CanmeraScrpts extends cc.Component { Character: cc.Node = null;//人物节点 protected onLoad(): void { let Mask = this.node.getChildByName("Mask") Mask.active=true } protected lateUpdate(dt: number): void { this?.node?.setPosition(this?.Character?.position.x, this?.Character?.position.y + 510) } BronAni() { let Mask = this.node.getChildByName("Mask") cc.tween(Mask) .to(0, { opacity: 255 }) .to(2, { opacity: 0 }, { easing: 'fadeOut' }) .call(() => { Mask.destroy() }) .start() } }