cocoscreator抖动效果

0.096字数 0阅读 690
    let x = this.watermelonNode.x; let y = this.watermelonNode.y;
        let offset = 10;
        let action = cc.repeatForever(
            cc.sequence(
                cc.moveTo(0.018, cc.v2(x + (5 + offset), y + (offset + 7))),
                cc.moveTo(0.018, cc.v2(x - (6 + offset), y + (offset + 7))),
                cc.moveTo(0.018, cc.v2(x - (13 + offset), y + (offset + 3))),
                cc.moveTo(0.018, cc.v2(x + (3 + offset), y - (6 + offset))),
                cc.moveTo(0.018, cc.v2(x - (5 + offset), y + (offset + 5))),
                cc.moveTo(0.018, cc.v2(x + (2 + offset), y - (8 + offset))),
                cc.moveTo(0.018, cc.v2(x - (8 + offset), y - (10 + offset))),
                cc.moveTo(0.018, cc.v2(x + (3 + offset), y + (offset + 10))),
                cc.moveTo(0.018, cc.v2(x + (0 + offset), y + (offset + 0)))
            )
        )
        this.watermelonNode.runAction(action);
        setTimeout(() => {
            this.watermelonNode.stopAction(action);
            this.watermelonNode.x = x; this.watermelonNode.y = y;
        }, 1000);

推荐阅读更多精彩内容