code: function (vpos) {
              var rx = this.ratio.x,
                  ry = this.ratio.y;
  
              if (rx === ry === 0) {
                  // static image
                  return;
              }
  
              var viewport = me.game.viewport,
                  width = this.imagewidth,
                  height = this.imageheight,
                  bw = viewport.bounds.width,
                  bh = viewport.bounds.height,
                  ax = this.anchorPoint.x,
                  ay = this.anchorPoint.y,
  
                  /*
                   * Automatic positioning
                   *
                   * See https://github.com/melonjs/melonJS/issues/741#issuecomment-138431532
                   * for a thorough description of how this works.
                   */
                  x = ax * (rx - 1) * (bw - viewport.width) + this.offset.x - rx * vpos.x,
                  y = ay * (ry - 1) * (bh - viewport.height) + this.offset.y - ry * vpos.y;
  
  
              // Repeat horizontally; start drawing from left boundary
              if (this.repeatX) {
                  this.pos.x = x % width;
              }
              else {
                  this.pos.x = x;
              }
  
              // Repeat vertically; start drawing from top boundary
              if (this.repeatY) {
                  this.pos.y = y % height;
              }
              else {
                  this.pos.y = y;
              }
          }
docs: updateLayer function
  @ignore
  @function