美文网首页
camera Shake

camera Shake

作者: Albert_d37d | 来源:发表于2020-09-02 16:50 被阅读0次

    cc.Class({ extends: cc.Component, properties: { }, Shake() { this.pos = this.node.getPosition() let act1 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y + 5)) let act2 = cc.moveTo(0.03,cc.v2(this.pos.x - 4,this.pos.y + 5)) let act3 = cc.moveTo(0.03,cc.v2(this.pos.x - 4,this.pos.y + 3)) let act4 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y - 6)) let act5 = cc.moveTo(0.03,cc.v2(this.pos.x - 5,this.pos.y + 5)) let act6 = cc.moveTo(0.03,cc.v2(this.pos.x + 2,this.pos.y - 8)) let act7 = cc.moveTo(0.03,cc.v2(this.pos.x - 8,this.pos.y - 10)) let act8 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y + 10)) let act9 = cc.moveTo(0.03,this.pos) let rep = cc.repeatForever(cc.sequence( act1,act2,act3,act4,act5,act6,act7,act8,act9 )) this.node.runAction(rep) setTimeout(()=>{ if(this.node) { this.node.stopAllActions() this.node.setPosition(this.pos) } },1000) }, });

    相关文章

      网友评论

          本文标题:camera Shake

          本文链接:https://www.haomeiwen.com/subject/wfuwsktx.html