美文网首页
背景循环

背景循环

作者: Vincy_ivy | 来源:发表于2019-05-04 23:26 被阅读0次

超级开心,终于搞定了代码

update: function (dt) {
    var parent_width = this.node.parent.width;
    console.log(parent_width);
    this.bg1.x -= this.bg_roll_speed;
    this.bg2.x -= this.bg_roll_speed;
       console.log(this.bg1.x, this.bg2.x);
    if (this.bg1.x <= -parent_width) {
        //var bg2_width = this.bg2.x;
        this.bg1.x = parent_width ;
    }
    if (this.bg2.x <= -parent_width) {
       // var bg1_width = this.bg1.x;
        this.bg2.x = parent_width ;

    }
},

相关文章

网友评论

      本文标题:背景循环

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