沿 Y 轴进行翻转

const {ccclass, property} = cc._decorator;
@ccclass
export default class MonsterTokenMoneyLogic extends cc.Component {
    @property(cc.Node)
    rotateYNode1: cc.Node = null;
    @property(cc.Node)
    rotateYNode2: cc.Node = null;
    tag: boolean = true; // true 旋转第一个节点, false 旋转第二个节点
    startNodePos: cc.Vec2 = null;
    start () {
        this.startNodePos = cc.v2(this.node.x, this.node.y);
        this.rotateYNode2.active = false;
    }
    update(dt: number) {
        if (this.actionEnd) {
            return;
        }
        if (this.rotateYNode1.scaleX === -1) {
            this.rotateYNode1.scaleX = 1;
            this.rotateYNode1.active = false;
            this.rotateYNode2.active = true;
            this.tag = false;
            return;
        }
        if (this.rotateYNode2.scaleX === -1) {
            this.rotateYNode2.scaleX = 1;
            this.rotateYNode1.active = true;
            this.rotateYNode2.active = false;
            this.tag = true;
            return;
        }
        if (this.tag) {
            let scaleX = (this.rotateYNode1.scaleX - dt * (this.isMove ? 7 : 4.5));
            scaleX = scaleX <= -1 ?  -1 : scaleX;
            this.rotateYNode1.scaleX= scaleX;
        } else {
            let scaleX = (this.rotateYNode2.scaleX - dt * (this.isMove ? 7 : 4.5));
            scaleX = scaleX <= -1 ?  -1 : scaleX;
            this.rotateYNode2.scaleX= scaleX;
        }
    }
}

沿 X 轴进行翻转


const {ccclass, property} = cc._decorator; @ccclass export default class MonsterTokenMoneyLogic extends cc.Component {

@property(cc.Node)
rotateYNode1: cc.Node = null;

@property(cc.Node)
rotateYNode2: cc.Node = null;

tag: boolean = true; // true 旋转第一个节点, false 旋转第二个节点
startNodePos: cc.Vec2 = null;

start () {
    this.startNodePos = cc.v2(this.node.x, this.node.y);
    this.rotateYNode2.active = false;
}

update(dt: number) {
    if (this.actionEnd) {
        return;
    }
    if (this.rotateYNode1.scaleY === -1) {
        this.rotateYNode1.scaleY = 1;
        this.rotateYNode1.active = false;
        this.rotateYNode2.active = true;
        this.tag = false;
        return;
    }
    if (this.rotateYNode2.scaleY === -1) {
        this.rotateYNode2.scaleY = 1;
        this.rotateYNode1.active = true;
        this.rotateYNode2.active = false;
        this.tag = true;
        return;
    }
    if (this.tag) {
        let scaleY = (this.rotateYNode1.scaleY - dt * (this.isMove ? 7 : 4.5));
        scaleY = scaleY &lt;= -1 ?  -1 : scaleY;
        this.rotateYNode1.scaleY= scaleY;
    } else {
        let scaleY = (this.rotateYNode2.scaleY - dt * (this.isMove ? 7 : 4.5));
        scaleY = scaleY &lt;= -1 ?  -1 : scaleY;
        this.rotateYNode2.scaleY= scaleY;
    }
}}

节点图