import { _decorator, Component, Node, tween, UIOpacity, Vec3 } from 'cc'; const { ccclass, property } = _decorator; /**界面打开动画 */ @ccclass('UIOpenAni') export class UIOpenAni extends Component { private uiopa: UIOpacity = null; start() { this.uiopa = this.node.getComponent(UIOpacity); if (!this.uiopa) { this.uiopa = this.node.addComponent(UIOpacity); } //动作1 透明度 this.uiopa.opacity = 50; tween(this.uiopa).to(0.15, { opacity: 255 }).start(); //动作2 缩放 let origScale = new Vec3(this.node.scale.x, this.node.scale.y, this.node.scale.z); this.node.scale = new Vec3(0.7, 0.7, 0.7); tween(this.node).to(0.2, { scale: origScale }, { easing: 'backOut' }).start(); } update(deltaTime: number) { } }