欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

cocos creator~用skewTo实现翻牌效果

程序员文章站 2024-03-16 20:46:04
...
   turn(targetSpriteFrame){
        let t = this.turnDuration_;
        this.cardSprite_.node.runAction(
            cc.sequence(
                cc.spawn(
                    cc.scaleTo(t, 0, 1),
                    cc.skewTo(t, 0, 20)
                ),
                cc.callFunc(()=>{
                    this.cardSprite_.spriteFrame = targetSpriteFrame
                    this.cardSprite_.node.skewY = -20;
                }),
                cc.spawn(
                    cc.scaleTo(t, 1, 1),
                    cc.skewTo(t, 0, 0)
                ),
            )
        );
    },

 

相关标签: # creator 2d