背景滚动卡顿问题

cc.Class({
extends: cc.Component,
properties: {
gameBg: {
type: cc.Node,
default: [],
displayName: “背景图片”
},
moveSpeed: 300
},
onLoad() {
// this.run();
},
start() { },
run() {
let self = this;
let winSize = cc.winSize;
let durTime = winSize.height / this.moveSpeed;
let moveToAction = cc.moveTo(durTime, 0, -winSize.height);
let moveByAction = cc.moveBy(durTime, 0, -winSize.height);
let action = cc.sequence(
cc.spawn(moveToAction, cc.targetedAction(self.gameBg[1], moveByAction)),
cc.callFunc(() => { self.gameBg[0].position = new cc.Vec2(0, winSize.height); }),
cc.spawn(moveByAction, cc.targetedAction(self.gameBg[1], moveToAction)),
cc.callFunc(() => { self.gameBg[1].position = new cc.Vec2(0, winSize.height); }),
);
// action.repeatForever();
// this.gameBg[0].runAction(action);
cc.tween(this.gameBg[0]).repeatForever(action).start();
},
update(dt) {
this.gameBg[0].y -= this.moveSpeed * dt;
this.gameBg[1].y -= this.moveSpeed * dt;
this.bgheight = this.gameBg[1].height;
this.winheight = cc.winSize.height;
if (this.gameBg[0].y <= -this.winheight) {
this.gameBg[0].y = this.bgheight + this.gameBg[1].y;
}
if (this.gameBg[1].y <= -this.winheight) {
this.gameBg[1].y = this.bgheight + this.gameBg[0].y;
}
},
});
实现起来挺简单的,可是无论用action还是update出包以后哦在手机上运行起来都是一卡一卡的,怎么解决啊?尤其是小游戏。