// 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 import EventName from "../EventName/EventName"; import MyComponent from "../Template/MyComponent"; const { ccclass, property } = cc._decorator; @ccclass export default class Tips extends MyComponent { @property(cc.Label) label: cc.Label = null; onLoad(): void { this.node.opacity = 0 this.regEvent(EventName.Tips, this.Tips, this) } Tips(str: string) { this.runAnima() this.label.string = str } runAnima() { this.node.opacity = 255 cc.tween(this.node) .to(0.5, { opacity: 255 }) .delay(1) .to(0.5, { opacity: 0 }) .start() } }