<commit_before>var app = Potion.init(document.querySelector('.game'), {
  init: function() {
    this.particles = [];
    this.lastPosition = { x: null, y: null };
  },

  resize: function() {
    this.width = document.body.clientWidth;
    this.height = document.body.clientHeight;
  },

  mousemove: function(x, y) {
    if (this.lastPosition.x && this.lastPosition.y) {
      var dx = (x - this.lastPosition.x) * 20;
      var dy = (y - this.lastPosition.y) * 20;
      this.particles.push(new Particle(x, y, dx, dy));
    }

    this.lastPosition.x = this.input.mouse.position.x;
    this.lastPosition.y = this.input.mouse.position.y;
  },

  update: function(time) {
    for (var i=0, len=this.particles.length; i<len; i++) {
      var particle = this.particles[i];
      if (particle) { particle.update(time); }
    }
  },

  render: function() {
    for (var i=0, len=this.particles.length; i<len; i++) {
      var particle = this.particles[i];
      if (particle) { particle.render(); }
    }
  }
});

var Particle = function(x, y, dx, dy) {
  this.x = x;
  this.y = y;
  this.r = Math.random() * 20 + 5;
  this.dx = dx;
  this.dy = dy;

  var colors = ['#04819e', '#38b2ce', '#60b9ce', '#015367', '#ff9900'];<commit_msg>fix mouse position in particle example<commit_after>var app = Potion.init(document.querySelector('.game'), {
  init: function() {
    this.particles = [];
    this.lastPosition = { x: null, y: null };
  },

  resize: function() {
    this.width = document.body.clientWidth;
    this.height = document.body.clientHeight;
  },

  mousemove: function(x, y) {
    if (this.lastPosition.x && this.lastPosition.y) {
      var dx = (x - this.lastPosition.x) * 20;
      var dy = (y - this.lastPosition.y) * 20;
      this.particles.push(new Particle(x, y, dx, dy));
    }

    this.lastPosition.x = this.input.mouse.x;
    this.lastPosition.y = this.input.mouse.y;
  },

  update: function(time) {
    for (var i=0, len=this.particles.length; i<len; i++) {
      var particle = this.particles[i];
      if (particle) { particle.update(time); }
    }
  },

  render: function() {
    for (var i=0, len=this.particles.length; i<len; i++) {
      var particle = this.particles[i];
      if (particle) { particle.render(); }
    }
  }
});

var Particle = function(x, y, dx, dy) {
  this.x = x;
  this.y = y;
  this.r = Math.random() * 20 + 5;
  this.dx = dx;
  this.dy = dy;

  var colors = ['#04819e', '#38b2ce', '#60b9ce', '#015367', '#ff9900'];
{'fraction_non_alphanumeric': 0.18255578093306288, 'fraction_numerical': 0.02434077079107505, 'mean_word_length': 2.793846153846154, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6405401', 'n_tokens_mistral': 958, 'n_tokens_neox': 905, 'n_words': 194}