import { _decorator, Node, tween, v3, Vec3, Tween, UIRenderer } from 'cc'; const { ccclass, property } = _decorator; /** * 弹窗动画 - 使用弹性缓动效果实现弹窗出现的动画 * @param node 要应用动画的节点 * @param endScale 最终缩放比例,默认为1.0 * @param duration 动画持续时间,默认为1.2秒 * @param callback 动画完成后的回调函数 */ export function ani_ui(node: Node, end: number = 1.0): void { Tween.stopAllByTarget(node); // 打断旧动画 //重置scale node.setScale(0.5, 0.5, 1); tween(node) .to(1.2, { scale: v3(end, end, 1) }, { easing: 'elasticOut' }) .start(); }