import { _decorator, Component, Label, Node, tween, UIOpacity } from 'cc'; const { ccclass, property } = _decorator; @ccclass('toast') export class toast extends Component { @property(Node) img_mask: Node = null; @property(Node) lab_text: Node = null; public show(text: string = "", opacity: number = 175) { this.img_mask.getComponent(UIOpacity).opacity = opacity; this.lab_text.getComponent(Label).string = text; tween(this.node).delay(2).hide().start() } }