<commit_before>class Animation {
  options; // .frames, .frameDuration, .x, .y, .game
  currentTick;
  lastTick;
  diffTick;
  curFrame;
  sprite;
  sprites;
  x;
  y;

  constructor(options) {
    this.options = options;

    this.sprite = new Pentagine.Sprite(options.game,
                                       options.frames[0],
                                       options.x,
                                       options.y);

    this.sprites = [];

    _.each(this.options.frames, ((el, index) => {
      this.sprites.push(new Pentagine.Sprite(this.options.game, el, this.options.x, this.options.y));
    }).bind(this));

    this.x = options.x;
    this.y = options.y;

    this.frameDuration = options.frameDuration;
    this.currentTick = (new Date()).getTime();
    this.lastTick = this.currentTick;
    this.diffTick = 0;
    this.curFrame = 0;
  }

  update() {
    this.currentTick = (new Date()).getTime();
    this.diffTick += this.currentTick - this.lastTick;

    if (this.diffTick > this.options.frameDuration) {
      this.curFrame = this.curFrame == this.options.frames.length - 1 ? 0 : this.curFrame + 1;

      let x = this.sprite.x;
      let y = this.sprite.y;

      this.sprite = this.sprites[this.curFrame];
      this.sprite.x = x;
      this.sprite.y = y;

      this.diffTick = 0;
    }

    this.lastTick = this.currentTick;
  }

  set x(value) {
    this.sprite.x = value;
  }

  set y(value) {
    this.sprite.y = value;
  }

  get x() {
    return this.sprite.x;
  }

  get y() {
    return this.sprite.y;
  }

  draw() {
    this.sprite.draw();
  }
}

module.exports = Animation;
<commit_msg>Renames .sprite in Animation class to .curSprite.<commit_after>class Animation {
  options; // .frames, .frameDuration, .x, .y, .game
  currentTick;
  lastTick;
  diffTick;
  curFrame;
  curSprite;
  sprites;
  x;
  y;

  constructor(options) {
    this.options = options;

    this.curSprite = new Pentagine.Sprite(options.game,
                                          options.frames[0],
                                          options.x,
                                          options.y);

    this.sprites = [];

    _.each(this.options.frames, ((el, index) => {
      this.sprites.push(new Pentagine.Sprite(this.options.game, el, this.options.x, this.options.y));
    }).bind(this));

    this.x = options.x;
    this.y = options.y;

    this.frameDuration = options.frameDuration;
    this.currentTick = (new Date()).getTime();
    this.lastTick = this.currentTick;
    this.diffTick = 0;
    this.curFrame = 0;
  }

  update() {
    this.currentTick = (new Date()).getTime();
    this.diffTick += this.currentTick - this.lastTick;

    if (this.diffTick > this.options.frameDuration) {
      this.curFrame = this.curFrame == this.options.frames.length - 1 ? 0 : this.curFrame + 1;

      let x = this.curSprite.x;
      let y = this.curSprite.y;

      this.curSprite = this.sprites[this.curFrame];
      this.curSprite.x = x;
      this.curSprite.y = y;

      this.diffTick = 0;
    }

    this.lastTick = this.currentTick;
  }

  set x(value) {
    this.curSprite.x = value;
  }

  set y(value) {
    this.curSprite.y = value;
  }

  get x() {
    return this.curSprite.x;
  }

  get y() {
    return this.curSprite.y;
  }

  draw() {
    this.curSprite.draw();
  }
}

module.exports = Animation;

{'fraction_non_alphanumeric': 0.1414050822122571, 'fraction_numerical': 0.004185351270553065, 'mean_word_length': 1.9742222222222223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7343615', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1132, 'n_words': 212}